You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

diff -up sudo-1.8.6p7/plugins/sudoers/sudoers.c.closefrom-override-fix sudo-1.8.6p7/plugins/sudoers/sudoers.c
--- sudo-1.8.6p7/plugins/sudoers/sudoers.c.closefrom-override-fix 2016-02-15 10:31:11.694164366 +0100
+++ sudo-1.8.6p7/plugins/sudoers/sudoers.c 2016-02-15 10:33:47.711362062 +0100
@@ -336,15 +336,6 @@ sudoers_policy_main(int argc, char * con
goto bad;
}
- /* Check for -C overriding def_closefrom. */
- if (user_closefrom >= 0 && user_closefrom != def_closefrom) {
- if (!def_closefrom_override) {
- warningx(_("you are not permitted to use the -C option"));
- goto bad;
- }
- def_closefrom = user_closefrom;
- }
-
set_perms(PERM_INITIAL);
/* Environment variables specified on the command line. */
@@ -374,8 +365,17 @@ sudoers_policy_main(int argc, char * con
if (ISSET(sudo_mode, MODE_PRESERVE_GROUPS))
def_preserve_groups = true;
- /* Find command in path */
+ /* Find command in path and apply per-command Defaults. */
cmnd_status = set_cmnd();
+
+ /* Check for -C overriding def_closefrom. */
+ if (user_closefrom >= 0 && user_closefrom != def_closefrom) {
+ if (!def_closefrom_override) {
+ warningx(_("you are not permitted to use the -C option"));
+ goto bad;
+ }
+ def_closefrom = user_closefrom;
+ }
#ifdef HAVE_SETLOCALE
if (!setlocale(LC_ALL, def_sudoers_locale)) {