sesman: check for null from crypt()

This commit is contained in:
Jay Sorg 2014-10-29 17:54:11 -07:00
parent 9cb9a4bb57
commit 851c762ee7

View File

@ -51,6 +51,7 @@ long DEFAULT_CC
auth_userpass(char *user, char *pass, int *errorcode)
{
const char *encr;
const char *epass;
struct passwd *spw;
struct spwd *stp;
@ -84,8 +85,12 @@ auth_userpass(char *user, char *pass, int *errorcode)
/* old system with only passwd */
encr = spw->pw_passwd;
}
return (strcmp(encr, crypt(pass, encr)) == 0);
epass = crypt(pass, encr);
if (epass == 0)
{
return 0;
}
return (strcmp(encr, epass) == 0);
}
/******************************************************************************/