aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_unix/unix_chkpwd.c
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2002-09-23 17:33:22 +0000
committerAndrew G. Morgan <morgan@kernel.org>2002-09-23 17:33:22 +0000
commita8490a0122f3be5e5613a8cd3a57e873c31cc682 (patch)
tree9ace51fd9b77cb378f3f9ac224ffef270fcac6f6 /modules/pam_unix/unix_chkpwd.c
parente9f1b93a7bdf0894f73ba3c250fb8264fd6291f2 (diff)
downloadpam-a8490a0122f3be5e5613a8cd3a57e873c31cc682.tar.gz
pam-a8490a0122f3be5e5613a8cd3a57e873c31cc682.tar.bz2
pam-a8490a0122f3be5e5613a8cd3a57e873c31cc682.zip
Relevant BUGIDs: 521314
Purpose of commit: bugfix Commit summary: --------------- This code is needed to complete this bugfix.
Diffstat (limited to 'modules/pam_unix/unix_chkpwd.c')
-rw-r--r--modules/pam_unix/unix_chkpwd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/pam_unix/unix_chkpwd.c b/modules/pam_unix/unix_chkpwd.c
index 9ba11041..dd07960c 100644
--- a/modules/pam_unix/unix_chkpwd.c
+++ b/modules/pam_unix/unix_chkpwd.c
@@ -94,6 +94,7 @@ static int _unix_verify_password(const char *name, const char *p, int opt)
char *salt = NULL;
char *pp = NULL;
int retval = UNIX_FAILED;
+ int salt_len;
/* UNIX passwords area */
setpwent();
@@ -133,8 +134,10 @@ static int _unix_verify_password(const char *name, const char *p, int opt)
return retval;
}
- if (strlen(salt) == 0)
+ salt_len = strlen(salt);
+ if (salt_len == 0) {
return (opt == 0) ? UNIX_FAILED : UNIX_PASSED;
+ }
/* the moment of truth -- do we agree with the password? */
retval = UNIX_FAILED;
@@ -147,6 +150,8 @@ static int _unix_verify_password(const char *name, const char *p, int opt)
if (strcmp(pp, salt) == 0)
retval = UNIX_PASSED;
}
+ } else if ((*salt == '*') || (salt_len < 13)) {
+ retval = UNIX_FAILED;
} else {
pp = bigcrypt(p, salt);
/*
@@ -158,7 +163,7 @@ static int _unix_verify_password(const char *name, const char *p, int opt)
* stored string with the subset of bigcrypt's result.
* Bug 521314: the strncmp comparison is for legacy support.
*/
- if (strncmp(pp, salt, strlen(salt)) == 0) {
+ if (strncmp(pp, salt, salt_len) == 0) {
retval = UNIX_PASSED;
}
}