Make "oneline" the default for nameopt

There's no reason why we should default to a output format that is
old, and confusing in some cases.

This affects the commands "ca", "crl", "req" and "x509".

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Richard Levitte 2015-07-07 11:13:20 +02:00
parent 5727582cf5
commit f1cece554d
4 changed files with 21 additions and 3 deletions

View File

@ -325,7 +325,7 @@ opthelp:
ret = 0; ret = 0;
goto end; goto end;
case OPT_IN: case OPT_IN:
req = 1; req = 1;
infile = opt_arg(); infile = opt_arg();
break; break;
case OPT_OUT: case OPT_OUT:
@ -638,8 +638,10 @@ end_of_options:
goto end; goto end;
} }
default_op = 0; default_op = 0;
} else } else {
nameopt = XN_FLAG_ONELINE;
ERR_clear_error(); ERR_clear_error();
}
f = NCONF_get_string(conf, section, ENV_CERTOPT); f = NCONF_get_string(conf, section, ENV_CERTOPT);

View File

@ -114,6 +114,7 @@ int crl_main(int argc, char **argv)
EVP_PKEY *pkey; EVP_PKEY *pkey;
const EVP_MD *digest = EVP_sha1(); const EVP_MD *digest = EVP_sha1();
unsigned long nmflag = 0; unsigned long nmflag = 0;
char nmflag_set = 0;
char *infile = NULL, *outfile = NULL, *crldiff = NULL, *keyfile = NULL; char *infile = NULL, *outfile = NULL, *crldiff = NULL, *keyfile = NULL;
char *CAfile = NULL, *CApath = NULL, *prog; char *CAfile = NULL, *CApath = NULL, *prog;
OPTION_CHOICE o; OPTION_CHOICE o;
@ -206,6 +207,7 @@ int crl_main(int argc, char **argv)
badsig = 1; badsig = 1;
break; break;
case OPT_NAMEOPT: case OPT_NAMEOPT:
nmflag_set = 1;
if (!set_name_ex(&nmflag, opt_arg())) if (!set_name_ex(&nmflag, opt_arg()))
goto opthelp; goto opthelp;
break; break;
@ -217,6 +219,9 @@ int crl_main(int argc, char **argv)
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); argv = opt_rest();
if (!nmflag_set)
nmflag = XN_FLAG_ONELINE;
if (!app_load_modules(NULL)) if (!app_load_modules(NULL))
goto end; goto end;

View File

@ -211,6 +211,7 @@ int req_main(int argc, char **argv)
int nodes = 0, kludge = 0, newhdr = 0, subject = 0, pubkey = 0; int nodes = 0, kludge = 0, newhdr = 0, subject = 0, pubkey = 0;
long newkey = -1; long newkey = -1;
unsigned long chtype = MBSTRING_ASC, nmflag = 0, reqflag = 0; unsigned long chtype = MBSTRING_ASC, nmflag = 0, reqflag = 0;
char nmflag_set = 0;
#ifndef OPENSSL_NO_DES #ifndef OPENSSL_NO_DES
cipher = EVP_des_ede3_cbc(); cipher = EVP_des_ede3_cbc();
@ -323,6 +324,7 @@ int req_main(int argc, char **argv)
chtype = MBSTRING_UTF8; chtype = MBSTRING_UTF8;
break; break;
case OPT_NAMEOPT: case OPT_NAMEOPT:
nmflag_set = 1;
if (!set_name_ex(&nmflag, opt_arg())) if (!set_name_ex(&nmflag, opt_arg()))
goto opthelp; goto opthelp;
break; break;
@ -352,7 +354,7 @@ int req_main(int argc, char **argv)
goto opthelp; goto opthelp;
break; break;
case OPT_SUBJECT: case OPT_SUBJECT:
subject = 1; subject = 1;
break; break;
case OPT_SUBJ: case OPT_SUBJ:
subj = opt_arg(); subj = opt_arg();
@ -375,6 +377,10 @@ int req_main(int argc, char **argv)
} }
argc = opt_num_rest(); argc = opt_num_rest();
argv = opt_rest(); argv = opt_rest();
if (!nmflag_set)
nmflag = XN_FLAG_ONELINE;
private = newreq && (pkey == NULL) ? 1 : 0; private = newreq && (pkey == NULL) ? 1 : 0;
if (!app_passwd(passargin, passargout, &passin, &passout)) { if (!app_passwd(passargin, passargout, &passin, &passout)) {

View File

@ -227,6 +227,7 @@ int x509_main(int argc, char **argv)
int text = 0, serial = 0, subject = 0, issuer = 0, startdate = 0; int text = 0, serial = 0, subject = 0, issuer = 0, startdate = 0;
int checkoffset = 0, enddate = 0; int checkoffset = 0, enddate = 0;
unsigned long nmflag = 0, certflag = 0; unsigned long nmflag = 0, certflag = 0;
char nmflag_set = 0;
OPTION_CHOICE o; OPTION_CHOICE o;
ENGINE *e = NULL; ENGINE *e = NULL;
#ifndef OPENSSL_NO_MD5 #ifndef OPENSSL_NO_MD5
@ -360,6 +361,7 @@ int x509_main(int argc, char **argv)
goto opthelp; goto opthelp;
break; break;
case OPT_NAMEOPT: case OPT_NAMEOPT:
nmflag_set = 1;
if (!set_name_ex(&nmflag, opt_arg())) if (!set_name_ex(&nmflag, opt_arg()))
goto opthelp; goto opthelp;
break; break;
@ -488,6 +490,9 @@ int x509_main(int argc, char **argv)
goto opthelp; goto opthelp;
} }
if (!nmflag_set)
nmflag = XN_FLAG_ONELINE;
if (!app_load_modules(NULL)) if (!app_load_modules(NULL))
goto end; goto end;