summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2017-11-14 10:48:30 +0000
committerdes <des@FreeBSD.org>2017-11-14 10:48:30 +0000
commitb242fe393914310e50673eb62d480ce03706d745 (patch)
tree7cd75192bab160dda3a67982bf13e510d9f7e17f /lib
parente683b49c3e3b94e2c0f2704881e1fb1acd1c090b (diff)
downloadFreeBSD-src-b242fe393914310e50673eb62d480ce03706d745.zip
FreeBSD-src-b242fe393914310e50673eb62d480ce03706d745.tar.gz
MFH (r325010): don't bother verifying a password that we know is too long.
Reported by: jkim@ Security: CVE-2016-6210
Diffstat (limited to 'lib')
-rw-r--r--lib/libpam/modules/pam_unix/pam_unix.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libpam/modules/pam_unix/pam_unix.c b/lib/libpam/modules/pam_unix/pam_unix.c
index 5403d5d..2fd3b61 100644
--- a/lib/libpam/modules/pam_unix/pam_unix.c
+++ b/lib/libpam/modules/pam_unix/pam_unix.c
@@ -111,6 +111,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
if (!(flags & PAM_DISALLOW_NULL_AUTHTOK) &&
openpam_get_option(pamh, PAM_OPT_NULLOK))
return (PAM_SUCCESS);
+ PAM_LOG("Password is empty, using fake password");
realpw = "*";
}
lc = login_getpwclass(pwd);
@@ -125,6 +126,10 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
if (retval != PAM_SUCCESS)
return (retval);
PAM_LOG("Got password");
+ if (strnlen(pass, _PASSWORD_LEN + 1) > _PASSWORD_LEN) {
+ PAM_LOG("Password is too long, using fake password");
+ realpw = "*";
+ }
if (strcmp(crypt(pass, realpw), realpw) == 0)
return (PAM_SUCCESS);
OpenPOWER on IntegriCloud