From 1381e63d6caac1d5d064b60f6e2cb11bf0608e14 Mon Sep 17 00:00:00 2001 From: kevlo Date: Wed, 22 Feb 2012 06:27:20 +0000 Subject: Handle NULL return from crypt(3). Mostly from DragonFly --- usr.sbin/ppp/auth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'usr.sbin/ppp') diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 66a3de7..fbfc929 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -126,9 +126,11 @@ auth_CheckPasswd(const char *name, const char *data, const char *key) /* Then look up the real password database */ struct passwd *pw; int result; + char *cryptpw; + cryptpw = crypt(key, pw->pw_passwd); result = (pw = getpwnam(name)) && - !strcmp(crypt(key, pw->pw_passwd), pw->pw_passwd); + (cryptpw == NULL || !strcmp(cryptpw, pw->pw_passwd)); endpwent(); return result; #else /* !NOPAM */ -- cgit v1.1