>From 0f3ca2b6dc5efb64a9b6ee4eac7fb9ad6d205f5c Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Thu, 26 Apr 2012 13:06:26 +0200 Subject: [PATCH 4/4] AUTOFS: remove unused assignments Also changes setautomntent_send so that is only return NULL in case the tevent_req creation fails. --- src/responder/autofs/autofssrv_cmd.c | 13 +++++++++---- src/sss_client/autofs/sss_autofs.c | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/responder/autofs/autofssrv_cmd.c b/src/responder/autofs/autofssrv_cmd.c index ebf68b84a3d73d2b36c8a203c0be57cb50fbbcd2..7064591abc83e4f54a6c63779510893145b1fdcb 100644 --- a/src/responder/autofs/autofssrv_cmd.c +++ b/src/responder/autofs/autofssrv_cmd.c @@ -361,13 +361,14 @@ setautomntent_send(TALLOC_CTX *mem_ctx, if (!req) { DEBUG(SSSDBG_FATAL_FAILURE, ("Could not create tevent request for setautomntent\n")); - goto fail; + return NULL; } state->cmdctx = cmdctx; dctx = talloc_zero(state, struct autofs_dom_ctx); if (!dctx) { DEBUG(SSSDBG_FATAL_FAILURE, ("Out of memory\n")); + ret = ENOMEM; goto fail; } dctx->cmd_ctx = state->cmdctx; @@ -388,11 +389,13 @@ setautomntent_send(TALLOC_CTX *mem_ctx, if (domname) { dctx->domain = responder_get_domain(dctx, client->rctx, domname); if (!dctx->domain) { + ret = EINVAL; goto fail; } client->automntmap_name = talloc_strdup(client, rawname); if (!client->automntmap_name) { + ret = ENOMEM; goto fail; } } else { @@ -402,6 +405,7 @@ setautomntent_send(TALLOC_CTX *mem_ctx, client->automntmap_name = talloc_strdup(client, state->mapname); if (!client->automntmap_name) { + ret = ENOMEM; goto fail; } } @@ -504,6 +508,7 @@ setautomntent_send(TALLOC_CTX *mem_ctx, } else if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, ("Could not get data from cache\n")); talloc_free(state->map); + ret = ENOMEM; goto fail; } @@ -520,8 +525,9 @@ setautomntent_send(TALLOC_CTX *mem_ctx, return req; fail: - talloc_free(req); - return NULL; + tevent_req_error(req, ret); + tevent_req_post(req, actx->rctx->ev); + return req; } static errno_t @@ -585,7 +591,6 @@ lookup_automntmap_step(struct setautomntent_lookup_ctx *lookup_ctx) } else break; } - ret = EOK; } ret = get_autofs_map(lookup_ctx->actx, lookup_ctx->mapname, &map); diff --git a/src/sss_client/autofs/sss_autofs.c b/src/sss_client/autofs/sss_autofs.c index 0125e6eece3bfcc69029e6a1e300159778eb72f3..e87ef4fd22d7ea577696866c00bbbb066bee8274 100644 --- a/src/sss_client/autofs/sss_autofs.c +++ b/src/sss_client/autofs/sss_autofs.c @@ -281,7 +281,6 @@ _sss_getautomntent_r(char **key, char **value, void *context) } /* Don't try to handle any error codes, just go to the responder again */ - ret = 0; data_len = sizeof(uint32_t) + /* mapname len */ name_len + 1 + /* mapname\0 */ sizeof(uint32_t) + /* index into the map */ -- 1.7.7.6