From 9304bbd0f62df0872ee0286b92ec594efd7df74c Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 13 Aug 2011 13:48:45 -0400 Subject: [PATCH] Set def_preserve_groups before searching for the command when the -P flag is specified. --HG-- branch : 1.7 --- sudo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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); -- 2.50.1