Date: Mon, 2 Oct 2017 23:14:29 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324225 - head/usr.sbin/ppp Message-ID: <201710022314.v92NET7B095753@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Mon Oct 2 23:14:29 2017 New Revision: 324225 URL: https://svnweb.freebsd.org/changeset/base/324225 Log: 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 Modified: head/usr.sbin/ppp/auth.c Modified: head/usr.sbin/ppp/auth.c ============================================================================== --- head/usr.sbin/ppp/auth.c Mon Oct 2 23:12:02 2017 (r324224) +++ head/usr.sbin/ppp/auth.c Mon Oct 2 23:14:29 2017 (r324225) @@ -125,13 +125,19 @@ auth_CheckPasswd(const char *name, const char *data, c #ifdef NOPAM /* Then look up the real password database */ struct passwd *pw; - int result; + int result = 0; char *cryptpw; + + pw = getpwnam(name); - cryptpw = crypt(key, pw->pw_passwd); - result = (pw = getpwnam(name)) && - (cryptpw == NULL || !strcmp(cryptpw, pw->pw_passwd)); + if (pw) { + cryptpw = crypt(key, pw->pw_passwd); + + result = (cryptpw != NULL) && !strcmp(cryptpw, pw->pw_passwd); + } + endpwent(); + return result; #else /* !NOPAM */ /* Then consult with PAM. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710022314.v92NET7B095753>