[SSSD] [PATCH] NSS: Only return data from initgroups once
Jakub Hrozek
jhrozek at redhat.com
Tue Apr 24 21:57:17 UTC 2012
This bug was revealed with the recent subdomains patches where we would
return initgroups results (and free client context at the same time) both
inside nss_cmd_initgroups_search and in its caller.
-------------- next part --------------
>From 7186082bb82e5e6170974b4bdcb60e9e5923ba34 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 24 Apr 2012 23:52:13 +0200
Subject: [PATCH] NSS: Only return data from initgroups once
Do not let nss_cmd_initgroups_search() return data itself, but let the
caller return data. This is more intuitive and more consistent with the
rest of the nss_cmd_*_search() functions.
Also fixes a typo - nss_cmd_initgroups_cb used to call getpw_send_reply
instead of initgr_send_reply.
---
src/responder/nss/nsssrv_cmd.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 85d83e32f83b411e47bee97eb829abe35c9c19d1..2c95645791821b7a08672474930adc041a70b23d 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -3181,8 +3181,7 @@ static int nss_cmd_initgroups_search(struct nss_dom_ctx *dctx)
}
DEBUG(6, ("Initgroups for [%s@%s] completed\n", name, dom->name));
-
- return nss_cmd_initgr_send_reply(dctx);
+ return EOK;
}
DEBUG(SSSDBG_MINOR_FAILURE,
@@ -3222,6 +3221,10 @@ static void nss_cmd_initgroups_dp_callback(uint16_t err_maj, uint32_t err_min,
/* ok the backend returned, search to see if we have updated results */
ret = nss_cmd_initgroups_search(dctx);
+ if (ret == EOK) {
+ /* we have results to return */
+ ret = nss_cmd_initgr_send_reply(dctx);
+ }
done:
ret = nss_cmd_done(cmdctx, ret);
@@ -3318,6 +3321,10 @@ static int nss_cmd_initgroups(struct cli_ctx *cctx)
/* ok, find it ! */
ret = nss_cmd_initgroups_search(dctx);
+ if (ret == EOK) {
+ /* we have results to return */
+ ret = nss_cmd_initgr_send_reply(dctx);
+ }
done:
return nss_cmd_done(cmdctx, ret);
@@ -3350,7 +3357,7 @@ static void nss_cmd_initgroups_cb(struct tevent_req *req)
ret = nss_cmd_initgroups_search(dctx);
if (ret == EOK) {
/* we have results to return */
- ret = nss_cmd_getpw_send_reply(dctx, false);
+ ret = nss_cmd_initgr_send_reply(dctx);
}
done:
--
1.7.10
More information about the sssd-devel
mailing list