Fixed the PATH and cleanenv setting in su. This was totally broken in the
4.4BSD Lite source.
This commit is contained in:
parent
886f34fde6
commit
0b293ea528
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4563
@ -82,7 +82,7 @@ main(argc, argv)
|
||||
{
|
||||
extern char **environ;
|
||||
struct passwd *pwd;
|
||||
char *p, **g, *user, *shell, *username, *cleanenv[2], *nargv[4], **np;
|
||||
char *p, **g, *user, *shell, *username, *cleanenv[20], *nargv[4], **np;
|
||||
struct group *gr;
|
||||
uid_t ruid;
|
||||
int asme, ch, asthem, fastlogin, prio;
|
||||
@ -219,9 +219,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)
|
||||
errx(1, "no directory");
|
||||
|
Loading…
Reference in New Issue
Block a user