From eae3436320fef015f3e2f78ed32aa57cae0aa7f9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 9 Mar 2010 16:48:17 +0100 Subject: s4:libnet/libnet_group.c: make use of use tevent_req based dcerpc_binding_handle stubs metze --- source4/libnet/libnet_group.c | 57 +++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/source4/libnet/libnet_group.c b/source4/libnet/libnet_group.c index fd37b46a8a..f098667555 100644 --- a/source4/libnet/libnet_group.c +++ b/source4/libnet/libnet_group.c @@ -447,9 +447,9 @@ struct grouplist_state { static void continue_lsa_domain_opened(struct composite_context *ctx); -static void continue_domain_queried(struct rpc_request *req); +static void continue_domain_queried(struct tevent_req *subreq); static void continue_samr_domain_opened(struct composite_context *ctx); -static void continue_groups_enumerated(struct rpc_request *req); +static void continue_groups_enumerated(struct tevent_req *subreq); /** @@ -468,7 +468,7 @@ struct composite_context *libnet_GroupList_send(struct libnet_context *ctx, { struct composite_context *c; struct grouplist_state *s; - struct rpc_request *query_req; + struct tevent_req *subreq; bool prereq_met = false; /* composite context allocation and setup */ @@ -499,10 +499,12 @@ struct composite_context *libnet_GroupList_send(struct libnet_context *ctx, if (composite_nomem(s->query_domain.out.info, c)) return c; /* send the request */ - query_req = dcerpc_lsa_QueryInfoPolicy_send(ctx->lsa.pipe, c, &s->query_domain); - if (composite_nomem(query_req, c)) return c; + subreq = dcerpc_lsa_QueryInfoPolicy_r_send(s, c->event_ctx, + ctx->lsa.pipe->binding_handle, + &s->query_domain); + if (composite_nomem(subreq, c)) return c; - composite_continue_rpc(c, query_req, continue_domain_queried, c); + tevent_req_set_callback(subreq, continue_domain_queried, c); return c; } @@ -515,7 +517,7 @@ static void continue_lsa_domain_opened(struct composite_context *ctx) { struct composite_context *c; struct grouplist_state *s; - struct rpc_request *query_req; + struct tevent_req *subreq; c = talloc_get_type(ctx->async.private_data, struct composite_context); s = talloc_get_type(c->private_data, struct grouplist_state); @@ -531,10 +533,12 @@ static void continue_lsa_domain_opened(struct composite_context *ctx) if (composite_nomem(s->query_domain.out.info, c)) return; /* send the request */ - query_req = dcerpc_lsa_QueryInfoPolicy_send(s->ctx->lsa.pipe, c, &s->query_domain); - if (composite_nomem(query_req, c)) return; + subreq = dcerpc_lsa_QueryInfoPolicy_r_send(s, c->event_ctx, + s->ctx->lsa.pipe->binding_handle, + &s->query_domain); + if (composite_nomem(subreq, c)) return; - composite_continue_rpc(c, query_req, continue_domain_queried, c); + tevent_req_set_callback(subreq, continue_domain_queried, c); } @@ -542,18 +546,18 @@ static void continue_lsa_domain_opened(struct composite_context *ctx) * Stage 1: receive domain info and request to enum groups * provided a valid samr handle is opened */ -static void continue_domain_queried(struct rpc_request *req) +static void continue_domain_queried(struct tevent_req *subreq) { struct composite_context *c; struct grouplist_state *s; - struct rpc_request *enum_req; bool prereq_met = false; - c = talloc_get_type(req->async.private_data, struct composite_context); + c = tevent_req_callback_data(subreq, struct composite_context); s = talloc_get_type(c->private_data, struct grouplist_state); /* receive result of rpc request */ - c->status = dcerpc_lsa_QueryInfoPolicy_recv(req); + c->status = dcerpc_lsa_QueryInfoPolicy_r_recv(subreq, s); + TALLOC_FREE(subreq); if (!composite_is_ok(c)) return; /* get the returned domain info */ @@ -575,10 +579,12 @@ static void continue_domain_queried(struct rpc_request *req) if (composite_nomem(s->group_list.out.sam, c)) return; /* send the request */ - enum_req = dcerpc_samr_EnumDomainGroups_send(s->ctx->samr.pipe, c, &s->group_list); - if (composite_nomem(enum_req, c)) return; + subreq = dcerpc_samr_EnumDomainGroups_r_send(s, c->event_ctx, + s->ctx->samr.pipe->binding_handle, + &s->group_list); + if (composite_nomem(subreq, c)) return; - composite_continue_rpc(c, enum_req, continue_groups_enumerated, c); + tevent_req_set_callback(subreq, continue_groups_enumerated, c); } @@ -590,7 +596,7 @@ static void continue_samr_domain_opened(struct composite_context *ctx) { struct composite_context *c; struct grouplist_state *s; - struct rpc_request *enum_req; + struct tevent_req *subreq; c = talloc_get_type(ctx->async.private_data, struct composite_context); s = talloc_get_type(c->private_data, struct grouplist_state); @@ -610,27 +616,30 @@ static void continue_samr_domain_opened(struct composite_context *ctx) if (composite_nomem(s->group_list.out.sam, c)) return; /* send the request */ - enum_req = dcerpc_samr_EnumDomainGroups_send(s->ctx->samr.pipe, c, &s->group_list); - if (composite_nomem(enum_req, c)) return; + subreq = dcerpc_samr_EnumDomainGroups_r_send(s, c->event_ctx, + s->ctx->samr.pipe->binding_handle, + &s->group_list); + if (composite_nomem(subreq, c)) return; - composite_continue_rpc(c, enum_req, continue_groups_enumerated, c); + tevent_req_set_callback(subreq, continue_groups_enumerated, c); } /* * Stage 2: receive enumerated groups and their rids */ -static void continue_groups_enumerated(struct rpc_request *req) +static void continue_groups_enumerated(struct tevent_req *subreq) { struct composite_context *c; struct grouplist_state *s; uint32_t i; - c = talloc_get_type(req->async.private_data, struct composite_context); + c = tevent_req_callback_data(subreq, struct composite_context); s = talloc_get_type(c->private_data, struct grouplist_state); /* receive result of rpc request */ - c->status = dcerpc_samr_EnumDomainGroups_recv(req); + c->status = dcerpc_samr_EnumDomainGroups_r_recv(subreq, s); + TALLOC_FREE(subreq); if (!composite_is_ok(c)) return; /* get the actual status of the rpc call result -- cgit