From d16b3f456d1100f4058d9a73ee59397f964b8760 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Mon, 23 Apr 2012 16:37:08 +0200 Subject: sudo ldap provider: add support for on demand refresh of specific rules --- src/providers/data_provider.h | 1 + src/providers/dp_backend.h | 2 ++ src/providers/ldap/sdap_sudo.c | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/src/providers/data_provider.h b/src/providers/data_provider.h index 93840b8c..8c46115b 100644 --- a/src/providers/data_provider.h +++ b/src/providers/data_provider.h @@ -142,6 +142,7 @@ #define BE_REQ_SUDO_DEFAULTS 0x0007 #define BE_REQ_SUDO_USER 0x0008 #define BE_REQ_SUDO_FULL 0x0100 /* todo: change it after clean up */ +#define BE_REQ_SUDO_RULES 0x0200 /* todo: change it after clean up */ #define BE_REQ_AUTOFS 0x0009 #define BE_REQ_HOST 0x0010 #define BE_REQ_FAST 0x1000 diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h index c6bf2d0c..2c56f147 100644 --- a/src/providers/dp_backend.h +++ b/src/providers/dp_backend.h @@ -158,6 +158,8 @@ struct be_acct_req { struct be_sudo_req { uint32_t type; + char **rules; + char *username; uid_t uid; char **groups; diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c index 227d57c0..ba96f2cb 100644 --- a/src/providers/ldap/sdap_sudo.c +++ b/src/providers/ldap/sdap_sudo.c @@ -171,6 +171,9 @@ static void sdap_sudo_reply(struct tevent_req *req) case BE_REQ_SUDO_FULL: ret = sdap_sudo_full_refresh_recv(req, &dp_error, &error); break; + case BE_REQ_SUDO_RULES: + ret = sdap_sudo_rules_refresh_recv(req, &dp_error, &error); + break; default: DEBUG(SSSDBG_CRIT_FAILURE, ("Invalid request type: %d\n", sudo_req->type)); @@ -203,6 +206,11 @@ void sdap_sudo_handler(struct be_req *be_req) DEBUG(SSSDBG_TRACE_FUNC, ("Issuing a full refresh of sudo rules\n")); req = sdap_sudo_full_refresh_send(be_req, id_ctx); break; + case BE_REQ_SUDO_RULES: + DEBUG(SSSDBG_TRACE_FUNC, ("Issuing a refresh of specific sudo rules\n")); + req = sdap_sudo_rules_refresh_send(be_req, id_ctx->be, id_ctx->opts, + id_ctx->conn_cache, sudo_req->rules); + break; default: DEBUG(SSSDBG_CRIT_FAILURE, ("Invalid request type: %d\n", sudo_req->type)); -- cgit