s4:winbind: let wb_lsa_lookupsids_send() take tevent_context/dcerpc_binding_handle
authorStefan Metzmacher <metze@samba.org>
Tue, 14 Jan 2014 11:11:17 +0000 (12:11 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 16 Jan 2014 15:22:52 +0000 (16:22 +0100)
This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source4/winbind/wb_async_helpers.c
source4/winbind/wb_async_helpers.h
source4/winbind/wb_cmd_lookupsid.c

index 2a05f124656306fd57bcee1021ff6d99282a303c..816a930ffcb343de2aa981e5cb862572a39deab5 100644 (file)
@@ -46,7 +46,8 @@ struct lsa_lookupsids_state {
 static void lsa_lookupsids_recv_names(struct tevent_req *subreq);
 
 struct composite_context *wb_lsa_lookupsids_send(TALLOC_CTX *mem_ctx,
-                                                struct dcerpc_pipe *lsa_pipe,
+                                                struct tevent_context *ev,
+                                                struct dcerpc_binding_handle *lsa_binding,
                                                 struct policy_handle *handle,
                                                 uint32_t num_sids,
                                                 const struct dom_sid **sids)
@@ -56,7 +57,7 @@ struct composite_context *wb_lsa_lookupsids_send(TALLOC_CTX *mem_ctx,
        uint32_t i;
        struct tevent_req *subreq;
 
-       result = composite_create(mem_ctx, lsa_pipe->conn->event_ctx);
+       result = composite_create(mem_ctx, ev);
        if (result == NULL) goto failed;
 
        state = talloc(result, struct lsa_lookupsids_state);
@@ -91,9 +92,8 @@ struct composite_context *wb_lsa_lookupsids_send(TALLOC_CTX *mem_ctx,
        state->r.out.count = &state->count;
        state->r.out.domains = &state->domains;
 
-       subreq = dcerpc_lsa_LookupSids_r_send(state,
-                                             result->event_ctx,
-                                             lsa_pipe->binding_handle,
+       subreq = dcerpc_lsa_LookupSids_r_send(state, ev,
+                                             lsa_binding,
                                              &state->r);
        if (subreq == NULL) goto failed;
        tevent_req_set_callback(subreq, lsa_lookupsids_recv_names, state);
index c930bc02a0f982b0a97b041fdf34038aae703e02..359696da672ffeed706a9a2611c6975a8de1436a 100644 (file)
@@ -23,6 +23,7 @@
 #define __WB_ASYNC_HELPERS_H__
 
 struct dcerpc_pipe;
+struct dcerpc_binding_handle;
 
 #include "librpc/gen_ndr/lsa.h"
 
index 57d859fdf9237f7c1f0e828058f29a4104e1cdc1..4996569bad8a7a70fbd1646facabdeb2878c2ee9 100644 (file)
@@ -76,7 +76,8 @@ static void lookupsid_recv_domain(struct composite_context *ctx)
        state->ctx->status = wb_sid2domain_recv(ctx, &domain);
        if (!composite_is_ok(state->ctx)) return;
 
-       ctx = wb_lsa_lookupsids_send(state, domain->libnet_ctx->lsa.pipe,
+       ctx = wb_lsa_lookupsids_send(state, state->ctx->event_ctx,
+                                    domain->libnet_ctx->lsa.lsa_handle,
                                     &domain->libnet_ctx->lsa.handle, 1, &state->sid);
        composite_continue(state->ctx, ctx, lookupsid_recv_names, state);
 }