summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2012-05-11 09:42:01 +0200
committerStephen Gallagher <sgallagh@redhat.com>2012-06-29 11:37:18 -0400
commit76db25eab9010a33657f35e5afc8477c996df7a3 (patch)
tree4238dbbfca28a6819285259fdbd1930f6a1992c8 /src
parentb041138015878405fe09ee6695d9ff5e5be07405 (diff)
downloadsssd-76db25eab9010a33657f35e5afc8477c996df7a3.tar.gz
sssd-76db25eab9010a33657f35e5afc8477c996df7a3.tar.xz
sssd-76db25eab9010a33657f35e5afc8477c996df7a3.zip
sudo responder: new request enum type
sss_sudo_type represents query type that comes to the responder sss_dp_sudo_type represents query type to DP that is issued by the responder I'm leaving current values of sss_dp_sudo_type untouched so the compilation is not broken. Hovewer, they will be changed to new DP types once the DP interface is updated.
Diffstat (limited to 'src')
-rw-r--r--src/responder/sudo/sudosrv_cmd.c10
-rw-r--r--src/responder/sudo/sudosrv_get_sudorules.c15
-rw-r--r--src/responder/sudo/sudosrv_private.h7
3 files changed, 19 insertions, 13 deletions
diff --git a/src/responder/sudo/sudosrv_cmd.c b/src/responder/sudo/sudosrv_cmd.c
index 911acf6e9..13eb4991f 100644
--- a/src/responder/sudo/sudosrv_cmd.c
+++ b/src/responder/sudo/sudosrv_cmd.c
@@ -155,7 +155,7 @@ errno_t sudosrv_cmd_done(struct sudo_cmd_ctx *cmd_ctx, int ret)
return EOK;
}
-static int sudosrv_cmd(enum sss_dp_sudo_type type, struct cli_ctx *cli_ctx)
+static int sudosrv_cmd(enum sss_sudo_type type, struct cli_ctx *cli_ctx)
{
struct sudo_cmd_ctx *cmd_ctx = NULL;
struct sudo_dom_ctx *dom_ctx = NULL;
@@ -209,12 +209,12 @@ static int sudosrv_cmd(enum sss_dp_sudo_type type, struct cli_ctx *cli_ctx)
cmd_ctx->check_next = cmd_ctx->domain == NULL;
switch (cmd_ctx->type) {
- case SSS_DP_SUDO_DEFAULTS:
+ case SSS_SUDO_DEFAULTS:
DEBUG(SSSDBG_FUNC_DATA, ("Requesting default options "
"for [%s] from [%s]\n", cmd_ctx->username,
cmd_ctx->domain ? cmd_ctx->domain->name : "<ALL>"));
break;
- case SSS_DP_SUDO_USER:
+ case SSS_SUDO_USER:
DEBUG(SSSDBG_FUNC_DATA, ("Requesting rules "
"for [%s] from [%s]\n", cmd_ctx->username,
cmd_ctx->domain ? cmd_ctx->domain->name : "<ALL>"));
@@ -241,12 +241,12 @@ done:
static int sudosrv_cmd_get_sudorules(struct cli_ctx *cli_ctx)
{
- return sudosrv_cmd(SSS_DP_SUDO_USER, cli_ctx);
+ return sudosrv_cmd(SSS_SUDO_USER, cli_ctx);
}
static int sudosrv_cmd_get_defaults(struct cli_ctx *cli_ctx)
{
- return sudosrv_cmd(SSS_DP_SUDO_DEFAULTS, cli_ctx);
+ return sudosrv_cmd(SSS_SUDO_DEFAULTS, cli_ctx);
}
struct cli_protocol_version *register_cli_protocol_version(void)
diff --git a/src/responder/sudo/sudosrv_get_sudorules.c b/src/responder/sudo/sudosrv_get_sudorules.c
index 1f4270d49..a405848a5 100644
--- a/src/responder/sudo/sudosrv_get_sudorules.c
+++ b/src/responder/sudo/sudosrv_get_sudorules.c
@@ -314,12 +314,12 @@ errno_t sudosrv_get_rules(struct sudo_cmd_ctx *cmd_ctx)
struct dp_callback_ctx *cb_ctx = NULL;
switch (cmd_ctx->type) {
- case SSS_DP_SUDO_DEFAULTS:
+ case SSS_SUDO_DEFAULTS:
DEBUG(SSSDBG_TRACE_FUNC, ("Retrieving default options "
"for [%s] from [%s]\n", cmd_ctx->orig_username,
cmd_ctx->domain->name));
break;
- case SSS_DP_SUDO_USER:
+ case SSS_SUDO_USER:
DEBUG(SSSDBG_TRACE_FUNC, ("Retrieving rules "
"for [%s] from [%s]\n", cmd_ctx->orig_username,
cmd_ctx->domain->name));
@@ -442,7 +442,7 @@ static errno_t sudosrv_get_sudorules_from_cache(struct sudo_cmd_ctx *cmd_ctx)
}
switch (cmd_ctx->type) {
- case SSS_DP_SUDO_USER:
+ case SSS_SUDO_USER:
debug_name = cmd_ctx->cased_username;
ret = sysdb_get_sudo_user_info(tmp_ctx, cmd_ctx->orig_username, sysdb,
NULL, &groupnames);
@@ -452,7 +452,7 @@ static errno_t sudosrv_get_sudorules_from_cache(struct sudo_cmd_ctx *cmd_ctx)
goto done;
}
break;
- case SSS_DP_SUDO_DEFAULTS:
+ case SSS_SUDO_DEFAULTS:
debug_name = "<default options>";
break;
}
@@ -513,13 +513,14 @@ static errno_t sudosrv_get_sudorules_query_cache(TALLOC_CTX *mem_ctx,
if (tmp_ctx == NULL) return ENOMEM;
switch (type) {
- case SSS_DP_SUDO_DEFAULTS:
+ case SSS_SUDO_DEFAULTS:
flags = SYSDB_SUDO_FILTER_INCLUDE_DFL;
break;
- case SSS_DP_SUDO_USER:
- flags = SYSDB_SUDO_FILTER_USERINFO | SYSDB_SUDO_FILTER_INCLUDE_ALL;
+ case SSS_SUDO_USER:
+ flags = SYSDB_SUDO_FILTER_USERINFO | SYSDB_SUDO_FILTER_INCLUDE_ALL;
break;
}
+
ret = sysdb_get_sudo_filter(tmp_ctx, username, uid, groupnames,
flags, &filter);
if (ret != EOK) {
diff --git a/src/responder/sudo/sudosrv_private.h b/src/responder/sudo/sudosrv_private.h
index 47850ad63..e23a0d0d2 100644
--- a/src/responder/sudo/sudosrv_private.h
+++ b/src/responder/sudo/sudosrv_private.h
@@ -37,6 +37,11 @@ enum sss_dp_sudo_type {
SSS_DP_SUDO_USER
};
+enum sss_sudo_type {
+ SSS_SUDO_DEFAULTS,
+ SSS_SUDO_USER
+};
+
struct sudo_ctx {
struct resp_ctx *rctx;
@@ -49,7 +54,7 @@ struct sudo_ctx {
struct sudo_cmd_ctx {
struct cli_ctx *cli_ctx;
struct sudo_ctx *sudo_ctx;
- enum sss_dp_sudo_type type;
+ enum sss_sudo_type type;
/* input data */
uid_t uid;