From: Todd C. Miller Date: Sat, 13 Aug 2011 17:48:45 +0000 (-0400) Subject: Set def_preserve_groups before searching for the command when the X-Git-Tag: SUDO_1_7_7~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9304bbd0f62df0872ee0286b92ec594efd7df74c;p=sudo Set def_preserve_groups before searching for the command when the -P flag is specified. --HG-- branch : 1.7 --- diff --git a/sudo.c b/sudo.c index 924f21298..25b7aa504 100644 --- a/sudo.c +++ b/sudo.c @@ -338,6 +338,10 @@ main(argc, argv, envp) def_closefrom = user_closefrom; } + /* If given the -P option, set the "preserve_groups" flag. */ + if (ISSET(sudo_mode, MODE_PRESERVE_GROUPS)) + def_preserve_groups = TRUE; + cmnd_status = set_cmnd(sudo_mode); #ifdef HAVE_SETLOCALE @@ -391,10 +395,6 @@ main(argc, argv, envp) pw_delref(pw); } - /* If given the -P option, set the "preserve_groups" flag. */ - if (ISSET(sudo_mode, MODE_PRESERVE_GROUPS)) - def_preserve_groups = TRUE; - /* If no command line args and "set_home" is not set, error out. */ if (ISSET(sudo_mode, MODE_IMPLIED_SHELL) && !def_shell_noargs) usage(1);