summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-03-10 09:42:07 +0100
committerStefan Metzmacher <metze@samba.org>2010-03-12 15:25:44 +0100
commita8967c378c771697760f47996aaae8f3d1e4a98b (patch)
treec383fdff22eb43be9c9fbab02fccc34ee8fc968f /source4/libnet
parentccc0ab681133548d9c8f0b34368b5836374d9947 (diff)
downloadsamba-a8967c378c771697760f47996aaae8f3d1e4a98b.tar.gz
samba-a8967c378c771697760f47996aaae8f3d1e4a98b.tar.bz2
samba-a8967c378c771697760f47996aaae8f3d1e4a98b.zip
s4:libnet/userinfo.c: make use of use tevent_req based dcerpc_binding_handle stubs
metze
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/userinfo.c81
1 files changed, 46 insertions, 35 deletions
diff --git a/source4/libnet/userinfo.c b/source4/libnet/userinfo.c
index 9bd01accdd..8d9c841997 100644
--- a/source4/libnet/userinfo.c
+++ b/source4/libnet/userinfo.c
@@ -45,28 +45,28 @@ struct userinfo_state {
};
-static void continue_userinfo_lookup(struct rpc_request *req);
-static void continue_userinfo_openuser(struct rpc_request *req);
-static void continue_userinfo_getuser(struct rpc_request *req);
-static void continue_userinfo_closeuser(struct rpc_request *req);
+static void continue_userinfo_lookup(struct tevent_req *subreq);
+static void continue_userinfo_openuser(struct tevent_req *subreq);
+static void continue_userinfo_getuser(struct tevent_req *subreq);
+static void continue_userinfo_closeuser(struct tevent_req *subreq);
/**
* Stage 1 (optional): Look for a username in SAM server.
*/
-static void continue_userinfo_lookup(struct rpc_request *req)
+static void continue_userinfo_lookup(struct tevent_req *subreq)
{
struct composite_context *c;
struct userinfo_state *s;
- struct rpc_request *openuser_req;
struct monitor_msg msg;
struct msg_rpc_lookup_name *msg_lookup;
- 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 userinfo_state);
/* receive samr_Lookup reply */
- c->status = dcerpc_samr_LookupNames_recv(req);
+ c->status = dcerpc_samr_LookupNames_r_recv(subreq, s);
+ TALLOC_FREE(subreq);
if (!composite_is_ok(c)) return;
/* there could be a problem with name resolving itself */
@@ -103,29 +103,31 @@ static void continue_userinfo_lookup(struct rpc_request *req)
s->openuser.out.user_handle = &s->user_handle;
/* send request */
- openuser_req = dcerpc_samr_OpenUser_send(s->pipe, c, &s->openuser);
- if (composite_nomem(openuser_req, c)) return;
+ subreq = dcerpc_samr_OpenUser_r_send(s, c->event_ctx,
+ s->pipe->binding_handle,
+ &s->openuser);
+ if (composite_nomem(subreq, c)) return;
- composite_continue_rpc(c, openuser_req, continue_userinfo_openuser, c);
+ tevent_req_set_callback(subreq, continue_userinfo_openuser, c);
}
/**
* Stage 2: Open user policy handle.
*/
-static void continue_userinfo_openuser(struct rpc_request *req)
+static void continue_userinfo_openuser(struct tevent_req *subreq)
{
struct composite_context *c;
struct userinfo_state *s;
- struct rpc_request *queryuser_req;
struct monitor_msg msg;
struct msg_rpc_open_user *msg_open;
- 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 userinfo_state);
/* receive samr_OpenUser reply */
- c->status = dcerpc_samr_OpenUser_recv(req);
+ c->status = dcerpc_samr_OpenUser_r_recv(subreq, s);
+ TALLOC_FREE(subreq);
if (!composite_is_ok(c)) return;
if (!NT_STATUS_IS_OK(s->queryuserinfo.out.result)) {
@@ -152,29 +154,31 @@ static void continue_userinfo_openuser(struct rpc_request *req)
if (composite_nomem(s->queryuserinfo.out.info, c)) return;
/* queue rpc call, set event handling and new state */
- queryuser_req = dcerpc_samr_QueryUserInfo_send(s->pipe, c, &s->queryuserinfo);
- if (composite_nomem(queryuser_req, c)) return;
+ subreq = dcerpc_samr_QueryUserInfo_r_send(s, c->event_ctx,
+ s->pipe->binding_handle,
+ &s->queryuserinfo);
+ if (composite_nomem(subreq, c)) return;
- composite_continue_rpc(c, queryuser_req, continue_userinfo_getuser, c);
+ tevent_req_set_callback(subreq, continue_userinfo_getuser, c);
}
/**
* Stage 3: Get requested user information.
*/
-static void continue_userinfo_getuser(struct rpc_request *req)
+static void continue_userinfo_getuser(struct tevent_req *subreq)
{
struct composite_context *c;
struct userinfo_state *s;
- struct rpc_request *close_req;
struct monitor_msg msg;
struct msg_rpc_query_user *msg_query;
- 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 userinfo_state);
/* receive samr_QueryUserInfo reply */
- c->status = dcerpc_samr_QueryUserInfo_recv(req);
+ c->status = dcerpc_samr_QueryUserInfo_r_recv(subreq, s);
+ TALLOC_FREE(subreq);
if (!composite_is_ok(c)) return;
/* check if queryuser itself went ok */
@@ -201,28 +205,31 @@ static void continue_userinfo_getuser(struct rpc_request *req)
s->samrclose.out.handle = &s->user_handle;
/* queue rpc call, set event handling and new state */
- close_req = dcerpc_samr_Close_send(s->pipe, c, &s->samrclose);
- if (composite_nomem(close_req, c)) return;
+ subreq = dcerpc_samr_Close_r_send(s, c->event_ctx,
+ s->pipe->binding_handle,
+ &s->samrclose);
+ if (composite_nomem(subreq, c)) return;
- composite_continue_rpc(c, close_req, continue_userinfo_closeuser, c);
+ tevent_req_set_callback(subreq, continue_userinfo_closeuser, c);
}
/**
* Stage 4: Close policy handle associated with opened user.
*/
-static void continue_userinfo_closeuser(struct rpc_request *req)
+static void continue_userinfo_closeuser(struct tevent_req *subreq)
{
struct composite_context *c;
struct userinfo_state *s;
struct monitor_msg msg;
struct msg_rpc_close_user *msg_close;
- 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 userinfo_state);
/* receive samr_Close reply */
- c->status = dcerpc_samr_Close_recv(req);
+ c->status = dcerpc_samr_Close_r_recv(subreq, s);
+ TALLOC_FREE(subreq);
if (!composite_is_ok(c)) return;
if (!NT_STATUS_IS_OK(s->samrclose.out.result)) {
@@ -258,7 +265,7 @@ struct composite_context *libnet_rpc_userinfo_send(struct dcerpc_pipe *p,
struct composite_context *c;
struct userinfo_state *s;
struct dom_sid *sid;
- struct rpc_request *openuser_req, *lookup_req;
+ struct tevent_req *subreq;
if (!p || !io) return NULL;
@@ -285,10 +292,12 @@ struct composite_context *libnet_rpc_userinfo_send(struct dcerpc_pipe *p,
s->openuser.out.user_handle = &s->user_handle;
/* send request */
- openuser_req = dcerpc_samr_OpenUser_send(p, c, &s->openuser);
- if (composite_nomem(openuser_req, c)) return c;
+ subreq = dcerpc_samr_OpenUser_r_send(s, c->event_ctx,
+ p->binding_handle,
+ &s->openuser);
+ if (composite_nomem(subreq, c)) return c;
- composite_continue_rpc(c, openuser_req, continue_userinfo_openuser, c);
+ tevent_req_set_callback(subreq, continue_userinfo_openuser, c);
} else {
/* preparing parameters to send rpc request */
@@ -305,10 +314,12 @@ struct composite_context *libnet_rpc_userinfo_send(struct dcerpc_pipe *p,
if (composite_nomem(s->lookup.in.names[0].string, c)) return c;
/* send request */
- lookup_req = dcerpc_samr_LookupNames_send(p, c, &s->lookup);
- if (composite_nomem(lookup_req, c)) return c;
+ subreq = dcerpc_samr_LookupNames_r_send(s, c->event_ctx,
+ p->binding_handle,
+ &s->lookup);
+ if (composite_nomem(subreq, c)) return c;
- composite_continue_rpc(c, lookup_req, continue_userinfo_lookup, c);
+ tevent_req_set_callback(subreq, continue_userinfo_lookup, c);
}
return c;