summaryrefslogtreecommitdiff
path: root/modules/pam_unix
diff options
context:
space:
mode:
authorTomas Mraz <tm@t8m.info>2006-12-18 20:09:33 +0000
committerTomas Mraz <tm@t8m.info>2006-12-18 20:09:33 +0000
commit40b7dda604037555600efb122ea4bc1117b6f7af (patch)
tree87b1723a5fc6cd75477816403c2a47dc69a7d3fe /modules/pam_unix
parent102d5d74caafb934682252b29115215c8f45454b (diff)
Relevant BUGIDs:
Purpose of commit: bugfix Commit summary: --------------- Truncated passwords in shadow do not make sense for other variants than bigcrypt. 2006-12-18 Tomas Mraz <t8m@centrum.cz> * modules/pam_unix/support.c (_unix_verify_password): Use strncmp only for bigcrypt result.
Diffstat (limited to 'modules/pam_unix')
-rw-r--r--modules/pam_unix/support.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/pam_unix/support.c b/modules/pam_unix/support.c
index e2a30646..86b3a731 100644
--- a/modules/pam_unix/support.c
+++ b/modules/pam_unix/support.c
@@ -693,6 +693,7 @@ int _unix_verify_password(pam_handle_t * pamh, const char *name
retval = PAM_AUTH_ERR;
} else {
if (!strncmp(salt, "$1$", 3)) {
+ salt_len = 0;
pp = Goodcrypt_md5(p, salt);
if (strcmp(pp, salt) != 0) {
_pam_delete(pp);
@@ -703,6 +704,7 @@ int _unix_verify_password(pam_handle_t * pamh, const char *name
* Ok, we don't know the crypt algorithm, but maybe
* libcrypt nows about it? We should try it.
*/
+ salt_len = 0;
pp = x_strdup (crypt(p, salt));
} else {
pp = bigcrypt(p, salt);
@@ -721,7 +723,8 @@ int _unix_verify_password(pam_handle_t * pamh, const char *name
* stored string with the subset of bigcrypt's result.
* Bug 521314: The strncmp comparison is for legacy support.
*/
- if (strncmp(pp, salt, salt_len) == 0) {
+ if ((!salt_len && strcmp(pp, salt) == 0) ||
+ (salt_len && strncmp(pp, salt, salt_len) == 0)) {
retval = PAM_SUCCESS;
} else {
retval = PAM_AUTH_ERR;