Page MenuHomeFreeBSD

D61252.1794674197.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D61252.1794674197.diff

diff --git a/lib/libpam/modules/pam_unix/pam_unix.c b/lib/libpam/modules/pam_unix/pam_unix.c
--- a/lib/libpam/modules/pam_unix/pam_unix.c
+++ b/lib/libpam/modules/pam_unix/pam_unix.c
@@ -92,6 +92,7 @@
int retval;
const char *pass, *user, *realpw, *prompt;
const char *emptypasswd = "";
+ char *encrypted;
if (openpam_get_option(pamh, PAM_OPT_AUTH_AS_SELF)) {
user = getlogin();
@@ -120,9 +121,12 @@
* saved password hash, which is handled above.
*/
if (!(flags & PAM_DISALLOW_NULL_AUTHTOK) &&
- openpam_get_option(pamh, PAM_OPT_EMPTYOK) &&
- strcmp(crypt(emptypasswd, realpw), realpw) == 0)
- return (PAM_SUCCESS);
+ openpam_get_option(pamh, PAM_OPT_EMPTYOK)) {
+ if ((encrypted = crypt(emptypasswd, realpw)) == NULL)
+ return (PAM_SERVICE_ERR);
+ if (strcmp(encrypted, realpw) == 0)
+ return (PAM_SUCCESS);
+ }
lc = login_getpwclass(pwd);
} else {
PAM_LOG("Doing dummy authentication");
@@ -139,7 +143,9 @@
PAM_LOG("Password is too long, using fake password");
realpw = "*";
}
- if (strcmp(crypt(pass, realpw), realpw) == 0)
+ if ((encrypted = crypt(pass, realpw)) == NULL)
+ return (PAM_SERVICE_ERR);
+ if (strcmp(encrypted, realpw) == 0)
return (PAM_SUCCESS);
PAM_VERBOSE_ERROR("UNIX authentication refused");
@@ -355,7 +361,8 @@
}
PAM_LOG("Got old password");
/* always encrypt first */
- encrypted = crypt(old_pass, pwd->pw_passwd);
+ if ((encrypted = crypt(old_pass, pwd->pw_passwd)) == NULL)
+ return (PAM_SERVICE_ERR);
if (old_pass[0] == '\0' &&
!openpam_get_option(pamh, PAM_OPT_NULLOK))
return (PAM_PERM_DENIED);
@@ -405,7 +412,8 @@
login_close(lc);
makesalt(salt);
- pwd->pw_passwd = crypt(new_pass, salt);
+ if ((pwd->pw_passwd = crypt(new_pass, salt)) == NULL)
+ return (PAM_SERVICE_ERR);
#ifdef YP
switch (old_pwd->pw_fields & _PWF_SOURCE) {
case _PWF_FILES:

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 14, 4:36 PM (12 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41537029
Default Alt Text
D61252.1794674197.diff (1 KB)

Event Timeline