1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

s4:libnet: let libnet_rpc_groupadd_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 959d94b153
commit 1c6a2f8bca
2 changed files with 16 additions and 11 deletions

View File

@ -28,7 +28,7 @@
struct groupadd_state {
struct dcerpc_pipe *pipe;
struct dcerpc_binding_handle *binding_handle;
struct policy_handle domain_handle;
struct samr_CreateDomainGroup creategroup;
struct policy_handle group_handle;
@ -41,8 +41,9 @@ struct groupadd_state {
static void continue_groupadd_created(struct tevent_req *subreq);
struct composite_context* libnet_rpc_groupadd_send(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
struct composite_context* libnet_rpc_groupadd_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct dcerpc_binding_handle *b,
struct libnet_rpc_groupadd *io,
void (*monitor)(struct monitor_msg*))
{
@ -50,9 +51,9 @@ struct composite_context* libnet_rpc_groupadd_send(struct dcerpc_pipe *p,
struct groupadd_state *s;
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 NULL;
s = talloc_zero(c, struct groupadd_state);
@ -61,7 +62,7 @@ struct composite_context* libnet_rpc_groupadd_send(struct dcerpc_pipe *p,
c->private_data = s;
s->domain_handle = io->in.domain_handle;
s->pipe = p;
s->binding_handle= b;
s->monitor_fn = monitor;
s->creategroup.in.domain_handle = &s->domain_handle;
@ -78,7 +79,7 @@ struct composite_context* libnet_rpc_groupadd_send(struct dcerpc_pipe *p,
s->creategroup.out.rid = &s->group_rid;
subreq = dcerpc_samr_CreateDomainGroup_r_send(s, c->event_ctx,
s->pipe->binding_handle,
s->binding_handle,
&s->creategroup);
if (composite_nomem(subreq, c)) return c;
@ -131,7 +132,8 @@ NTSTATUS libnet_rpc_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
{
struct composite_context *c;
c = libnet_rpc_groupadd_send(p, mem_ctx, io, NULL);
c = libnet_rpc_groupadd_send(mem_ctx, p->conn->event_ctx,
p->binding_handle, io, NULL);
return libnet_rpc_groupadd_recv(c, mem_ctx, io);
}

View File

@ -76,7 +76,9 @@ struct composite_context* libnet_CreateGroup_send(struct libnet_context *ctx,
s->group_add.in.domain_handle = ctx->samr.handle;
/* send the request */
create_req = libnet_rpc_groupadd_send(ctx->samr.pipe, s, &s->group_add, monitor);
create_req = libnet_rpc_groupadd_send(s, s->ctx->event_ctx,
ctx->samr.samr_handle,
&s->group_add, monitor);
if (composite_nomem(create_req, c)) return c;
composite_continue(c, create_req, continue_rpc_group_added, c);
@ -101,8 +103,9 @@ static void continue_domain_opened(struct composite_context *ctx)
s->group_add.in.domain_handle = s->ctx->samr.handle;
/* send the request */
create_req = libnet_rpc_groupadd_send(s->ctx->samr.pipe, s, &s->group_add,
s->monitor_fn);
create_req = libnet_rpc_groupadd_send(s, s->ctx->event_ctx,
s->ctx->samr.samr_handle,
&s->group_add, s->monitor_fn);
if (composite_nomem(create_req, c)) return;
composite_continue(c, create_req, continue_rpc_group_added, c);