[pkg-opensc-commit] [engine-pkcs11] 117/152: Made error message more specific to context

Eric Dorland eric at moszumanska.debian.org
Mon Oct 19 03:11:23 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository engine-pkcs11.

commit 64b8aa367d5a8a249d750b8b7a8c5ebf5015cb72
Author: Nikos Mavrogiannopoulos <nmav at redhat.com>
Date:   Tue Jun 23 10:52:23 2015 +0200

    Made error message more specific to context
    
    Signed-off-by: Nikos Mavrogiannopoulos <nmav at redhat.com>
---
 src/engine_pkcs11.c | 53 +++++++++++++++++++++++++++++++++++------------------
 1 file changed, 35 insertions(+), 18 deletions(-)

diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c
index 1d1a7ee..1ee4f30 100644
--- a/src/engine_pkcs11.c
+++ b/src/engine_pkcs11.c
@@ -543,18 +543,26 @@ static X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id)
 					pin_length = tmp_pin_len;
 				}
 			}
+
+			if (!n) {
+				fprintf(stderr,
+					"The certificate ID is not a valid PKCS#11 URI as\n");
+				fprintf(stderr,
+					"defined by RFC7512.\n");
+				return NULL;
+			}
 		} else {
 			n = parse_slot_id_string(s_slot_cert_id, &slot_nr,
 						 cert_id, &cert_id_len, &cert_label);
-		}
-		if (!n) {
-			fprintf(stderr,
-				"The certificate ID should be a valid PKCS#11 URI as\n");
-			fprintf(stderr,
-				"defined by RFC7512. The legacy ENGINE_pkcs11 ID format\n");
-			fprintf(stderr,
-				"is also still accepted for now.\n");
-			return NULL;
+			if (!n) {
+				fprintf(stderr,
+					"The certificate ID should be a valid PKCS#11 URI as\n");
+					fprintf(stderr,
+					"defined by RFC7512. The legacy ENGINE_pkcs11 ID format\n");
+				fprintf(stderr,
+					"is also still accepted for now.\n");
+				return NULL;
+			}
 		}
 		if (verbose) {
 			fprintf(stderr, "Looking in slot %d for certificate: ",
@@ -739,20 +747,29 @@ static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id,
 					pin_length = tmp_pin_len;
 				}
 			}
+
+			if (!n) {
+				fprintf(stderr,
+					"The key ID is not a valid PKCS#11 URI as defined by\n");
+				fprintf(stderr,
+					"RFC7512.\n");
+				return NULL;
+			}
 		} else {
 			n = parse_slot_id_string(s_slot_key_id, &slot_nr,
 						 key_id, &key_id_len, &key_label);
-		}
 
-		if (!n) {
-			fprintf(stderr,
-				"The key ID should be a valid PKCS#11 URI as defined by\n");
-			fprintf(stderr,
-				"RFC7512. The legacy ENGINE_pkcs11 ID format is also\n");
-			fprintf(stderr,
-				"still accepted for now.\n");
-			return NULL;
+			if (!n) {
+				fprintf(stderr,
+					"The key ID should be a valid PKCS#11 URI as defined by\n");
+				fprintf(stderr,
+					"RFC7512. The legacy ENGINE_pkcs11 ID format is also\n");
+				fprintf(stderr,
+					"still accepted for now.\n");
+				return NULL;
+			}
 		}
+
 		if (verbose) {
 			fprintf(stderr, "Looking in slot %d for key: ",
 				slot_nr);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/engine-pkcs11.git



More information about the pkg-opensc-commit mailing list