ppp(8): Fix various bugs in NOPAM section of auth_CheckPasswd
* pw is not initialized before use * success is returned if crypt(3) errors These bugs were introduced in r231994, which attempted to adopt DragonflyBSD f4a9869feb646aafe72de6e5d61051a023a02676. The original author of the Dragonfly change also noticed these mistakes and filed the PR. PR: 222620 Submitted by: Lubos Boucek <bouceklubos AT gmail.com> Obtained from: DragonflyBSD f4a9869feb646aafe72de6e5d61051a023a02676
This commit is contained in:
parent
eb3d4ccc48
commit
af3b49ef41
@ -125,13 +125,19 @@ auth_CheckPasswd(const char *name, const char *data, const char *key)
|
||||
#ifdef NOPAM
|
||||
/* Then look up the real password database */
|
||||
struct passwd *pw;
|
||||
int result;
|
||||
int result = 0;
|
||||
char *cryptpw;
|
||||
|
||||
pw = getpwnam(name);
|
||||
|
||||
if (pw) {
|
||||
cryptpw = crypt(key, pw->pw_passwd);
|
||||
|
||||
result = (cryptpw != NULL) && !strcmp(cryptpw, pw->pw_passwd);
|
||||
}
|
||||
|
||||
cryptpw = crypt(key, pw->pw_passwd);
|
||||
result = (pw = getpwnam(name)) &&
|
||||
(cryptpw == NULL || !strcmp(cryptpw, pw->pw_passwd));
|
||||
endpwent();
|
||||
|
||||
return result;
|
||||
#else /* !NOPAM */
|
||||
/* Then consult with PAM. */
|
||||
|
Loading…
Reference in New Issue
Block a user