summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-04-30 19:57:45 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-04-30 13:08:28 +0200
commit74682826d946ae07881a5caade96f812292345d0 (patch)
treea2928c69d64e8074eb08685a5b3a01b11a1261b2
parent2d8b6ce1c112731de7e2ed89ee19864f2631883d (diff)
downloadsamba-74682826d946ae07881a5caade96f812292345d0.tar.gz
samba-74682826d946ae07881a5caade96f812292345d0.tar.bz2
samba-74682826d946ae07881a5caade96f812292345d0.zip
s4-libnet: Add mem_ctx to libnet_DomainOpen calls (bug #8889)
-rw-r--r--source4/libnet/libnet_domain.c13
-rw-r--r--source4/libnet/libnet_group.c8
-rw-r--r--source4/libnet/libnet_lookup.c2
-rw-r--r--source4/libnet/libnet_user.c12
-rw-r--r--source4/libnet/prereq_domain.c10
5 files changed, 25 insertions, 20 deletions
diff --git a/source4/libnet/libnet_domain.c b/source4/libnet/libnet_domain.c
index acd2ece7a9..0829de9805 100644
--- a/source4/libnet/libnet_domain.c
+++ b/source4/libnet/libnet_domain.c
@@ -268,6 +268,7 @@ static void continue_domain_open_open(struct tevent_req *subreq)
*/
struct composite_context *libnet_DomainOpenSamr_send(struct libnet_context *ctx,
+ TALLOC_CTX *mem_ctx,
struct libnet_DomainOpen *io,
void (*monitor)(struct monitor_msg*))
{
@@ -276,7 +277,7 @@ struct composite_context *libnet_DomainOpenSamr_send(struct libnet_context *ctx,
struct composite_context *rpcconn_req;
struct tevent_req *subreq;
- c = composite_create(ctx, ctx->event_ctx);
+ c = composite_create(mem_ctx, ctx->event_ctx);
if (c == NULL) return NULL;
s = talloc_zero(c, struct domain_open_samr_state);
@@ -414,6 +415,7 @@ static void continue_lsa_policy_open(struct tevent_req *subreq);
*/
struct composite_context* libnet_DomainOpenLsa_send(struct libnet_context *ctx,
+ TALLOC_CTX *mem_ctx,
struct libnet_DomainOpen *io,
void (*monitor)(struct monitor_msg*))
{
@@ -424,7 +426,7 @@ struct composite_context* libnet_DomainOpenLsa_send(struct libnet_context *ctx,
struct lsa_QosInfo *qos;
/* create composite context and state */
- c = composite_create(ctx, ctx->event_ctx);
+ c = composite_create(mem_ctx, ctx->event_ctx);
if (c == NULL) return c;
s = talloc_zero(c, struct domain_open_lsa_state);
@@ -606,6 +608,7 @@ NTSTATUS libnet_DomainOpenLsa_recv(struct composite_context *c, struct libnet_co
*/
struct composite_context* libnet_DomainOpen_send(struct libnet_context *ctx,
+ TALLOC_CTX *mem_ctx,
struct libnet_DomainOpen *io,
void (*monitor)(struct monitor_msg*))
{
@@ -614,13 +617,13 @@ struct composite_context* libnet_DomainOpen_send(struct libnet_context *ctx,
switch (io->in.type) {
case DOMAIN_LSA:
/* reques to open a policy handle on \pipe\lsarpc */
- c = libnet_DomainOpenLsa_send(ctx, io, monitor);
+ c = libnet_DomainOpenLsa_send(ctx, mem_ctx, io, monitor);
break;
case DOMAIN_SAMR:
default:
/* request to open a domain policy handle on \pipe\samr */
- c = libnet_DomainOpenSamr_send(ctx, io, monitor);
+ c = libnet_DomainOpenSamr_send(ctx, mem_ctx, io, monitor);
break;
}
@@ -670,7 +673,7 @@ NTSTATUS libnet_DomainOpen(struct libnet_context *ctx,
TALLOC_CTX *mem_ctx,
struct libnet_DomainOpen *io)
{
- struct composite_context *c = libnet_DomainOpen_send(ctx, io, NULL);
+ struct composite_context *c = libnet_DomainOpen_send(ctx, mem_ctx, io, NULL);
return libnet_DomainOpen_recv(c, ctx, mem_ctx, io);
}
diff --git a/source4/libnet/libnet_group.c b/source4/libnet/libnet_group.c
index 928ce69225..c98a477383 100644
--- a/source4/libnet/libnet_group.c
+++ b/source4/libnet/libnet_group.c
@@ -67,7 +67,7 @@ struct composite_context* libnet_CreateGroup_send(struct libnet_context *ctx,
ZERO_STRUCT(s->r.out);
/* prerequisite: make sure we have a valid samr domain handle */
- prereq_met = samr_domain_opened(ctx, s->r.in.domain_name, &c, &s->domain_open,
+ prereq_met = samr_domain_opened(ctx, c, s->r.in.domain_name, &c, &s->domain_open,
continue_domain_opened, monitor);
if (!prereq_met) return c;
@@ -232,7 +232,7 @@ struct composite_context* libnet_GroupInfo_send(struct libnet_context *ctx,
}
/* prerequisite: make sure the domain is opened */
- prereq_met = samr_domain_opened(ctx, s->domain_name, &c, &s->domopen,
+ prereq_met = samr_domain_opened(ctx, c, s->domain_name, &c, &s->domopen,
continue_domain_open_info, monitor);
if (!prereq_met) return c;
@@ -487,7 +487,7 @@ struct composite_context *libnet_GroupList_send(struct libnet_context *ctx,
s->monitor_fn = monitor;
/* make sure we have lsa domain handle before doing anything */
- prereq_met = lsa_domain_opened(ctx, s->domain_name, &c, &s->domain_open,
+ prereq_met = lsa_domain_opened(ctx, c, s->domain_name, &c, &s->domain_open,
continue_lsa_domain_opened, monitor);
if (!prereq_met) return c;
@@ -563,7 +563,7 @@ static void continue_domain_queried(struct tevent_req *subreq)
s->dominfo = (*s->query_domain.out.info)->domain;
/* make sure we have samr domain handle before continuing */
- prereq_met = samr_domain_opened(s->ctx, s->domain_name, &c, &s->domain_open,
+ prereq_met = samr_domain_opened(s->ctx, c, s->domain_name, &c, &s->domain_open,
continue_samr_domain_opened, s->monitor_fn);
if (!prereq_met) return;
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c
index f5e084f6ef..31ac6e4c10 100644
--- a/source4/libnet/libnet_lookup.c
+++ b/source4/libnet/libnet_lookup.c
@@ -283,7 +283,7 @@ struct composite_context* libnet_LookupName_send(struct libnet_context *ctx,
s->monitor_fn = monitor;
s->ctx = ctx;
- prereq_met = lsa_domain_opened(ctx, io->in.domain_name, &c, &s->domopen,
+ prereq_met = lsa_domain_opened(ctx, c, io->in.domain_name, &c, &s->domopen,
continue_lookup_name, monitor);
if (!prereq_met) return c;
diff --git a/source4/libnet/libnet_user.c b/source4/libnet/libnet_user.c
index eef480af4a..c94e636c86 100644
--- a/source4/libnet/libnet_user.c
+++ b/source4/libnet/libnet_user.c
@@ -79,7 +79,7 @@ struct composite_context* libnet_CreateUser_send(struct libnet_context *ctx,
ZERO_STRUCT(s->r.out);
/* prerequisite: make sure the domain is opened */
- prereq_met = samr_domain_opened(ctx, s->r.in.domain_name, &c, &s->domain_open,
+ prereq_met = samr_domain_opened(ctx, c, s->r.in.domain_name, &c, &s->domain_open,
continue_domain_open_create, monitor);
if (!prereq_met) return c;
@@ -247,7 +247,7 @@ struct composite_context *libnet_DeleteUser_send(struct libnet_context *ctx,
ZERO_STRUCT(s->r.out);
/* prerequisite: make sure the domain is opened before proceeding */
- prereq_met = samr_domain_opened(ctx, s->r.in.domain_name, &c, &s->domain_open,
+ prereq_met = samr_domain_opened(ctx, c, s->r.in.domain_name, &c, &s->domain_open,
continue_domain_open_delete, monitor);
if (!prereq_met) return c;
@@ -415,7 +415,7 @@ struct composite_context *libnet_ModifyUser_send(struct libnet_context *ctx,
s->ctx = ctx;
s->r = *r;
- prereq_met = samr_domain_opened(ctx, s->r.in.domain_name, &c, &s->domain_open,
+ prereq_met = samr_domain_opened(ctx, c, s->r.in.domain_name, &c, &s->domain_open,
continue_domain_open_modify, monitor);
if (!prereq_met) return c;
@@ -661,7 +661,7 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx,
}
/* prerequisite: make sure the domain is opened */
- prereq_met = samr_domain_opened(ctx, s->domain_name, &c, &s->domopen,
+ prereq_met = samr_domain_opened(ctx, c, s->domain_name, &c, &s->domopen,
continue_domain_open_info, monitor);
if (!prereq_met) return c;
@@ -953,7 +953,7 @@ struct composite_context* libnet_UserList_send(struct libnet_context *ctx,
s->monitor_fn = monitor;
/* make sure we have lsa domain handle before doing anything */
- prereq_met = lsa_domain_opened(ctx, s->domain_name, &c, &s->domain_open,
+ prereq_met = lsa_domain_opened(ctx, c, s->domain_name, &c, &s->domain_open,
continue_lsa_domain_opened, monitor);
if (!prereq_met) return c;
@@ -1029,7 +1029,7 @@ static void continue_domain_queried(struct tevent_req *subreq)
s->dominfo = (*s->query_domain.out.info)->domain;
/* make sure we have samr domain handle before continuing */
- prereq_met = samr_domain_opened(s->ctx, s->domain_name, &c, &s->domain_open,
+ prereq_met = samr_domain_opened(s->ctx, c, s->domain_name, &c, &s->domain_open,
continue_samr_domain_opened, s->monitor_fn);
if (!prereq_met) return;
diff --git a/source4/libnet/prereq_domain.c b/source4/libnet/prereq_domain.c
index 039d99d9ef..679669eb62 100644
--- a/source4/libnet/prereq_domain.c
+++ b/source4/libnet/prereq_domain.c
@@ -29,7 +29,8 @@
#include "librpc/gen_ndr/ndr_lsa.h"
-bool samr_domain_opened(struct libnet_context *ctx, const char *domain_name,
+bool samr_domain_opened(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
+ const char *domain_name,
struct composite_context **parent_ctx,
struct libnet_DomainOpen *domain_open,
void (*continue_fn)(struct composite_context*),
@@ -76,7 +77,7 @@ bool samr_domain_opened(struct libnet_context *ctx, const char *domain_name,
}
/* send request to open the domain */
- domopen_req = libnet_DomainOpen_send(ctx, domain_open, monitor);
+ domopen_req = libnet_DomainOpen_send(ctx, mem_ctx, domain_open, monitor);
if (composite_nomem(domopen_req, *parent_ctx)) return false;
composite_continue(*parent_ctx, domopen_req, continue_fn, *parent_ctx);
@@ -84,7 +85,8 @@ bool samr_domain_opened(struct libnet_context *ctx, const char *domain_name,
}
-bool lsa_domain_opened(struct libnet_context *ctx, const char *domain_name,
+bool lsa_domain_opened(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
+ const char *domain_name,
struct composite_context **parent_ctx,
struct libnet_DomainOpen *domain_open,
void (*continue_fn)(struct composite_context*),
@@ -133,7 +135,7 @@ bool lsa_domain_opened(struct libnet_context *ctx, const char *domain_name,
}
/* send request to open the domain */
- domopen_req = libnet_DomainOpen_send(ctx, domain_open, monitor);
+ domopen_req = libnet_DomainOpen_send(ctx, mem_ctx, domain_open, monitor);
/* see the comment above to find out why true is returned here */
if (composite_nomem(domopen_req, *parent_ctx)) return true;