Check for null password before using it.

This commit is contained in:
Jim Norman 2005-10-27 16:54:27 +00:00
parent 3622dd745a
commit bb67a93ec8

View File

@ -96,20 +96,23 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc,
memset(&basicCredential,0,sizeof(basicCredential)); memset(&basicCredential,0,sizeof(basicCredential));
basicCredential.unFlags = 0; if (user && wkstnPasswd)
strcpy(basicCredential.username,user); {
basicCredential.unLen = strlen(user) + 1; basicCredential.unFlags = 0;
strcpy(basicCredential.password,wkstnPasswd); strcpy(basicCredential.username,user);
basicCredential.pwordLen = strlen(wkstnPasswd) + 1; basicCredential.unLen = strlen(user) + 1;
strcpy(basicCredential.password,wkstnPasswd);
basicCredential.pwordLen = strlen(wkstnPasswd) + 1;
retVal = (*pNSSCSSetCredential) (0,&secretID,NULL, retVal = (*pNSSCSSetCredential) (0,&secretID,NULL,
SSCS_CRED_TYPE_BASIC_F, SSCS_CRED_TYPE_BASIC_F,
&basicCredential,NULL); &basicCredential,NULL);
if( retVal != 0) if( retVal != 0)
{ {
pam_sscs_log( LOG_ERR,"Setting the default credential failed.Errcode = %d\n",retVal); pam_sscs_log( LOG_ERR,"Setting the default credential failed.Errcode = %d\n",retVal);
break; break;
} }
}
}while(0); }while(0);
seteuid(saved_uid); seteuid(saved_uid);