diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-03-08 20:33:48 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-03-12 15:25:45 +0100 |
commit | 9e87e6dc9ae73e1a5ad8bfc1742282ba69202ddd (patch) | |
tree | 5d40d7fb4e690d69a8889fdb558674b25db6f179 /source4/winbind | |
parent | a011cbccb7956b277657690f2c3070f4eea78092 (diff) | |
download | samba-9e87e6dc9ae73e1a5ad8bfc1742282ba69202ddd.tar.gz samba-9e87e6dc9ae73e1a5ad8bfc1742282ba69202ddd.tar.bz2 samba-9e87e6dc9ae73e1a5ad8bfc1742282ba69202ddd.zip |
s4:winbind/wb_async_helpers.c: make use of use tevent_req based dcerpc_binding_handle stubs
metze
Diffstat (limited to 'source4/winbind')
-rw-r--r-- | source4/winbind/wb_async_helpers.c | 111 |
1 files changed, 64 insertions, 47 deletions
diff --git a/source4/winbind/wb_async_helpers.c b/source4/winbind/wb_async_helpers.c index 6eced45c15..5d530ca149 100644 --- a/source4/winbind/wb_async_helpers.c +++ b/source4/winbind/wb_async_helpers.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include <tevent.h> #include "libcli/composite/composite.h" #include "winbind/wb_async_helpers.h" @@ -40,7 +41,7 @@ struct lsa_lookupsids_state { struct wb_sid_object **result; }; -static void lsa_lookupsids_recv_names(struct rpc_request *req); +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, @@ -49,9 +50,9 @@ struct composite_context *wb_lsa_lookupsids_send(TALLOC_CTX *mem_ctx, const struct dom_sid **sids) { struct composite_context *result; - struct rpc_request *req; struct lsa_lookupsids_state *state; uint32_t i; + struct tevent_req *subreq; result = composite_create(mem_ctx, lsa_pipe->conn->event_ctx); if (result == NULL) goto failed; @@ -88,11 +89,13 @@ struct composite_context *wb_lsa_lookupsids_send(TALLOC_CTX *mem_ctx, state->r.out.count = &state->count; state->r.out.domains = &state->domains; - req = dcerpc_lsa_LookupSids_send(lsa_pipe, state, &state->r); - if (req == NULL) goto failed; + subreq = dcerpc_lsa_LookupSids_r_send(state, + result->event_ctx, + lsa_pipe->binding_handle, + &state->r); + if (subreq == NULL) goto failed; + tevent_req_set_callback(subreq, lsa_lookupsids_recv_names, state); - req->async.callback = lsa_lookupsids_recv_names; - req->async.private_data = state; return result; failed: @@ -100,14 +103,15 @@ struct composite_context *wb_lsa_lookupsids_send(TALLOC_CTX *mem_ctx, return NULL; } -static void lsa_lookupsids_recv_names(struct rpc_request *req) +static void lsa_lookupsids_recv_names(struct tevent_req *subreq) { struct lsa_lookupsids_state *state = - talloc_get_type(req->async.private_data, - struct lsa_lookupsids_state); + tevent_req_callback_data(subreq, + struct lsa_lookupsids_state); uint32_t i; - state->ctx->status = dcerpc_lsa_LookupSids_recv(req); + state->ctx->status = dcerpc_lsa_LookupSids_r_recv(subreq, state); + TALLOC_FREE(subreq); if (!composite_is_ok(state->ctx)) return; state->ctx->status = state->r.out.result; if (!NT_STATUS_IS_OK(state->ctx->status) && @@ -189,7 +193,7 @@ struct lsa_lookupnames_state { struct wb_sid_object **result; }; -static void lsa_lookupnames_recv_sids(struct rpc_request *req); +static void lsa_lookupnames_recv_sids(struct tevent_req *subreq); struct composite_context *wb_lsa_lookupnames_send(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *lsa_pipe, @@ -198,8 +202,8 @@ struct composite_context *wb_lsa_lookupnames_send(TALLOC_CTX *mem_ctx, const char **names) { struct composite_context *result; - struct rpc_request *req; struct lsa_lookupnames_state *state; + struct tevent_req *subreq; struct lsa_String *lsa_names; uint32_t i; @@ -237,11 +241,13 @@ struct composite_context *wb_lsa_lookupnames_send(TALLOC_CTX *mem_ctx, state->r.out.sids = &state->sids; state->r.out.domains = &state->domains; - req = dcerpc_lsa_LookupNames_send(lsa_pipe, state, &state->r); - if (req == NULL) goto failed; + subreq = dcerpc_lsa_LookupNames_r_send(state, + result->event_ctx, + lsa_pipe->binding_handle, + &state->r); + if (subreq == NULL) goto failed; + tevent_req_set_callback(subreq, lsa_lookupnames_recv_sids, state); - req->async.callback = lsa_lookupnames_recv_sids; - req->async.private_data = state; return result; failed: @@ -249,14 +255,15 @@ struct composite_context *wb_lsa_lookupnames_send(TALLOC_CTX *mem_ctx, return NULL; } -static void lsa_lookupnames_recv_sids(struct rpc_request *req) +static void lsa_lookupnames_recv_sids(struct tevent_req *subreq) { struct lsa_lookupnames_state *state = - talloc_get_type(req->async.private_data, - struct lsa_lookupnames_state); + tevent_req_callback_data(subreq, + struct lsa_lookupnames_state); uint32_t i; - state->ctx->status = dcerpc_lsa_LookupNames_recv(req); + state->ctx->status = dcerpc_lsa_LookupNames_r_recv(subreq, state); + TALLOC_FREE(subreq); if (!composite_is_ok(state->ctx)) return; state->ctx->status = state->r.out.result; if (!NT_STATUS_IS_OK(state->ctx->status) && @@ -327,9 +334,9 @@ struct samr_getuserdomgroups_state { struct samr_Close c; }; -static void samr_usergroups_recv_open(struct rpc_request *req); -static void samr_usergroups_recv_groups(struct rpc_request *req); -static void samr_usergroups_recv_close(struct rpc_request *req); +static void samr_usergroups_recv_open(struct tevent_req *subreq); +static void samr_usergroups_recv_groups(struct tevent_req *subreq); +static void samr_usergroups_recv_close(struct tevent_req *subreq); struct composite_context *wb_samr_userdomgroups_send(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *samr_pipe, @@ -337,8 +344,8 @@ struct composite_context *wb_samr_userdomgroups_send(TALLOC_CTX *mem_ctx, uint32_t rid) { struct composite_context *result; - struct rpc_request *req; struct samr_getuserdomgroups_state *state; + struct tevent_req *subreq; result = composite_create(mem_ctx, samr_pipe->conn->event_ctx); if (result == NULL) goto failed; @@ -358,11 +365,13 @@ struct composite_context *wb_samr_userdomgroups_send(TALLOC_CTX *mem_ctx, state->o.in.rid = rid; state->o.out.user_handle = state->user_handle; - req = dcerpc_samr_OpenUser_send(state->samr_pipe, state, &state->o); - if (req == NULL) goto failed; + subreq = dcerpc_samr_OpenUser_r_send(state, + result->event_ctx, + state->samr_pipe->binding_handle, + &state->o); + if (subreq == NULL) goto failed; + tevent_req_set_callback(subreq, samr_usergroups_recv_open, state); - req->async.callback = samr_usergroups_recv_open; - req->async.private_data = state; return result; failed: @@ -370,13 +379,14 @@ struct composite_context *wb_samr_userdomgroups_send(TALLOC_CTX *mem_ctx, return NULL; } -static void samr_usergroups_recv_open(struct rpc_request *req) +static void samr_usergroups_recv_open(struct tevent_req *subreq) { struct samr_getuserdomgroups_state *state = - talloc_get_type(req->async.private_data, - struct samr_getuserdomgroups_state); + tevent_req_callback_data(subreq, + struct samr_getuserdomgroups_state); - state->ctx->status = dcerpc_samr_OpenUser_recv(req); + state->ctx->status = dcerpc_samr_OpenUser_r_recv(subreq, state); + TALLOC_FREE(subreq); if (!composite_is_ok(state->ctx)) return; state->ctx->status = state->o.out.result; if (!composite_is_ok(state->ctx)) return; @@ -384,19 +394,22 @@ static void samr_usergroups_recv_open(struct rpc_request *req) state->g.in.user_handle = state->user_handle; state->g.out.rids = &state->rid_array; - req = dcerpc_samr_GetGroupsForUser_send(state->samr_pipe, state, - &state->g); - composite_continue_rpc(state->ctx, req, samr_usergroups_recv_groups, - state); + subreq = dcerpc_samr_GetGroupsForUser_r_send(state, + state->ctx->event_ctx, + state->samr_pipe->binding_handle, + &state->g); + if (composite_nomem(subreq, state->ctx)) return; + tevent_req_set_callback(subreq, samr_usergroups_recv_groups, state); } -static void samr_usergroups_recv_groups(struct rpc_request *req) +static void samr_usergroups_recv_groups(struct tevent_req *subreq) { struct samr_getuserdomgroups_state *state = - talloc_get_type(req->async.private_data, - struct samr_getuserdomgroups_state); + tevent_req_callback_data(subreq, + struct samr_getuserdomgroups_state); - state->ctx->status = dcerpc_samr_GetGroupsForUser_recv(req); + state->ctx->status = dcerpc_samr_GetGroupsForUser_r_recv(subreq, state); + TALLOC_FREE(subreq); if (!composite_is_ok(state->ctx)) return; state->ctx->status = state->g.out.result; if (!composite_is_ok(state->ctx)) return; @@ -404,18 +417,22 @@ static void samr_usergroups_recv_groups(struct rpc_request *req) state->c.in.handle = state->user_handle; state->c.out.handle = state->user_handle; - req = dcerpc_samr_Close_send(state->samr_pipe, state, &state->c); - composite_continue_rpc(state->ctx, req, samr_usergroups_recv_close, - state); + subreq = dcerpc_samr_Close_r_send(state, + state->ctx->event_ctx, + state->samr_pipe->binding_handle, + &state->c); + if (composite_nomem(subreq, state->ctx)) return; + tevent_req_set_callback(subreq, samr_usergroups_recv_close, state); } -static void samr_usergroups_recv_close(struct rpc_request *req) +static void samr_usergroups_recv_close(struct tevent_req *subreq) { struct samr_getuserdomgroups_state *state = - talloc_get_type(req->async.private_data, - struct samr_getuserdomgroups_state); + tevent_req_callback_data(subreq, + struct samr_getuserdomgroups_state); - state->ctx->status = dcerpc_samr_Close_recv(req); + state->ctx->status = dcerpc_samr_Close_r_recv(subreq, state); + TALLOC_FREE(subreq); if (!composite_is_ok(state->ctx)) return; state->ctx->status = state->c.out.result; if (!composite_is_ok(state->ctx)) return; |