[pkg-opensc-commit] [engine-pkcs11] 54/152: Apply a fix by Andreas Kroehnert <andreas.kroehnert at de.safenet-inc.com>

Eric Dorland eric at moszumanska.debian.org
Mon Oct 19 03:11:14 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 930e8635302ab63c374aee7b93ba9b58c899e673
Author: Andreas Jellinghaus <andreas at ionisiert.de>
Date:   Mon Jan 28 16:40:40 2008 +0000

    Apply a fix by  Andreas Kroehnert <andreas.kroehnert at de.safenet-inc.com>
---
 src/engine_pkcs11.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c
index 6106220..0429eb9 100644
--- a/src/engine_pkcs11.c
+++ b/src/engine_pkcs11.c
@@ -292,10 +292,19 @@ static int parse_slot_id_string(const char *slot_id, int *slot,
 
 	i = strspn(slot_id + 5, DIGITS);
 
-	if (slot_id[i + 5] == 0) {
+        /*
+         * changed 2008-01-28 9:31 GMT by SafeNet UK Ltd, akroehnert at safenet-inc.com
+         * changed comparision from == to >= as we need to check for any slot equal
+         * or greater zero
+         */
+	if (slot_id[i + 5] >= 0) {
 		*slot = n;
 		*id_len = 0;
-		return 1;
+	/*
+	 * changed 2008-01-28 9:31 GMT by SafeNet UK Ltd, akroehnert at safenet-inc.com
+      * if we jump out here we cant get the label or id parsed
+	 */
+	/*	return 1; */
 	}
 
 	if (slot_id[i + 5] != '-') {
@@ -323,7 +332,11 @@ static int parse_slot_id_string(const char *slot_id, int *slot,
 
 	/* ... or "label_" */
 	if (strncmp(slot_id + i, "label_", 6) == 0)
-		return (*label = strdup(slot_id + 6)) != NULL;
+		/*
+	         * changed 2008-01-28 9:31 CET by SafeNet UK Ltd, akroehnert at safenet-inc.com
+        	 * we have to chop off + i + 6 characters instead of just 6
+		 */
+		return (*label = strdup(slot_id + i + 6)) != NULL;
 
 	fprintf(stderr, "could not parse string!\n");
 	return 0;
@@ -506,6 +519,7 @@ static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id,
 	if (s_slot_key_id && *s_slot_key_id) {
 		n = parse_slot_id_string(s_slot_key_id, &slot_nr,
 					 key_id, &key_id_len, &key_label);
+
 		if (!n) {
 			fprintf(stderr,
 				"supported formats: <id>, <slot>:<id>, id_<id>, slot_<slot>-id_<id>, label_<label>, slot_<slot>-label_<label>\n");

-- 
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