2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 22:35:10 +00:00

Check for crypt() returning NULL. Traditionally, crypt() never returned

NULL but newer versions of eglibc have a crypt() that does.  Bug #598
This commit is contained in:
Todd C. Miller
2013-04-11 13:10:40 -04:00
parent e9726e5974
commit 6f718ee3cd
2 changed files with 23 additions and 23 deletions

View File

@@ -73,30 +73,28 @@ int
sudo_secureware_verify(struct passwd *pw, char *pass, sudo_auth *auth)
{
char *pw_epasswd = auth->data;
char *epass = NULL;
debug_decl(sudo_secureware_verify, SUDO_DEBUG_AUTH)
#ifdef __alpha
{
extern int crypt_type;
# ifdef HAVE_DISPCRYPT
if (strcmp(pw_epasswd, dispcrypt(pass, pw_epasswd, crypt_type)) == 0)
debug_return_int(AUTH_SUCCESS);
# else
if (crypt_type == AUTH_CRYPT_BIGCRYPT) {
if (strcmp(pw_epasswd, bigcrypt(pass, pw_epasswd)) == 0)
debug_return_int(AUTH_SUCCESS);
} else if (crypt_type == AUTH_CRYPT_CRYPT16) {
if (strcmp(pw_epasswd, crypt(pass, pw_epasswd)) == 0)
debug_return_int(AUTH_SUCCESS);
}
# ifdef HAVE_DISPCRYPT
epass = dispcrypt(pass, pw_epasswd, crypt_type);
# else
if (crypt_type == AUTH_CRYPT_BIGCRYPT)
epass = bigcrypt(pass, pw_epasswd);
else if (crypt_type == AUTH_CRYPT_CRYPT16)
epass = crypt(pass, pw_epasswd);
}
# endif /* HAVE_DISPCRYPT */
# endif /* HAVE_DISPCRYPT */
#elif defined(HAVE_BIGCRYPT)
if (strcmp(pw_epasswd, bigcrypt(pass, pw_epasswd)) == 0)
debug_return_int(AUTH_SUCCESS);
epass = bigcrypt(pass, pw_epasswd);
#endif /* __alpha */
debug_return_int(AUTH_FAILURE);
if (epass != NULL && strcmp(pw_epasswd, epass) == 0)
debug_return_int(AUTH_SUCCESS);
debug_return_int(AUTH_FAILURE);
}
int