hi all,
there's an OpenVPN bug report that is traced back to an issue with
pkcs11h_logout; it seems that if you call this function before
initializing the pkcs11 libs then it segfaults. I've added a line
pkcs11h_logout()
to the tests/test-basic/test-basic.c file from the pkcs11-helper 1.07
tree and can reproduce this behaviour. The offending pieceof code is
1058 CK_RV
1059 pkcs11h_logout (void) {
1060 _pkcs11h_session_t current_session = NULL;
1061 CK_RV rv = CKR_OK;
1062
1063 _PKCS11H_DEBUG (
1064 PKCS11H_LOG_DEBUG2,
1065 "PKCS#11: pkcs11h_logout entry"
1066 );
1067
1068 for (
1069 current_session = _g_pkcs11h_data->sessions;
1070 current_session != NULL;
1071 current_session = current_session->next
1072 ) {
1073 CK_RV _rv;
A simple pointer check solves the issue:
--- pkcs11-helper-1.07/lib/pkcs11h-core.c 2009-02-27
04:04:36.000000000 +0100
+++ pkcs11-helper-1.07jjk/lib/pkcs11h-core.c 2011-02-23
11:39:14.000000000 +0100
@@ -1065,6 +1065,10 @@
"PKCS#11: pkcs11h_logout entry"
);
+ if (_g_pkcs11h_data == NULL) {
+ return rv;
+ }
+
for (
current_session = _g_pkcs11h_data->sessions;
current_session != NULL;
I hope someone can incorporate this patch into the pkcs11-helper sources.
thx,
JJK / Jan Just Keijser
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel