summaryrefslogtreecommitdiffstats
path: root/src/responder/common
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-01-31 22:59:58 +0100
committerStephen Gallagher <sgallagh@redhat.com>2012-01-31 20:30:25 -0500
commitab68008f87504ace9451c14ba2a7e8dfec435779 (patch)
treeca43219fe43d1d68d0a543311d596c46c9654b96 /src/responder/common
parent25a9a1768d2e3587cc68b76a0a5df1e42a2c89ab (diff)
downloadsssd-ab68008f87504ace9451c14ba2a7e8dfec435779.tar.gz
sssd-ab68008f87504ace9451c14ba2a7e8dfec435779.tar.xz
sssd-ab68008f87504ace9451c14ba2a7e8dfec435779.zip
Refactor nss_cmd_send_empty
Diffstat (limited to 'src/responder/common')
-rw-r--r--src/responder/common/responder.h2
-rw-r--r--src/responder/common/responder_cmd.c37
2 files changed, 39 insertions, 0 deletions
diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h
index b8d7f8ab7..c60eeab23 100644
--- a/src/responder/common/responder.h
+++ b/src/responder/common/responder.h
@@ -155,6 +155,8 @@ struct sss_domain_info *
responder_get_domain(struct sss_domain_info *doms, const char *domain);
/* responder_cmd.c */
+int sss_cmd_empty_packet(struct sss_packet *packet);
+int sss_cmd_send_empty(struct cli_ctx *cctx, TALLOC_CTX *freectx);
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);
diff --git a/src/responder/common/responder_cmd.c b/src/responder/common/responder_cmd.c
index cd9890305..bf0bb82ba 100644
--- a/src/responder/common/responder_cmd.c
+++ b/src/responder/common/responder_cmd.c
@@ -23,6 +23,43 @@
#include "responder/common/responder.h"
#include "responder/common/responder_packet.h"
+int sss_cmd_empty_packet(struct sss_packet *packet)
+{
+ uint8_t *body;
+ size_t blen;
+ int ret;
+
+ ret = sss_packet_grow(packet, 2*sizeof(uint32_t));
+ if (ret != EOK) return ret;
+
+ sss_packet_get_body(packet, &body, &blen);
+ ((uint32_t *)body)[0] = 0; /* num results */
+ ((uint32_t *)body)[1] = 0; /* reserved */
+
+ return EOK;
+}
+
+int sss_cmd_send_empty(struct cli_ctx *cctx, TALLOC_CTX *freectx)
+{
+ int ret;
+
+ /* create response packet */
+ ret = sss_packet_new(cctx->creq, 0,
+ sss_packet_get_cmd(cctx->creq->in),
+ &cctx->creq->out);
+ if (ret != EOK) {
+ return ret;
+ }
+
+ ret = sss_cmd_empty_packet(cctx->creq->out);
+ if (ret != EOK) {
+ return ret;
+ }
+
+ sss_packet_set_error(cctx->creq->out, EOK);
+ sss_cmd_done(cctx, freectx);
+ return EOK;
+}
void sss_cmd_done(struct cli_ctx *cctx, void *freectx)
{