Skip to content

Commit

Permalink
openssl ca: make index.txt parsing error more verbose
Browse files Browse the repository at this point in the history
If index.txt exists but has some problems (like for example a single \n character in it) openssl will just exit without any error message.

Bug at least expirienced twice: https://superuser.com/questions/1327848/openssl-ca-fails-after-password-without-error-message

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#15360)
  • Loading branch information
FlorianMickler authored and t8m committed May 24, 2021
1 parent 669967f commit ca29cc1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/ca.c
Expand Up @@ -556,8 +556,10 @@ int ca_main(int argc, char **argv)
goto end;

db = load_index(dbfile, &db_attr);
if (db == NULL)
if (db == NULL) {
BIO_printf(bio_err, "Problem with index file: %s (could not load/parse file)\n", dbfile);
goto end;
}

if (index_index(db) <= 0)
goto end;
Expand Down Expand Up @@ -684,8 +686,10 @@ int ca_main(int argc, char **argv)
goto end;

db = load_index(dbfile, &db_attr);
if (db == NULL)
if (db == NULL) {
BIO_printf(bio_err, "Problem with index file: %s (could not load/parse file)\n", dbfile);
goto end;
}

/* Lets check some fields */
for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++) {
Expand Down

0 comments on commit ca29cc1

Please sign in to comment.