From ca29cc1453945fe92c86a312c0f94a8976a46856 Mon Sep 17 00:00:00 2001 From: Florian Mickler Date: Mon, 13 Jan 2020 01:44:24 +0100 Subject: [PATCH] openssl ca: make index.txt parsing error more verbose 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 Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/15360) --- apps/ca.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/ca.c b/apps/ca.c index 923ede4cde0ea..32abc021a6ba4 100755 --- a/apps/ca.c +++ b/apps/ca.c @@ -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; @@ -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++) {