mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-05 15:48:07 +02:00
xorg-wrapper: when starting the server as root, reset its environment
When the server is privileged, we shouldn't be passing the user's environment directly. Clearing the environment is recommended by the libdbus maintainers, see https://bugs.freedesktop.org/show_bug.cgi?id=52202 v2: rename envp to empty_envp (Jeremy) Reviewed-by: Hans de Goede <hdegoede@redhat.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83849 Signed-off-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
parent
08c4912406
commit
1d4aa67242
1 changed files with 5 additions and 1 deletions
|
|
@ -194,6 +194,7 @@ int main(int argc, char *argv[])
|
|||
int total_cards = 0;
|
||||
int allowed = CONSOLE_ONLY;
|
||||
int needs_root_rights = -1;
|
||||
char *const empty_envp[1] = { NULL, };
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
|
|
@ -271,7 +272,10 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
argv[0] = buf;
|
||||
(void) execv(argv[0], argv);
|
||||
if (getuid() == geteuid())
|
||||
(void) execv(argv[0], argv);
|
||||
else
|
||||
(void) execve(argv[0], argv, empty_envp);
|
||||
fprintf(stderr, "%s: Failed to execute %s: %s\n",
|
||||
progname, buf, strerror(errno));
|
||||
exit(1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue