pam/pam_unix-crypt.diff

64 lines
2.0 KiB
Diff

Index: modules/pam_unix/support.c
===================================================================
RCS file: /cvsroot/pam/Linux-PAM/modules/pam_unix/support.c,v
retrieving revision 1.40
diff -u -r1.40 support.c
--- modules/pam_unix/support.c 27 Jun 2006 08:38:14 -0000 1.40
+++ modules/pam_unix/support.c 24 Oct 2006 10:14:15 -0000
@@ -689,7 +689,7 @@
D(("user has empty password - access denied"));
retval = PAM_AUTH_ERR;
}
- } else if (!p || (*salt == '*') || (salt_len < 13)) {
+ } else if (!p || (*salt == '*')) {
retval = PAM_AUTH_ERR;
} else {
if (!strncmp(salt, "$1$", 3)) {
@@ -698,6 +698,12 @@
_pam_delete(pp);
pp = Brokencrypt_md5(p, salt);
}
+ } else if (*salt == '$') {
+ /*
+ * Ok, we don't know the crypt algorithm, but maybe
+ * libcrypt nows about it? We should try it.
+ */
+ pp = x_strdup (crypt(p, salt));
} else {
pp = bigcrypt(p, salt);
}
Index: modules/pam_unix/unix_chkpwd.c
===================================================================
RCS file: /cvsroot/pam/Linux-PAM/modules/pam_unix/unix_chkpwd.c,v
retrieving revision 1.17
diff -u -r1.17 unix_chkpwd.c
--- modules/pam_unix/unix_chkpwd.c 14 Jun 2006 15:28:44 -0000 1.17
+++ modules/pam_unix/unix_chkpwd.c 24 Oct 2006 10:14:15 -0000
@@ -40,9 +40,7 @@
#include <security/_pam_macros.h>
#include "md5.h"
-
-extern char *crypt(const char *key, const char *salt);
-extern char *bigcrypt(const char *key, const char *salt);
+#include "bigcrypt.h"
/* syslogging function for errors and other information */
@@ -205,6 +203,15 @@
if (strcmp(pp, salt) == 0)
retval = PAM_SUCCESS;
}
+ } else if (*salt == '$') {
+ /*
+ * Ok, we don't know the crypt algorithm, but maybe
+ * libcrypt nows about it? We should try it.
+ */
+ pp = x_strdup (crypt(p, salt));
+ if (strcmp(pp, salt) == 0) {
+ retval = PAM_SUCCESS;
+ }
} else if ((*salt == '*') || (salt_len < 13)) {
retval = PAM_AUTH_ERR;
} else {