login: -f should not ask for password even with PAM
authorSergey Naumov <sknaumov@gmail.com>
Mon, 30 Jan 2012 11:52:56 +0000 (12:52 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 30 Jan 2012 11:52:56 +0000 (12:52 +0100)
Signed-off-by: Sergey Naumov <sknaumov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
loginutils/login.c

index 73db8fa63177d94fe0c0ad6ef6db9c4761c32e9a..bf43f3aba72c9e905a630d9d8d0bf6274f340ed5 100644 (file)
@@ -342,14 +342,16 @@ int login_main(int argc UNUSED_PARAM, char **argv)
                                goto pam_auth_failed;
                        }
                }
-               pamret = pam_authenticate(pamh, 0);
-               if (pamret != PAM_SUCCESS) {
-                       failed_msg = "authenticate";
-                       goto pam_auth_failed;
-                       /* TODO: or just "goto auth_failed"
-                        * since user seems to enter wrong password
-                        * (in this case pamret == 7)
-                        */
+               if (!(opt & LOGIN_OPT_f)) {
+                       pamret = pam_authenticate(pamh, 0);
+                       if (pamret != PAM_SUCCESS) {
+                               failed_msg = "authenticate";
+                               goto pam_auth_failed;
+                               /* TODO: or just "goto auth_failed"
+                                * since user seems to enter wrong password
+                                * (in this case pamret == 7)
+                                */
+                       }
                }
                /* check that the account is healthy */
                pamret = pam_acct_mgmt(pamh, 0);