From ee223889c1033e1fafe699e24c7debe24d534e71 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 15 Mar 2010 20:24:55 -0400 Subject: [PATCH] Wire up invalidate and validate methods for sudoers --- plugins/sudoers/sudoers.c | 19 +++++++++++++++++-- src/sudo.c | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) 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); -- 2.50.1