diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2012-03-07 19:55:26 +0100 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-03-08 14:25:48 -0500 |
commit | dc6ef7cca694cc4e5b12bb655f966a145d122727 (patch) | |
tree | 268fd4f2b5c82ff2f84133add8b466ba0ef5b48e | |
parent | 4859f3522a017ec998c324d8310c2dd24741ea9e (diff) | |
download | sssd-dc6ef7cca694cc4e5b12bb655f966a145d122727.tar.gz sssd-dc6ef7cca694cc4e5b12bb655f966a145d122727.tar.bz2 sssd-dc6ef7cca694cc4e5b12bb655f966a145d122727.zip |
Handle errors from lookup_netgr_step gracefully
-rw-r--r-- | src/responder/nss/nsssrv_netgroup.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c index bce1d477..81c29bcc 100644 --- a/src/responder/nss/nsssrv_netgroup.c +++ b/src/responder/nss/nsssrv_netgroup.c @@ -189,6 +189,7 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx, state->dctx = talloc_zero(state, struct nss_dom_ctx); if (!state->dctx) { + ret = ENOMEM; goto error; } dctx = state->dctx; @@ -207,6 +208,7 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx, if (domname) { dctx->domain = responder_get_domain(client->rctx->domains, domname); if (!dctx->domain) { + ret = EINVAL; goto error; } @@ -224,6 +226,7 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx, /* Save the netgroup name for getnetgrent */ client->netgr_name = talloc_strdup(client, state->netgr_shortname); if (!client->netgr_name) { + ret = ENOMEM; goto error; } } @@ -264,6 +267,7 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx, */ state->netgr = talloc_zero(nctx, struct getent_ctx); if (!state->netgr) { + ret = ENOMEM; goto error; } dctx->netgr = state->netgr; @@ -275,6 +279,7 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx, client->netgr_name); if (!state->netgr->name) { talloc_free(state->netgr); + ret = ENOMEM; goto error; } @@ -325,7 +330,8 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx, return req; } - /* An unexpected error occurred */ + /* An unexpected error occurred or no domains + * were eligible for the search */ goto error; } tevent_req_done(req); @@ -339,8 +345,9 @@ static struct tevent_req *setnetgrent_send(TALLOC_CTX *mem_ctx, return req; error: - talloc_free(req); - return NULL; + tevent_req_error(req, ret); + tevent_req_post(req, cmdctx->cctx->ev); + return req; } static void lookup_netgr_dp_callback(uint16_t err_maj, uint32_t err_min, |