diff options
| author | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
|---|---|---|
| committer | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
| commit | a16f65c7d117419bd266c28a1901ef129a337569 (patch) | |
| tree | 2626602f66dc3551e7a7c7bc9ad763c3bc7ab40a /usr.bin/login | |
| parent | 8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff) | |
Diffstat (limited to 'usr.bin/login')
| -rw-r--r-- | usr.bin/login/login.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 3aa6883e99ef..ad1d4d60ad57 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -230,12 +230,21 @@ main(argc, argv) * is root or the caller isn't changing their uid, don't * authenticate. */ - if (pwd && (*pwd->pw_passwd == '\0' || - fflag && (uid == 0 || uid == pwd->pw_uid))) - break; + if (pwd) { + if (pwd->pw_uid == 0) + rootlogin = 1; + + if (fflag && (uid == 0 || uid == pwd->pw_uid)) { + /* already authenticated */ + break; + } else if (pwd->pw_passwd[0] == '\0') { + /* pretend password okay */ + rval = 0; + goto ttycheck; + } + } + fflag = 0; - if (pwd && pwd->pw_uid == 0) - rootlogin = 1; (void)setpriority(PRIO_PROCESS, 0, -4); @@ -256,6 +265,7 @@ main(argc, argv) (void)setpriority(PRIO_PROCESS, 0, 0); + ttycheck: /* * If trying to log in as root without Kerberos, * but with insecure terminal, refuse the login attempt. @@ -263,7 +273,7 @@ main(argc, argv) #ifdef KERBEROS if (authok == 0) #endif - if (pwd && rootlogin && !rootterm(tty)) { + if (pwd && !rval && rootlogin && !rootterm(tty)) { (void)fprintf(stderr, "%s login refused on this terminal.\n", pwd->pw_name); |
