From: Nikos Mavrogiannopoulos Date: Sat, 4 Aug 2012 10:05:29 +0000 (+0200) Subject: Exit with an error code if a PKCS #12 structure cannot be decrypted. X-Git-Tag: gnutls_3_1_0pre0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0962b305de154fa3fce0b3c5a4b10958fd30ce7;p=thirdparty%2Fgnutls.git Exit with an error code if a PKCS #12 structure cannot be decrypted. --- diff --git a/src/certtool.c b/src/certtool.c index 70d6357d93..f70eac0ba6 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -2562,7 +2562,7 @@ pkcs12_info (common_info_st* cinfo) size_t size; gnutls_datum_t data; const char *pass; - int indx; + int indx, fail = 0; result = gnutls_pkcs12_init (&pkcs12); if (result < 0) @@ -2583,7 +2583,10 @@ pkcs12_info (common_info_st* cinfo) result = gnutls_pkcs12_verify_mac (pkcs12, pass); if (result < 0) - error (0, 0, "verify_mac: %s", gnutls_strerror (result)); + { + fail = 1; + error (0, 0, "verify_mac: %s", gnutls_strerror (result)); + } for (indx = 0;; indx++) { @@ -2614,6 +2617,7 @@ pkcs12_info (common_info_st* cinfo) if (result < 0) { + fail = 1; error (0, 0, "bag_decrypt: %s", gnutls_strerror (result)); continue; } @@ -2628,6 +2632,9 @@ pkcs12_info (common_info_st* cinfo) gnutls_pkcs12_bag_deinit (bag); } + + if (fail) + error (EXIT_FAILURE, 0, "There were errors parsing the structure\n"); } void