From bd6eb33b2a7d2d13749e3da71a427e019140573e Mon Sep 17 00:00:00 2001 From: Valerie Peng Date: Fri, 25 Apr 2008 15:19:55 -0700 Subject: [PATCH] 6524501: inconsistency with PKCS#11 spec - 0-value flags in CK_SLOT_INFO struct returned by C_GetSlotInfo() Reviewed-by: mullan --- jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java index 88d8d4b7393..b6eb1c258f4 100644 --- a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java +++ b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java @@ -720,9 +720,13 @@ public final class SunPKCS11 extends AuthProvider { } private boolean hasValidToken() { + /* Commented out to work with Solaris softtoken impl which + returns 0-value flags, e.g. both REMOVABLE_DEVICE and + TOKEN_PRESENT are false, when it can't access the token. if (removable == false) { return true; } + */ Token token = this.token; return (token != null) && token.isValid(); } @@ -752,7 +756,7 @@ public final class SunPKCS11 extends AuthProvider { if (slotInfo == null) { slotInfo = p11.C_GetSlotInfo(slotID); } - if ((slotInfo.flags & CKF_TOKEN_PRESENT) == 0) { + if (removable && (slotInfo.flags & CKF_TOKEN_PRESENT) == 0) { createPoller(); return; }