summaryrefslogtreecommitdiff
path: root/source4/libnet/prereq_domain.c
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2006-12-10 23:43:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:29:06 -0500
commit47e03d96a263a7f9a5e3061c04147e559f2fe9e0 (patch)
treee1ab9d70ce1bc6910be7e66629db86c5eee1124a /source4/libnet/prereq_domain.c
parente8e61a414a52a49a86cc5f3b71a55141a2bbb56b (diff)
downloadsamba-47e03d96a263a7f9a5e3061c04147e559f2fe9e0.tar.gz
samba-47e03d96a263a7f9a5e3061c04147e559f2fe9e0.tar.bz2
samba-47e03d96a263a7f9a5e3061c04147e559f2fe9e0.zip
r20103: Change the returned type of prerequisite checking functions,
as metze once suggested. rafal (This used to be commit 1f3fd5f85461d1e8c9cbdc3144d0a6533b170f76)
Diffstat (limited to 'source4/libnet/prereq_domain.c')
-rw-r--r--source4/libnet/prereq_domain.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/source4/libnet/prereq_domain.c b/source4/libnet/prereq_domain.c
index e02d7d43f4..73c1ba6437 100644
--- a/source4/libnet/prereq_domain.c
+++ b/source4/libnet/prereq_domain.c
@@ -30,15 +30,16 @@
#include "librpc/gen_ndr/ndr_lsa.h"
-struct composite_context* samr_domain_opened(struct libnet_context *ctx,
- const char *domain_name,
- struct composite_context *parent_ctx,
- struct libnet_DomainOpen *domain_open,
- void (*continue_fn)(struct composite_context*),
- void (*monitor)(struct monitor_msg*))
+BOOL samr_domain_opened(struct libnet_context *ctx, const char *domain_name,
+ struct composite_context **parent_ctx,
+ struct libnet_DomainOpen *domain_open,
+ void (*continue_fn)(struct composite_context*),
+ void (*monitor)(struct monitor_msg*))
{
struct composite_context *domopen_req;
+ if (parent_ctx == NULL || *parent_ctx == NULL) return False;
+
if (domain_name == NULL) {
/*
* Try to guess the domain name from credentials,
@@ -51,8 +52,8 @@ struct composite_context* samr_domain_opened(struct libnet_context *ctx,
domain_open->in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
} else {
- composite_error(parent_ctx, NT_STATUS_INVALID_PARAMETER);
- return parent_ctx;
+ composite_error(*parent_ctx, NT_STATUS_INVALID_PARAMETER);
+ return True;
}
} else {
@@ -71,27 +72,28 @@ struct composite_context* samr_domain_opened(struct libnet_context *ctx,
} else {
/* domain has already been opened and it's the same domain
as requested */
- return NULL;
+ return True;
}
}
/* send request to open the domain */
domopen_req = libnet_DomainOpen_send(ctx, domain_open, monitor);
- if (composite_nomem(domopen_req, parent_ctx)) return parent_ctx;
+ if (composite_nomem(domopen_req, *parent_ctx)) return False;
- composite_continue(parent_ctx, domopen_req, continue_fn, parent_ctx);
- return parent_ctx;
+ composite_continue(*parent_ctx, domopen_req, continue_fn, *parent_ctx);
+ return False;
}
-struct composite_context* lsa_domain_opened(struct libnet_context *ctx,
- const char *domain_name,
- struct composite_context *parent_ctx,
- struct libnet_DomainOpen *domain_open,
- void (*continue_fn)(struct composite_context*),
- void (*monitor)(struct monitor_msg*))
+BOOL lsa_domain_opened(struct libnet_context *ctx, const char *domain_name,
+ struct composite_context **parent_ctx,
+ struct libnet_DomainOpen *domain_open,
+ void (*continue_fn)(struct composite_context*),
+ void (*monitor)(struct monitor_msg*))
{
struct composite_context *domopen_req;
+
+ if (parent_ctx == NULL || *parent_ctx == NULL) return False;
if (domain_name == NULL) {
/*
@@ -105,8 +107,10 @@ struct composite_context* lsa_domain_opened(struct libnet_context *ctx,
domain_open->in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
} else {
- composite_error(parent_ctx, NT_STATUS_INVALID_PARAMETER);
- return parent_ctx;
+ composite_error(*parent_ctx, NT_STATUS_INVALID_PARAMETER);
+ /* this ensures the calling function exits and composite function error
+ gets noticed quickly */
+ return True;
}
} else {
@@ -125,14 +129,15 @@ struct composite_context* lsa_domain_opened(struct libnet_context *ctx,
} else {
/* domain has already been opened and it's the same domain
as requested */
- return NULL;
+ return True;
}
}
/* send request to open the domain */
domopen_req = libnet_DomainOpen_send(ctx, domain_open, monitor);
- if (composite_nomem(domopen_req, parent_ctx)) return parent_ctx;
+ /* see the comment above to find out why true is returned here */
+ if (composite_nomem(domopen_req, *parent_ctx)) return True;
- composite_continue(parent_ctx, domopen_req, continue_fn, parent_ctx);
- return parent_ctx;
+ composite_continue(*parent_ctx, domopen_req, continue_fn, *parent_ctx);
+ return False;
}