]> granicus.if.org Git - shadow/commitdiff
Log an error if the password entry could not be
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 17 Nov 2007 16:05:54 +0000 (16:05 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 17 Nov 2007 16:05:54 +0000 (16:05 +0000)
found (respect LOG_UNKFAIL_ENAB to avoid logging a password). This
fixes the Debian bug http://bugs.debian.org/451521

ChangeLog
src/login.c

index de4f9e5e9a6b1b3765d74e70a7e1df850b838f7e..c38fd6da7049b6b497d6eddea9997c06a198411a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-17  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/login.c: Log an error if the password entry could not be
+       found (respect LOG_UNKFAIL_ENAB to avoid logging a password). This
+       fixes the Debian bug http://bugs.debian.org/451521
+
 2007-11-17  Nicolas François  <nicolas.francois@centraliens.net>
 
        * man/useradd.8.xml: -b documenation: Use the same notation for
index 75610d708ea30fc510b3e2da1e3f57c7ca563339..96f25ac526080cb4ae77aa64339ac3794b5d0dbb 100644 (file)
@@ -739,16 +739,22 @@ int main (int argc, char **argv)
                    pam_get_item (pamh, PAM_USER, (const void **) &pam_user);
                setpwent ();
                pwd = getpwnam (pam_user);
+               if (!pwd) {
+                       SYSLOG ((LOG_ERR, "getpwnam(%s) failed",
+                                getdef_bool ("LOG_UNKFAIL_ENAB") ?
+                                pam_user : "UNKNOWN"));
+                       exit (1);
+               }
 
                if (fflg) {
                        retcode = pam_acct_mgmt (pamh, 0);
                        PAM_FAIL_CHECK;
                }
 
-               if (!pwd || setup_groups (pwd))
+               if (setup_groups (pwd)) {
                        exit (1);
-               else
-                       pwent = *pwd;
+
+               pwent = *pwd;
 
                retcode = pam_setcred (pamh, PAM_ESTABLISH_CRED);
                PAM_FAIL_CHECK;