Commit 43146158 authored by gfleury's avatar gfleury

Fix environment vars after setuid

parent d74db187
...@@ -566,7 +566,11 @@ int change_user_group () { ...@@ -566,7 +566,11 @@ int change_user_group () {
if (setuid (pw->pw_uid) < 0) { if (setuid (pw->pw_uid) < 0) {
fprintf (stderr, "change_user_group: failed to assume identity of user %s\n", username); fprintf (stderr, "change_user_group: failed to assume identity of user %s\n", username);
return -1; return -1;
} } else {
pw = getpwuid(getuid());
setenv("USER", pw->pw_name, 1);
setenv("HOME", pw->pw_dir, 1);
setenv("SHELL", pw->pw_shell, 1);
} }
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment