summaryrefslogtreecommitdiffstats
path: root/apps/apps.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2017-12-27 18:29:36 +0100
committerRichard Levitte <levitte@openssl.org>2017-12-28 16:07:58 +0100
commitbfa470a4f64313651a35571883e235d3335054eb (patch)
treeb6675484f7b90f396b23c34b5449e86ce8d58c4d /apps/apps.c
parent8175af50cc208c09f92b30358d30dd86c798b60e (diff)
Add 'openssl req' option to specify extension values on command line
The idea is to be able to add extension value lines directly on the command line instead of through the config file, for example: openssl req -new -extension 'subjectAltName = DNS:dom.ain, DNS:oth.er' \ -extension 'certificatePolicies = 1.2.3.4' Fixes #3311 Thank you Jacob Hoffman-Andrews for the inspiration Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4986)
Diffstat (limited to 'apps/apps.c')
-rw-r--r--apps/apps.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/apps.c b/apps/apps.c
index 3040566257..834cedd5a3 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -442,7 +442,7 @@ static char *app_get_pass(const char *arg, int keepbio)
return OPENSSL_strdup(tpass);
}
-static CONF *app_load_config_(BIO *in, const char *filename)
+CONF *app_load_config_bio(BIO *in, const char *filename)
{
long errorline = -1;
CONF *conf;
@@ -453,12 +453,17 @@ static CONF *app_load_config_(BIO *in, const char *filename)
if (i > 0)
return conf;
- if (errorline <= 0)
- BIO_printf(bio_err, "%s: Can't load config file \"%s\"\n",
- opt_getprog(), filename);
+ if (errorline <= 0) {
+ BIO_printf(bio_err, "%s: Can't load ", opt_getprog());
+ } else {
+ BIO_printf(bio_err, "%s: Error on line %ld of ", opt_getprog(),
+ errorline);
+ }
+ if (filename != NULL)
+ BIO_printf(bio_err, "config file \"%s\"\n", filename);
else
- BIO_printf(bio_err, "%s: Error on line %ld of config file \"%s\"\n",
- opt_getprog(), errorline, filename);
+ BIO_printf(bio_err, "config input");
+
NCONF_free(conf);
return NULL;
}
@@ -472,7 +477,7 @@ CONF *app_load_config(const char *filename)
if (in == NULL)
return NULL;
- conf = app_load_config_(in, filename);
+ conf = app_load_config_bio(in, filename);
BIO_free(in);
return conf;
}
@@ -486,7 +491,7 @@ CONF *app_load_config_quiet(const char *filename)
if (in == NULL)
return NULL;
- conf = app_load_config_(in, filename);
+ conf = app_load_config_bio(in, filename);
BIO_free(in);
return conf;
}