Bugzilla Bug 298516: fixed problems found by code inspection. r=relyea.

Modified Files: pk11db.c pkcs11.c
This commit is contained in:
wtchang%redhat.com 2005-07-22 00:47:18 +00:00
parent 2769f32da7
commit ee93d82c69
2 changed files with 5 additions and 9 deletions

View File

@ -167,8 +167,8 @@ secmod_parseParameters(char *param, sftk_parameters *parsed, PRBool isFIPS)
SECMOD_HANDLE_STRING_ARG(index,slotdes,"cryptoSlotDescription=",;)
SECMOD_HANDLE_STRING_ARG(index,pslotdes,"dbSlotDescription=",;)
SECMOD_HANDLE_STRING_ARG(index,fslotdes,"FIPSSlotDescription=",;)
SECMOD_HANDLE_STRING_ARG(index,minPW,"FIPSTokenDescription=",;)
SECMOD_HANDLE_STRING_ARG(index,tmp,"minPWLen=",;)
SECMOD_HANDLE_STRING_ARG(index,fpslotdes,"FIPSTokenDescription=",;)
SECMOD_HANDLE_STRING_ARG(index,minPW,"minPWLen=",;)
SECMOD_HANDLE_STRING_ARG(index,tmp,"flags=",
if(tmp) { secmod_parseFlags(param,parsed); PORT_Free(tmp); })

View File

@ -2558,11 +2558,10 @@ SFTK_SlotInit(char *configdir,sftk_token_parameters *params, int moduleIndex)
/* if the data base is initialized with a null password,remember that */
slot->needLogin =
(PRBool)!sftk_hasNullPassword(slot->keyDB,&slot->password);
if (params->minPW <= SFTK_MAX_PIN) {
if ((params->minPW >= 0) && (params->minPW <= SFTK_MAX_PIN)) {
slot->minimumPinLen = params->minPW;
}
if ((slot->minimumPinLen == 0) && (params->pwRequired) &&
(slot->minimumPinLen <= SFTK_MAX_PIN)) {
if ((slot->minimumPinLen == 0) && (params->pwRequired)) {
slot->minimumPinLen = 1;
}
}
@ -3049,10 +3048,7 @@ CK_RV NSC_GetTokenInfo(CK_SLOT_ID slotID,CK_TOKEN_INFO_PTR pInfo)
CKF_LOGIN_REQUIRED | CKF_USER_PIN_INITIALIZED;
}
pInfo->ulMaxPinLen = SFTK_MAX_PIN;
pInfo->ulMinPinLen = 0;
if (slot->minimumPinLen > 0) {
pInfo->ulMinPinLen = (CK_ULONG)slot->minimumPinLen;
}
pInfo->ulMinPinLen = (CK_ULONG)slot->minimumPinLen;
pInfo->ulTotalPublicMemory = 1;
pInfo->ulFreePublicMemory = 1;
pInfo->ulTotalPrivateMemory = 1;