udhcpc: fix a problem with binary-encoded options #2
[oweals/busybox.git] / loginutils / login.c
index b54beef6eab906f76b92804abc3f68b2902517a3..6ec8dc42e17c63067858d89ef631e75c8af024bb 100644 (file)
@@ -37,7 +37,8 @@ static const struct pam_conv conv = {
 enum {
        TIMEOUT = 60,
        EMPTY_USERNAME_COUNT = 10,
-       USERNAME_SIZE = 32,
+       /* Some users found 32 chars limit to be too low: */
+       USERNAME_SIZE = 64,
        TTYNAME_SIZE = 32,
 };
 
@@ -342,14 +343,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);
@@ -443,7 +446,6 @@ int login_main(int argc UNUSED_PARAM, char **argv)
        if (pw->pw_uid != 0)
                die_if_nologin();
 
-
 #if ENABLE_LOGIN_SESSION_AS_CHILD
        child_pid = vfork();
        if (child_pid != 0) {