summaryrefslogtreecommitdiffstats
path: root/usr.bin/login
diff options
context:
space:
mode:
authordavidn <davidn@FreeBSD.org>1997-03-24 21:22:12 +0000
committerdavidn <davidn@FreeBSD.org>1997-03-24 21:22:12 +0000
commitce02f3ce02d2c07552e0b737f237eaf888725ff0 (patch)
treefce276557aa77ccf4b82965aaff113ccabfe9ffc /usr.bin/login
parent7886fb96dd3f27c082cec13c2510c5a4d47105e7 (diff)
downloadFreeBSD-src-ce02f3ce02d2c07552e0b737f237eaf888725ff0.zip
FreeBSD-src-ce02f3ce02d2c07552e0b737f237eaf888725ff0.tar.gz
strdup() value of term to correctly preserve contents.
Rearrange validation logic so that it works correctly when compiled with kerberos support. Closes PR#3056.
Diffstat (limited to 'usr.bin/login')
-rw-r--r--usr.bin/login/login.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index f771c41..7476431 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -482,19 +482,16 @@ main(argc, argv)
* If trying to log in as root without Kerberos,
* but with insecure terminal, refuse the login attempt.
*/
+ if (pwd && !rval) {
#if defined(KERBEROS) || defined(LOGIN_CAP_AUTH)
- if (authok == 0)
+ if (authok == 0 && rootlogin && !rootok)
+#else
+ if (rootlogin && !rootok)
#endif
- if (pwd && !rval && rootlogin && !rootok) {
- /* use same message as for authentication failure */
- /* (void)fprintf(stderr, "%s login refused on this terminal.\n", pwd->pw_name); */
- refused(NULL, "NOROOT", 0);
- /* preserve backoff behaviour even for failed root */
- /* continue; */
+ refused(NULL, "NOROOT", 0);
+ else /* valid password & authenticated */
+ break;
}
- /* valid password & authenticated */
- else if (pwd && !rval)
- break;
(void)printf("Login incorrect\n");
failures++;
@@ -651,7 +648,8 @@ main(argc, argv)
/*
* Preserve TERM if it happens to be already set.
*/
- term = getenv("TERM");
+ if ((term = getenv("TERM")) != NULL)
+ term = strdup(term);
/*
* Exclude cons/vt/ptys only, assume dialup otherwise
OpenPOWER on IntegriCloud