diff options
author | ache <ache@FreeBSD.org> | 1997-02-27 03:52:22 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-02-27 03:52:22 +0000 |
commit | 0b7ae13ecccc7481a95e4679adc6944942142b43 (patch) | |
tree | 86c1f26864326416a2692ff6ddcafef3d48d6c6a /usr.bin | |
parent | b3686e776a1bad7f229c4d07aa3828c83af2fc11 (diff) | |
download | FreeBSD-src-0b7ae13ecccc7481a95e4679adc6944942142b43.zip FreeBSD-src-0b7ae13ecccc7481a95e4679adc6944942142b43.tar.gz |
Fix few bogons with pw_shell / shell variables values mismatch
introduced by LOGIN_CAP
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/login/login.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index affb3c5..c6ff4db 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -582,6 +582,8 @@ main(argc, argv) strncpy(shell, pwd->pw_shell, sizeof shell); #endif /* LOGIN_CAP */ shell[sizeof shell - 1] = '\0'; + if (*shell == '\0') + strcpy(shell, _PATH_BSHELL); #ifdef LOGIN_ACCESS if (login_access(pwd->pw_name, hostname ? full_hostname : tty) == 0) { @@ -659,12 +661,7 @@ main(argc, argv) (void)setuid(rootlogin ? 0 : pwd->pw_uid); #endif - if (*pwd->pw_shell == '\0') { - pwd->pw_shell = _PATH_BSHELL; - if (*shell == '\0') /* Not overridden */ - strcpy(shell, pwd->pw_shell); - } - (void)setenv("SHELL", pwd->pw_shell, 1); + (void)setenv("SHELL", shell, 1); (void)setenv("HOME", pwd->pw_dir, 1); if (term[0] != '\0') (void)setenv("TERM", term, 1); /* Preset overrides */ @@ -716,7 +713,7 @@ main(argc, argv) /* Login shells have a leading '-' in front of argv[0] */ tbuf[0] = '-'; - (void)strcpy(tbuf + 1, (p = strrchr(pwd->pw_shell, '/')) ? p + 1 : pwd->pw_shell); + (void)strcpy(tbuf + 1, (p = strrchr(shell, '/')) ? p + 1 : shell); #ifdef LOGIN_CAP login_close(lc); |