URL:
https://github.com/SSSD/sssd/pull/89
Title: #89: nss: rewrite nss responder so it uses cache_req
pbrezina commented:
"""
The crash was caused by the same issue as the valgrind log. It is fixed with:
```c
diff --git a/src/responder/nss/nss_enum.c b/src/responder/nss/nss_enum.c
index 5f29d6d..9c922aa 100644
--- a/src/responder/nss/nss_enum.c
+++ b/src/responder/nss/nss_enum.c
@@ -118,6 +118,7 @@ static void nss_setent_internal_done(struct tevent_req *subreq)
{
struct cache_req_result **result;
struct nss_setent_internal_state *state;
+ struct setent_req_list **notify_list;
struct tevent_req *req;
errno_t ret;
errno_t tret;
@@ -168,12 +169,20 @@ static void nss_setent_internal_done(struct tevent_req *subreq)
ret = EOK;
done:
+ /* We want to finish the requests in correct order, this was the
+ * first request, notify_list contain the subsequent request.
+ *
+ * Because callback invoked from tevent_req_done will free state,
+ * we must remember notify_list explicitly to avoid segfault.
+ */
+ notify_list = &state->enum_ctx->notify_list;
+
if (ret == EOK) {
tevent_req_done(req);
- setent_notify_done(&state->enum_ctx->notify_list);
+ setent_notify_done(notify_list);
} else {
- setent_notify(&state->enum_ctx->notify_list, ret);
tevent_req_error(req, ret);
+ setent_notify(notify_list, ret);
}
}
```
"""
See the full comment at
https://github.com/SSSD/sssd/pull/89#issuecomment-265718180