[SCM] Samba Shared Repository - branch master updated
Pavel Filipensky
pfilipensky at samba.org
Thu Jul 20 10:39:01 UTC 2023
The branch, master has been updated
via 6539f1e4cd6 s3:winbindd: Change the TALLOC_CTX to fix the tevent call depth tracking
from 801772012eb Revert "s3:winbindd: set TEVENT_DEPRECATED as tevent_thread_call_depth_*() api will change soon"
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 6539f1e4cd6dfb309ff19f403994d9ec52b6bb03
Author: Pavel Filipenský <pfilipensky at samba.org>
Date: Wed Jul 19 11:33:56 2023 +0200
s3:winbindd: Change the TALLOC_CTX to fix the tevent call depth tracking
Call depth is not working for winbindd_list_users_send as expected,
it is visible in the flow traces:
-> process_request_send
-> winbindd_list_users_send
-> wb_query_user_list_send
It should look like:
-> process_request_send
-> winbindd_list_users_send
-> wb_query_user_list_send
Tevent call depth tracking internal implementation relies on the fact
that the talloc memory context has type "struct tevent_req".
Then it can obtain the depth from the parent and increment it by one.
The implementation of winbindd_list_users_send() is passing to
wb_query_user_list_send() context of type
"struct winbindd_list_users_state", and from there the parent
"struct tevent_req" cannot be identified.
So we will pass as TALLOC_CTX 'state' instead of 'state->domains'.
After the call, we can reparent back.
Signed-off-by: Pavel Filipenský <pfilipensky at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Autobuild-User(master): Pavel Filipensky <pfilipensky at samba.org>
Autobuild-Date(master): Thu Jul 20 10:38:19 UTC 2023 on atb-devel-224
-----------------------------------------------------------------------
Summary of changes:
source3/winbindd/winbindd_list_users.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/winbindd/winbindd_list_users.c b/source3/winbindd/winbindd_list_users.c
index 7acc3f7d761..8630672c323 100644
--- a/source3/winbindd/winbindd_list_users.c
+++ b/source3/winbindd/winbindd_list_users.c
@@ -100,9 +100,15 @@ struct tevent_req *winbindd_list_users_send(TALLOC_CTX *mem_ctx,
for (i=0; i<state->num_domains; i++) {
struct winbindd_list_users_domstate *d = &state->domains[i];
-
- d->subreq = wb_query_user_list_send(
- state->domains, ev, d->domain);
+ /*
+ * Use "state" as a talloc memory context since it has type
+ * "struct tevent_req". This is needed to make tevent call depth
+ * tracking working as expected.
+ * After calling wb_query_user_list_send(), re-parent back to
+ * "state->domains" to make TALLOC_FREE(state->domains) working.
+ */
+ d->subreq = wb_query_user_list_send(state, ev, d->domain);
+ d->subreq = talloc_reparent(state, state->domains, d->subreq);
if (tevent_req_nomem(d->subreq, req)) {
TALLOC_FREE(state->domains);
return tevent_req_post(req, ev);
--
Samba Shared Repository
More information about the samba-cvs
mailing list