SCCS-vsn: usr.bin/login/login.c 5.57
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)login.c 5.56 (Berkeley) %G%";
+static char sccsid[] = "@(#)login.c 5.57 (Berkeley) %G%";
failures = 0;
}
(void)strcpy(tbuf, username);
failures = 0;
}
(void)strcpy(tbuf, username);
if (pwd = getpwnam(username))
salt = pwd->pw_passwd;
if (pwd = getpwnam(username))
salt = pwd->pw_passwd;
- else {
- /* take up the right amount of time */
- (void)crypt(getpass("Password:"), "xx");
- goto faked;
- }
/* if user not super-user, check for disabled logins */
/* if user not super-user, check for disabled logins */
+ if (!pwd || pwd->pw_uid)
checknologin();
/*
* Disallow automatic login to root; if not invoked by
* root, disallow if the uid's differ.
*/
checknologin();
/*
* Disallow automatic login to root; if not invoked by
* root, disallow if the uid's differ.
*/
passwd_req =
#ifndef KERBEROS
pwd->pw_uid == 0 ||
passwd_req =
#ifndef KERBEROS
pwd->pw_uid == 0 ||
* If no pre-authentication and a password exists
* for this user, prompt for one and verify it.
*/
* If no pre-authentication and a password exists
* for this user, prompt for one and verify it.
*/
- if (!passwd_req || !*pwd->pw_passwd)
+ if (pwd && (!passwd_req || !*pwd->pw_passwd))
break;
/*
* If trying to log in as root, but with insecure terminal,
* refuse the login attempt.
*/
break;
/*
* If trying to log in as root, but with insecure terminal,
* refuse the login attempt.
*/
- if (pwd->pw_uid == 0 && !rootterm(tty)) {
+ if (pwd && pwd->pw_uid == 0 && !rootterm(tty)) {
(void)fprintf(stderr,
"%s login refused on this terminal.\n",
pwd->pw_name);
(void)fprintf(stderr,
"%s login refused on this terminal.\n",
pwd->pw_name);
}
(void)setpriority(PRIO_PROCESS, 0, -4);
}
(void)setpriority(PRIO_PROCESS, 0, -4);
p = getpass("Password:");
p = getpass("Password:");
+
+ (void)setpriority(PRIO_PROCESS, 0, 0);
+
+ if (pwd && !rval)
-faked: (void)printf("Login incorrect\n");
+ (void)printf("Login incorrect\n");
failures++;
/* we allow 10 tries, but after 3 we start backing off */
if (++cnt > 3) {
failures++;
/* we allow 10 tries, but after 3 we start backing off */
if (++cnt > 3) {
/* committed to login -- turn off timeout */
(void)alarm((u_int)0);
/* committed to login -- turn off timeout */
(void)alarm((u_int)0);
- /* reset priority */
- (void)setpriority(PRIO_PROCESS, 0, 0);
-
/* paranoia... */
endpwent();
/* paranoia... */
endpwent();