diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index 9b90cb90d..e53ab82f2 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -398,16 +398,16 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], debug_return_int(-1); } - /* Was previous command was intercepted? */ - if (ISSET(sudo_mode, MODE_RUN) && def_intercept) - SET(sudo_mode, MODE_POLICY_INTERCEPTED); - - /* Only certain mode flags are legal for intercepted commands. */ - if (ISSET(sudo_mode, MODE_POLICY_INTERCEPTED)) - sudo_mode &= MODE_INTERCEPT_MASK; - - /* Re-initialize defaults if we are called multiple times. */ if (need_reinit) { + /* Was previous command intercepted? */ + if (ISSET(sudo_mode, MODE_RUN) && def_intercept) + SET(sudo_mode, MODE_POLICY_INTERCEPTED); + + /* Only certain mode flags are legal for intercepted commands. */ + if (ISSET(sudo_mode, MODE_POLICY_INTERCEPTED)) + sudo_mode &= MODE_INTERCEPT_MASK; + + /* Re-initialize defaults if we are called multiple times. */ if (!sudoers_reinit_defaults()) debug_return_int(-1); }