1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-10 12:58:35 +03:00

s4:libnet: let libnet_rpc_groupinfo_send() take tevent_context/dcerpc_binding_handle

This avoids usage/dereferencing 'struct dcerpc_pipe'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
This commit is contained in:
Stefan Metzmacher 2014-01-14 12:11:17 +01:00 committed by Günther Deschner
parent 6e5943af94
commit 0b3b0d225f
2 changed files with 25 additions and 15 deletions

View File

@ -31,7 +31,7 @@
struct groupinfo_state {
struct dcerpc_pipe *pipe;
struct dcerpc_binding_handle *binding_handle;
struct policy_handle domain_handle;
struct policy_handle group_handle;
uint16_t level;
@ -109,7 +109,7 @@ static void continue_groupinfo_lookup(struct tevent_req *subreq)
/* send request */
subreq = dcerpc_samr_OpenGroup_r_send(s, c->event_ctx,
s->pipe->binding_handle,
s->binding_handle,
&s->opengroup);
if (composite_nomem(subreq, c)) return;
@ -161,7 +161,7 @@ static void continue_groupinfo_opengroup(struct tevent_req *subreq)
/* queue rpc call, set event handling and new state */
subreq = dcerpc_samr_QueryGroupInfo_r_send(s,
c->event_ctx,
s->pipe->binding_handle,
s->binding_handle,
&s->querygroupinfo);
if (composite_nomem(subreq, c)) return;
@ -212,7 +212,7 @@ static void continue_groupinfo_getgroup(struct tevent_req *subreq)
/* queue rpc call, set event handling and new state */
subreq = dcerpc_samr_Close_r_send(s, c->event_ctx,
s->pipe->binding_handle,
s->binding_handle,
&s->samrclose);
if (composite_nomem(subreq, c)) return;
@ -264,8 +264,9 @@ static void continue_groupinfo_closegroup(struct tevent_req *subreq)
* @param p dce/rpc call pipe
* @param io arguments and results of the call
*/
struct composite_context *libnet_rpc_groupinfo_send(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
struct composite_context *libnet_rpc_groupinfo_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct dcerpc_binding_handle *b,
struct libnet_rpc_groupinfo *io,
void (*monitor)(struct monitor_msg*))
{
@ -274,9 +275,9 @@ struct composite_context *libnet_rpc_groupinfo_send(struct dcerpc_pipe *p,
struct dom_sid *sid;
struct tevent_req *subreq;
if (!p || !io) return NULL;
if (!b || !io) return NULL;
c = composite_create(mem_ctx, dcerpc_event_context(p));
c = composite_create(mem_ctx, ev);
if (c == NULL) return c;
s = talloc_zero(c, struct groupinfo_state);
@ -285,7 +286,7 @@ struct composite_context *libnet_rpc_groupinfo_send(struct dcerpc_pipe *p,
c->private_data = s;
s->level = io->in.level;
s->pipe = p;
s->binding_handle= b;
s->domain_handle = io->in.domain_handle;
s->monitor_fn = monitor;
@ -300,7 +301,7 @@ struct composite_context *libnet_rpc_groupinfo_send(struct dcerpc_pipe *p,
/* send request */
subreq = dcerpc_samr_OpenGroup_r_send(s, c->event_ctx,
p->binding_handle,
s->binding_handle,
&s->opengroup);
if (composite_nomem(subreq, c)) return c;
@ -322,7 +323,7 @@ struct composite_context *libnet_rpc_groupinfo_send(struct dcerpc_pipe *p,
/* send request */
subreq = dcerpc_samr_LookupNames_r_send(s, c->event_ctx,
p->binding_handle,
s->binding_handle,
&s->lookup);
if (composite_nomem(subreq, c)) return c;
@ -376,6 +377,9 @@ NTSTATUS libnet_rpc_groupinfo(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
struct libnet_rpc_groupinfo *io)
{
struct composite_context *c = libnet_rpc_groupinfo_send(p, mem_ctx, io, NULL);
struct composite_context *c = libnet_rpc_groupinfo_send(mem_ctx,
p->conn->event_ctx,
p->binding_handle,
io, NULL);
return libnet_rpc_groupinfo_recv(c, mem_ctx, io);
}

View File

@ -257,7 +257,9 @@ struct composite_context* libnet_GroupInfo_send(struct libnet_context *ctx,
s->info.in.level = GROUPINFOALL;
/* send the request */
info_req = libnet_rpc_groupinfo_send(s->ctx->samr.pipe, s, &s->info, s->monitor_fn);
info_req = libnet_rpc_groupinfo_send(s, s->ctx->event_ctx,
s->ctx->samr.samr_handle,
&s->info, s->monitor_fn);
if (composite_nomem(info_req, c)) return c;
/* set the next stage */
@ -306,7 +308,9 @@ static void continue_domain_open_info(struct composite_context *ctx)
s->info.in.level = GROUPINFOALL;
/* send the request */
info_req = libnet_rpc_groupinfo_send(s->ctx->samr.pipe, s, &s->info, s->monitor_fn);
info_req = libnet_rpc_groupinfo_send(s, s->ctx->event_ctx,
s->ctx->samr.samr_handle,
&s->info, s->monitor_fn);
if (composite_nomem(info_req, c)) return;
/* set the next stage */
@ -348,7 +352,9 @@ static void continue_name_found(struct composite_context *ctx)
s->info.in.level = GROUPINFOALL;
/* send the request */
info_req = libnet_rpc_groupinfo_send(s->ctx->samr.pipe, s, &s->info, s->monitor_fn);
info_req = libnet_rpc_groupinfo_send(s, s->ctx->event_ctx,
s->ctx->samr.samr_handle,
&s->info, s->monitor_fn);
if (composite_nomem(info_req, c)) return;
/* set the next stage */