6524501: inconsistency with PKCS#11 spec - 0-value flags in CK_SLOT_INFO struct returned by C_GetSlotInfo()
authorvaleriep
Fri, 25 Apr 2008 15:19:55 -0700
changeset 487 df198b4170f7
parent 484 e13b7add5742
child 488 5e84e13e8892
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
--- a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java	Wed Apr 23 10:20:34 2008 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java	Fri Apr 25 15:19:55 2008 -0700
@@ -720,9 +720,13 @@
     }
 
     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 @@
         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;
         }