summaryrefslogtreecommitdiffstats
path: root/source4/libnet
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-14 12:11:17 +0100
committerGünther Deschner <gd@samba.org>2014-01-16 16:22:51 +0100
commit0b3b0d225f8485ab0cf392b26f72f7dd5d9c180f (patch)
tree7e7c5ae8790d74c9c7630a39c9a57ade5d42c05f /source4/libnet
parent6e5943af941c2fa2f435b88a52e80d61d9ed3772 (diff)
downloadsamba-0b3b0d225f8485ab0cf392b26f72f7dd5d9c180f.tar.gz
samba-0b3b0d225f8485ab0cf392b26f72f7dd5d9c180f.tar.xz
samba-0b3b0d225f8485ab0cf392b26f72f7dd5d9c180f.zip
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>
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/groupinfo.c28
-rw-r--r--source4/libnet/libnet_group.c12
2 files changed, 25 insertions, 15 deletions
diff --git a/source4/libnet/groupinfo.c b/source4/libnet/groupinfo.c
index 5c8b0f734ca..4e5fea63211 100644
--- a/source4/libnet/groupinfo.c
+++ b/source4/libnet/groupinfo.c
@@ -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);
}
diff --git a/source4/libnet/libnet_group.c b/source4/libnet/libnet_group.c
index c8a95d74a89..2ca0cc1b18e 100644
--- a/source4/libnet/libnet_group.c
+++ b/source4/libnet/libnet_group.c
@@ -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 */