diff options
Diffstat (limited to 'src/responder/sudo')
-rw-r--r-- | src/responder/sudo/sudosrv_cmd.c | 10 | ||||
-rw-r--r-- | src/responder/sudo/sudosrv_get_sudorules.c | 15 | ||||
-rw-r--r-- | src/responder/sudo/sudosrv_private.h | 7 |
3 files changed, 19 insertions, 13 deletions
diff --git a/src/responder/sudo/sudosrv_cmd.c b/src/responder/sudo/sudosrv_cmd.c index 911acf6e..13eb4991 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 1f4270d4..a405848a 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 47850ad6..e23a0d0d 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; |