From: Todd C. Miller Date: Tue, 16 Mar 2010 00:24:55 +0000 (-0400) Subject: Wire up invalidate and validate methods for sudoers X-Git-Tag: SUDO_1_8_0~806 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee223889c1033e1fafe699e24c7debe24d534e71;p=sudo Wire up invalidate and validate methods for sudoers --- diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index 33c2e3c67..bcda02791 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -609,6 +609,23 @@ sudoers_policy_check(int argc, char * const argv[], char *env_add[], argv_out, user_env_out); } +static int +sudoers_policy_validate(void) +{ + user_cmnd = "validate"; + SET(sudo_mode, MODE_VALIDATE); + + return sudoers_policy_main(0, NULL, NULL, NULL, NULL, NULL); +} + +static void +sudoers_policy_invalidate(int remove) +{ + user_cmnd = "kill"; + remove_timestamp(remove); + cleanup(0); +} + static int sudoers_policy_list(int argc, char * const argv[], int verbose, const char *list_user) @@ -1324,10 +1341,8 @@ struct policy_plugin sudoers_policy = { sudoers_policy_version, sudoers_policy_check, sudoers_policy_list, -#ifdef notyet sudoers_policy_validate, sudoers_policy_invalidate -#endif }; #ifdef notyet diff --git a/src/sudo.c b/src/sudo.c index 8529499cf..0951cdde9 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -201,7 +201,7 @@ main(int argc, char *argv[], char *envp[]) exit(ok != TRUE); case MODE_KILL: case MODE_INVALIDATE: - if (policy_plugin.u.policy->validate == NULL) { + if (policy_plugin.u.policy->invalidate == NULL) { warningx("policy plugin %s does not support the -k/-K flags", policy_plugin.name); exit(1);