diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2012-01-31 22:59:58 +0100 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-01-31 20:30:25 -0500 |
commit | ab68008f87504ace9451c14ba2a7e8dfec435779 (patch) | |
tree | ca43219fe43d1d68d0a543311d596c46c9654b96 /src/responder/nss/nsssrv_cmd.c | |
parent | 25a9a1768d2e3587cc68b76a0a5df1e42a2c89ab (diff) | |
download | sssd-ab68008f87504ace9451c14ba2a7e8dfec435779.tar.gz sssd-ab68008f87504ace9451c14ba2a7e8dfec435779.tar.bz2 sssd-ab68008f87504ace9451c14ba2a7e8dfec435779.zip |
Refactor nss_cmd_send_empty
Diffstat (limited to 'src/responder/nss/nsssrv_cmd.c')
-rw-r--r-- | src/responder/nss/nsssrv_cmd.c | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index 579c7602..bbb115c8 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -46,41 +46,10 @@ static int nss_cmd_send_error(struct nss_cmd_ctx *cmdctx, int err) return EOK; } -int fill_empty(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; -} - static int nss_cmd_send_empty(struct nss_cmd_ctx *cmdctx) { struct cli_ctx *cctx = cmdctx->cctx; - 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 = fill_empty(cctx->creq->out); - if (ret != EOK) { - return ret; - } - sss_packet_set_error(cctx->creq->out, EOK); - sss_cmd_done(cctx, cmdctx); - return EOK; + return sss_cmd_send_empty(cctx, cmdctx); } int nss_cmd_done(struct nss_cmd_ctx *cmdctx, int ret) @@ -1674,7 +1643,7 @@ static int nss_cmd_retpwent(struct cli_ctx *cctx, int num) none: if (ret == ENOENT) { - ret = fill_empty(cctx->creq->out); + ret = sss_cmd_empty_packet(cctx->creq->out); } return ret; } @@ -2913,7 +2882,7 @@ static int nss_cmd_retgrent(struct cli_ctx *cctx, int num) none: if (ret == ENOENT) { - ret = fill_empty(cctx->creq->out); + ret = sss_cmd_empty_packet(cctx->creq->out); } return ret; } |