From c2d78a0a0a3f9b9ade61cf707f23e59a1a16c61b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 14 Feb 2018 13:24:54 +0100 Subject: [PATCH] winbind: add idmap_child_handle() and use it instead of child->binding_handle BUG: https://bugzilla.samba.org/show_bug.cgi?id=13292 Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- source3/winbindd/wb_sids2xids.c | 6 +++--- source3/winbindd/winbindd_allocate_gid.c | 6 +++--- source3/winbindd/winbindd_allocate_uid.c | 6 +++--- source3/winbindd/winbindd_idmap.c | 5 +++++ source3/winbindd/winbindd_proto.h | 1 + 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/source3/winbindd/wb_sids2xids.c b/source3/winbindd/wb_sids2xids.c index b8ad300ba3c8..c687f7064bb6 100644 --- a/source3/winbindd/wb_sids2xids.c +++ b/source3/winbindd/wb_sids2xids.c @@ -167,7 +167,7 @@ static void wb_sids2xids_lookupsids_done(struct tevent_req *subreq) req, struct wb_sids2xids_state); struct lsa_RefDomainList *domains = NULL; struct lsa_TransNameArray *names = NULL; - struct winbindd_child *child; + struct dcerpc_binding_handle *child_binding_handle = NULL; NTSTATUS status; int i; @@ -237,7 +237,7 @@ static void wb_sids2xids_lookupsids_done(struct tevent_req *subreq) TALLOC_FREE(names); TALLOC_FREE(domains); - child = idmap_child(); + child_binding_handle = idmap_child_handle(); state->dom_ids = wb_sids2xids_extract_for_domain_index( state, &state->ids, state->dom_index); @@ -252,7 +252,7 @@ static void wb_sids2xids_lookupsids_done(struct tevent_req *subreq) }; subreq = dcerpc_wbint_Sids2UnixIDs_send( - state, state->ev, child->binding_handle, &state->idmap_dom, + state, state->ev, child_binding_handle, &state->idmap_dom, state->dom_ids); if (tevent_req_nomem(subreq, req)) { return; diff --git a/source3/winbindd/winbindd_allocate_gid.c b/source3/winbindd/winbindd_allocate_gid.c index a9236bbf23d5..85aa13694739 100644 --- a/source3/winbindd/winbindd_allocate_gid.c +++ b/source3/winbindd/winbindd_allocate_gid.c @@ -34,7 +34,7 @@ struct tevent_req *winbindd_allocate_gid_send(TALLOC_CTX *mem_ctx, { struct tevent_req *req, *subreq; struct winbindd_allocate_gid_state *state; - struct winbindd_child *child; + struct dcerpc_binding_handle *child_binding_handle = NULL; req = tevent_req_create(mem_ctx, &state, struct winbindd_allocate_gid_state); @@ -44,9 +44,9 @@ struct tevent_req *winbindd_allocate_gid_send(TALLOC_CTX *mem_ctx, DEBUG(3, ("allocate_gid\n")); - child = idmap_child(); + child_binding_handle = idmap_child_handle(); - subreq = dcerpc_wbint_AllocateGid_send(state, ev, child->binding_handle, + subreq = dcerpc_wbint_AllocateGid_send(state, ev, child_binding_handle, &state->gid); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); diff --git a/source3/winbindd/winbindd_allocate_uid.c b/source3/winbindd/winbindd_allocate_uid.c index 99c0bdac1024..69ce61c872e7 100644 --- a/source3/winbindd/winbindd_allocate_uid.c +++ b/source3/winbindd/winbindd_allocate_uid.c @@ -34,7 +34,7 @@ struct tevent_req *winbindd_allocate_uid_send(TALLOC_CTX *mem_ctx, { struct tevent_req *req, *subreq; struct winbindd_allocate_uid_state *state; - struct winbindd_child *child; + struct dcerpc_binding_handle *child_binding_handle = NULL; req = tevent_req_create(mem_ctx, &state, struct winbindd_allocate_uid_state); @@ -44,9 +44,9 @@ struct tevent_req *winbindd_allocate_uid_send(TALLOC_CTX *mem_ctx, DEBUG(3, ("allocate_uid\n")); - child = idmap_child(); + child_binding_handle = idmap_child_handle(); - subreq = dcerpc_wbint_AllocateUid_send(state, ev, child->binding_handle, + subreq = dcerpc_wbint_AllocateUid_send(state, ev, child_binding_handle, &state->uid); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); diff --git a/source3/winbindd/winbindd_idmap.c b/source3/winbindd/winbindd_idmap.c index 028026087d60..2ee436bc7dcd 100644 --- a/source3/winbindd/winbindd_idmap.c +++ b/source3/winbindd/winbindd_idmap.c @@ -34,6 +34,11 @@ struct winbindd_child *idmap_child(void) return &static_idmap_child; } +struct dcerpc_binding_handle *idmap_child_handle(void) +{ + return static_idmap_child.binding_handle; +} + static const struct winbindd_child_dispatch_table idmap_dispatch_table[] = { { .name = "PING", diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index d09176d954a5..66d4a19617ca 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -351,6 +351,7 @@ NTSTATUS winbindd_print_groupmembers(struct db_context *members, void init_idmap_child(void); struct winbindd_child *idmap_child(void); +struct dcerpc_binding_handle *idmap_child_handle(void); struct idmap_domain *idmap_find_domain_with_sid(const char *domname, const struct dom_sid *sid); const char *idmap_config_const_string(const char *domname, const char *option, -- 2.34.1