From bb67a93ec80891211b4ce1e5aab211eeba090255 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Thu, 27 Oct 2005 16:54:27 +0000 Subject: [PATCH] Check for null password before using it. --- login_capture/PAM/pam_sscs.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/login_capture/PAM/pam_sscs.c b/login_capture/PAM/pam_sscs.c index 38da51db..746c3b58 100644 --- a/login_capture/PAM/pam_sscs.c +++ b/login_capture/PAM/pam_sscs.c @@ -96,20 +96,23 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc, memset(&basicCredential,0,sizeof(basicCredential)); - basicCredential.unFlags = 0; - strcpy(basicCredential.username,user); - basicCredential.unLen = strlen(user) + 1; - strcpy(basicCredential.password,wkstnPasswd); - basicCredential.pwordLen = strlen(wkstnPasswd) + 1; + if (user && wkstnPasswd) + { + basicCredential.unFlags = 0; + strcpy(basicCredential.username,user); + basicCredential.unLen = strlen(user) + 1; + strcpy(basicCredential.password,wkstnPasswd); + basicCredential.pwordLen = strlen(wkstnPasswd) + 1; - retVal = (*pNSSCSSetCredential) (0,&secretID,NULL, - SSCS_CRED_TYPE_BASIC_F, - &basicCredential,NULL); - if( retVal != 0) - { - pam_sscs_log( LOG_ERR,"Setting the default credential failed.Errcode = %d\n",retVal); - break; - } + retVal = (*pNSSCSSetCredential) (0,&secretID,NULL, + SSCS_CRED_TYPE_BASIC_F, + &basicCredential,NULL); + if( retVal != 0) + { + pam_sscs_log( LOG_ERR,"Setting the default credential failed.Errcode = %d\n",retVal); + break; + } + } }while(0); seteuid(saved_uid);