summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/responder/common/responder.h4
-rw-r--r--src/responder/common/responder_cmd.c8
-rw-r--r--src/responder/common/responder_common.c10
3 files changed, 15 insertions, 7 deletions
diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h
index a265d61d..110bd38d 100644
--- a/src/responder/common/responder.h
+++ b/src/responder/common/responder.h
@@ -176,9 +176,11 @@ responder_get_domain(TALLOC_CTX *sd_mem_ctx, struct resp_ctx *rctx,
int sss_cmd_empty_packet(struct sss_packet *packet);
int sss_cmd_send_empty(struct cli_ctx *cctx, TALLOC_CTX *freectx);
int sss_cmd_send_error(struct cli_ctx *cctx, int err);
-int sss_cmd_execute(struct cli_ctx *cctx, struct sss_cmd_table *sss_cmds);
void sss_cmd_done(struct cli_ctx *cctx, void *freectx);
int sss_cmd_get_version(struct cli_ctx *cctx);
+int sss_cmd_execute(struct cli_ctx *cctx,
+ enum sss_cli_command cmd,
+ struct sss_cmd_table *sss_cmds);
struct cli_protocol_version *register_cli_protocol_version(void);
struct setent_req_list;
diff --git a/src/responder/common/responder_cmd.c b/src/responder/common/responder_cmd.c
index cb57cba1..3a3fca9b 100644
--- a/src/responder/common/responder_cmd.c
+++ b/src/responder/common/responder_cmd.c
@@ -141,13 +141,12 @@ int sss_cmd_get_version(struct cli_ctx *cctx)
return EOK;
}
-int sss_cmd_execute(struct cli_ctx *cctx, struct sss_cmd_table *sss_cmds)
+int sss_cmd_execute(struct cli_ctx *cctx,
+ enum sss_cli_command cmd,
+ struct sss_cmd_table *sss_cmds)
{
- enum sss_cli_command cmd;
int i;
- cmd = sss_packet_get_cmd(cctx->creq->in);
-
for (i = 0; sss_cmds[i].cmd != SSS_CLI_NULL; i++) {
if (cmd == sss_cmds[i].cmd) {
return sss_cmds[i].fn(cctx);
@@ -156,7 +155,6 @@ int sss_cmd_execute(struct cli_ctx *cctx, struct sss_cmd_table *sss_cmds)
return EINVAL;
}
-
struct setent_req_list {
struct setent_req_list *prev;
struct setent_req_list *next;
diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c
index 824c649a..a4355ae6 100644
--- a/src/responder/common/responder_common.c
+++ b/src/responder/common/responder_common.c
@@ -262,6 +262,14 @@ static void client_send(struct cli_ctx *cctx)
return;
}
+static int client_cmd_execute(struct cli_ctx *cctx, struct sss_cmd_table *sss_cmds)
+{
+ enum sss_cli_command cmd;
+
+ cmd = sss_packet_get_cmd(cctx->creq->in);
+ return sss_cmd_execute(cctx, cmd, sss_cmds);
+}
+
static void client_recv(struct cli_ctx *cctx)
{
int ret;
@@ -291,7 +299,7 @@ static void client_recv(struct cli_ctx *cctx)
/* do not read anymore */
TEVENT_FD_NOT_READABLE(cctx->cfde);
/* execute command */
- ret = sss_cmd_execute(cctx, cctx->rctx->sss_cmds);
+ ret = client_cmd_execute(cctx, cctx->rctx->sss_cmds);
if (ret != EOK) {
DEBUG(0, ("Failed to execute request, aborting client!\n"));
talloc_free(cctx);