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/su/su.c | |
| parent | 8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff) | |
Release FreeBSD 1.1upstream/1.1.0_cvsrelease/1.1.0_cvs
This commit was manufactured to restore the state of the 1.1-RELEASE image.
Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs.
Diffstat (limited to 'usr.bin/su/su.c')
| -rw-r--r-- | usr.bin/su/su.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c index e024d818ec3e..76648e65cb1d 100644 --- a/usr.bin/su/su.c +++ b/usr.bin/su/su.c @@ -76,8 +76,9 @@ main(argc, argv) uid_t ruid, getuid(); int asme, ch, asthem, fastlogin, prio; enum { UNSET, YES, NO } iscsh = UNSET; - char *user, *shell, *username, *cleanenv[2], *nargv[4], **np; + char *user, *shell, *username, *cleanenv[20], *nargv[4], **np; char shellbuf[MAXPATHLEN]; + char avshellbuf[MAXPATHLEN]; char *crypt(), *getpass(), *getenv(), *getlogin(), *ontty(); np = &nargv[3]; @@ -215,9 +216,9 @@ main(argc, argv) if (!asme) { if (asthem) { p = getenv("TERM"); - cleanenv[0] = _PATH_DEFPATH; - cleanenv[1] = NULL; + cleanenv[0] = NULL; environ = cleanenv; + (void)setenv("PATH", _PATH_DEFPATH, 1); (void)setenv("TERM", p, 1); if (chdir(pwd->pw_dir) < 0) { fprintf(stderr, "su: no directory\n"); @@ -237,8 +238,27 @@ main(argc, argv) *np-- = "-m"; } - /* csh strips the first character... */ - *np = asthem ? "-su" : iscsh == YES ? "_su" : "su"; + /* Setup argv[0] to show the shell; -shell if login shell */ + if (p = rindex(shell, '/')) { + ++p; + } else { + p = shell; + } + + if (asthem) { + avshellbuf[0] = '-'; + strcpy(avshellbuf+1, p); + } else { + /* csh strips the first character... */ + if (iscsh == YES) { + avshellbuf[0] = '_'; + strcpy(avshellbuf+1, p); + } else { + strcpy(avshellbuf, p); + } + } + + *np = avshellbuf; if (ruid != 0) syslog(LOG_NOTICE|LOG_AUTH, "%s to %s%s", |
