diff options
-rw-r--r-- | src/responder/autofs/autofssrv_cmd.c | 2 | ||||
-rw-r--r-- | src/responder/common/responder.h | 4 | ||||
-rw-r--r-- | src/responder/common/responder_cmd.c | 18 | ||||
-rw-r--r-- | src/responder/nss/nsssrv_cmd.c | 13 | ||||
-rw-r--r-- | src/responder/nss/nsssrv_private.h | 1 |
5 files changed, 16 insertions, 22 deletions
diff --git a/src/responder/autofs/autofssrv_cmd.c b/src/responder/autofs/autofssrv_cmd.c index d2b37f71..73dbc5ea 100644 --- a/src/responder/autofs/autofssrv_cmd.c +++ b/src/responder/autofs/autofssrv_cmd.c @@ -87,7 +87,7 @@ autofs_setent_add_ref(TALLOC_CTX *memctx, static void autofs_setent_notify(struct autofs_map_ctx *map_ctx, errno_t ret) { - setent_notify(map_ctx->reqs, ret); + setent_notify(&map_ctx->reqs, ret); } static errno_t diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h index 7ec2ee3d..48678ff9 100644 --- a/src/responder/common/responder.h +++ b/src/responder/common/responder.h @@ -168,8 +168,8 @@ errno_t setent_add_ref(TALLOC_CTX *memctx, void *pvt, struct setent_req_list **list, struct tevent_req *req); -void setent_notify(struct setent_req_list *list, errno_t err); -void setent_notify_done(struct setent_req_list *list); +void setent_notify(struct setent_req_list **list, errno_t err); +void setent_notify_done(struct setent_req_list **list); errno_t sss_cmd_check_cache(struct ldb_message *msg, diff --git a/src/responder/common/responder_cmd.c b/src/responder/common/responder_cmd.c index f36ea14a..16f38eaf 100644 --- a/src/responder/common/responder_cmd.c +++ b/src/responder/common/responder_cmd.c @@ -160,8 +160,8 @@ int sss_cmd_execute(struct cli_ctx *cctx, struct sss_cmd_table *sss_cmds) struct setent_req_list { struct setent_req_list *prev; struct setent_req_list *next; - /* Need to point to the head of the list from a talloc destructor */ - struct setent_req_list *head; + /* Need to modify the list from a talloc destructor */ + struct setent_req_list **head; void *pvt; @@ -178,7 +178,7 @@ int setent_remove_ref(TALLOC_CTX *ctx) { struct setent_req_list *entry = talloc_get_type(ctx, struct setent_req_list); - DLIST_REMOVE(entry->head, entry); + DLIST_REMOVE(*(entry->head), entry); return 0; } @@ -197,18 +197,18 @@ errno_t setent_add_ref(TALLOC_CTX *memctx, entry->req = req; entry->pvt = pvt; DLIST_ADD_END(*list, entry, struct setent_req_list *); - entry->head = *list; + entry->head = list; talloc_set_destructor((TALLOC_CTX *)entry, setent_remove_ref); return EOK; } -void setent_notify(struct setent_req_list *list, errno_t err) +void setent_notify(struct setent_req_list **list, errno_t err) { struct setent_req_list *reql; /* Notify the waiting clients */ - while ((reql = list)) { + while ((reql = *list) != NULL) { /* Each tevent_req_done() call will free * the request, removing it from the list. */ @@ -218,7 +218,7 @@ void setent_notify(struct setent_req_list *list, errno_t err) tevent_req_error(reql->req, err); } - if (reql == list) { + if (reql == *list) { /* The consumer failed to free the * request. Log a bug and continue. */ @@ -226,12 +226,12 @@ void setent_notify(struct setent_req_list *list, errno_t err) ("BUG: a callback did not free its request. " "May leak memory\n")); /* Skip to the next since a memory leak is non-fatal */ - list = list->next; + *list = (*list)->next; } } } -void setent_notify_done(struct setent_req_list *list) +void setent_notify_done(struct setent_req_list **list) { return setent_notify(list, EOK); } diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index 1c9160b7..68f6e0bb 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -77,11 +77,6 @@ int nss_cmd_done(struct nss_cmd_ctx *cmdctx, int ret) /*************************** * Enumeration procedures * ***************************/ -struct tevent_req *nss_setent_get_req(struct getent_ctx *getent_ctx) -{ - return setent_get_req(getent_ctx->reqs); -} - errno_t nss_setent_add_ref(TALLOC_CTX *memctx, struct getent_ctx *getent_ctx, struct tevent_req *req) @@ -91,12 +86,12 @@ errno_t nss_setent_add_ref(TALLOC_CTX *memctx, void nss_setent_notify_error(struct getent_ctx *getent_ctx, errno_t ret) { - return setent_notify(getent_ctx->reqs, ret); + return setent_notify(&getent_ctx->reqs, ret); } void nss_setent_notify_done(struct getent_ctx *getent_ctx) { - return setent_notify_done(getent_ctx->reqs); + return setent_notify_done(&getent_ctx->reqs); } struct setent_ctx { @@ -1403,7 +1398,7 @@ static errno_t nss_cmd_setpwent_step(struct setent_step_ctx *step_ctx) } /* Notify the waiting clients */ - setent_notify_done(nctx->pctx->reqs); + nss_setent_notify_done(nctx->pctx); if (step_ctx->returned_to_mainloop) { return EAGAIN; @@ -2701,7 +2696,7 @@ static errno_t nss_cmd_setgrent_step(struct setent_step_ctx *step_ctx) } /* Notify the waiting clients */ - setent_notify_done(nctx->gctx->reqs); + nss_setent_notify_done(nctx->gctx); if (step_ctx->returned_to_mainloop) { return EAGAIN; diff --git a/src/responder/nss/nsssrv_private.h b/src/responder/nss/nsssrv_private.h index c0bf2ee2..c6526595 100644 --- a/src/responder/nss/nsssrv_private.h +++ b/src/responder/nss/nsssrv_private.h @@ -104,7 +104,6 @@ int nss_cmd_done(struct nss_cmd_ctx *cmdctx, int ret); errno_t nss_setent_add_ref(TALLOC_CTX *memctx, struct getent_ctx *getent_ctx, struct tevent_req *req); -struct tevent_req *nss_setent_get_req(struct getent_ctx *getent_ctx); void nss_setent_notify_error(struct getent_ctx *getent_ctx, errno_t ret); void nss_setent_notify_done(struct getent_ctx *getent_ctx); |