diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2023-05-15 19:59:16 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2023-06-14 08:36:20 +0200 |
commit | 1737fb8f455963b0956c81504a2bec4304bd902d (patch) | |
tree | 8cfbe993cb7f9031e9efd86753915a38841226b2 /apps/ca.c | |
parent | bb13f852e9610835b0003e3d26fda0531a3e2b95 (diff) |
APPS: remove spurious errors when certain config file entries are not provided
This backports the functional essence of #20971.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/21050)
Diffstat (limited to 'apps/ca.c')
-rw-r--r-- | apps/ca.c | 29 |
1 files changed, 22 insertions, 7 deletions
@@ -628,6 +628,8 @@ end_of_options: f = NCONF_get_string(conf, section, ENV_NAMEOPT); + if (f == NULL) + ERR_clear_error(); if (f != NULL) { if (!set_nameopt(f)) { BIO_printf(bio_err, "Invalid name options: \"%s\"\n", f); @@ -785,8 +787,10 @@ end_of_options: /* We can have sections in the ext file */ if (extensions == NULL) { extensions = NCONF_get_string(extfile_conf, "default", "extensions"); - if (extensions == NULL) + if (extensions == NULL) { + ERR_clear_error(); extensions = "default"; + } } } @@ -824,6 +828,8 @@ end_of_options: char *tmp_email_dn = NULL; tmp_email_dn = NCONF_get_string(conf, section, ENV_DEFAULT_EMAIL_DN); + if (tmp_email_dn == NULL) + ERR_clear_error(); if (tmp_email_dn != NULL && strcmp(tmp_email_dn, "no") == 0) email_dn = 0; } @@ -839,6 +845,7 @@ end_of_options: if (NCONF_get_string(conf, section, ENV_RAND_SERIAL) != NULL) { rand_ser = 1; } else { + ERR_clear_error(); serialfile = lookup_conf(conf, section, ENV_SERIAL); if (serialfile == NULL) goto end; @@ -908,8 +915,10 @@ end_of_options: } if (days == 0) { - if (!NCONF_get_number(conf, section, ENV_DEFAULT_DAYS, &days)) + if (!NCONF_get_number(conf, section, ENV_DEFAULT_DAYS, &days)) { + ERR_clear_error(); days = 0; + } } if (enddate == NULL && days == 0) { BIO_printf(bio_err, "cannot lookup how many days to certify for\n"); @@ -1161,22 +1170,28 @@ end_of_options: } } - if ((crlnumberfile = NCONF_get_string(conf, section, ENV_CRLNUMBER)) - != NULL) + crlnumberfile = NCONF_get_string(conf, section, ENV_CRLNUMBER); + if (crlnumberfile != NULL) { if ((crlnumber = load_serial(crlnumberfile, NULL, 0, NULL)) == NULL) { BIO_printf(bio_err, "error while loading CRL number\n"); goto end; } + } else { + ERR_clear_error(); + } if (!crldays && !crlhours && !crlsec) { if (!NCONF_get_number(conf, section, - ENV_DEFAULT_CRL_DAYS, &crldays)) + ENV_DEFAULT_CRL_DAYS, &crldays)) { + ERR_clear_error(); crldays = 0; + } if (!NCONF_get_number(conf, section, - ENV_DEFAULT_CRL_HOURS, &crlhours)) + ENV_DEFAULT_CRL_HOURS, &crlhours)) { + ERR_clear_error(); crlhours = 0; - ERR_clear_error(); + } } if ((crl_nextupdate == NULL) && (crldays == 0) && (crlhours == 0) && (crlsec == 0)) { |