[pkg-opensc-commit] [pkcs11-helper] 57/60: Cleanups

Eric Dorland eric at moszumanska.debian.org
Fri Jan 6 23:39:47 UTC 2017


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

eric pushed a commit to tag pkcs11-helper-1.02
in repository pkcs11-helper.

commit 67ebf390b43178d3b23d68e87aef0f9869695180
Author: alonbl <alonbl at 485eb718-1723-0410-b8a9-88cf21a28c35>
Date:   Mon Dec 25 23:05:20 2006 +0000

    Cleanups
---
 lib/pkcs11h-serialization.c |  7 +++++++
 lib/pkcs11h-session.c       | 23 ++++++++++++++---------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/lib/pkcs11h-serialization.c b/lib/pkcs11h-serialization.c
index 1490ab3..50e4078 100644
--- a/lib/pkcs11h-serialization.c
+++ b/lib/pkcs11h-serialization.c
@@ -273,6 +273,13 @@ cleanup:
 		pkcs11h_token_freeTokenId (token_id);
 	}
 
+	_PKCS11H_DEBUG (
+		PKCS11H_LOG_DEBUG2,
+		"PKCS#11: pkcs11h_token_deserializeTokenId return rv=%lu-'%s'",
+		rv,
+		pkcs11h_getMessage (rv)
+	);
+
 	return rv;
 #undef __PKCS11H_TARGETS_NUMBER
 }
diff --git a/lib/pkcs11h-session.c b/lib/pkcs11h-session.c
index cb5c934..4327c14 100644
--- a/lib/pkcs11h-session.c
+++ b/lib/pkcs11h-session.c
@@ -995,7 +995,7 @@ _pkcs11h_session_login (
 				);
 
 				if (
-					!_g_pkcs11h_data->hooks.pin_prompt (
+					_g_pkcs11h_data->hooks.pin_prompt (
 						_g_pkcs11h_data->hooks.pin_prompt_data,
 						user_data,
 						session->token_id,
@@ -1004,12 +1004,10 @@ _pkcs11h_session_login (
 						sizeof (pin)
 					)
 				) {
-					rv = CKR_CANCEL;
-					goto retry;
+					rv = CKR_OK;
 				}
 				else {
-					utfPIN = (CK_UTF8CHAR_PTR)pin;
-					lPINLength = strlen (pin);
+					rv = CKR_CANCEL;
 				}
 
 				_PKCS11H_DEBUG (
@@ -1017,6 +1015,14 @@ _pkcs11h_session_login (
 					"PKCS#11: pin_prompt hook return rv=%ld",
 					rv
 				);
+
+				if (rv != CKR_OK ){
+					goto retry;
+				}
+
+				utfPIN = (CK_UTF8CHAR_PTR)pin;
+				lPINLength = strlen (pin);
+
 			}
 
 			if ((rv = __pkcs11h_session_touch (session)) != CKR_OK) {
@@ -1029,11 +1035,10 @@ _pkcs11h_session_login (
 					CKU_USER,
 					utfPIN,
 					lPINLength
-				)) != CKR_OK
+				)) != CKR_OK &&
+				rv != CKR_USER_ALREADY_LOGGED_IN
 			) {
-				if (rv != CKR_USER_ALREADY_LOGGED_IN) {
-					goto retry;
-				}
+				goto retry;
 			}
 
 			login_succeeded = TRUE;

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



More information about the pkg-opensc-commit mailing list