summaryrefslogtreecommitdiffstats
path: root/source3/libnet
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-09-21 20:56:23 -0700
committerGünther Deschner <gd@samba.org>2010-09-23 10:26:25 -0700
commitffdfcfb514c1a0849ba334ae6b9b00d3ad3c2227 (patch)
tree536860be90ee3531863894f87e5c24b1cb523702 /source3/libnet
parentc3f5d990652aec4b4f1f23a5e1c7b644cd46cbe7 (diff)
downloadsamba-ffdfcfb514c1a0849ba334ae6b9b00d3ad3c2227.tar.gz
samba-ffdfcfb514c1a0849ba334ae6b9b00d3ad3c2227.tar.xz
samba-ffdfcfb514c1a0849ba334ae6b9b00d3ad3c2227.zip
s3-dsgetdcname: always pass in messaging context.
Volker, please check. Guenther
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_samsync.c4
-rw-r--r--source3/libnet/libnet_samsync.h1
-rw-r--r--source3/libnet/libnet_samsync_keytab.c22
3 files changed, 17 insertions, 10 deletions
diff --git a/source3/libnet/libnet_samsync.c b/source3/libnet/libnet_samsync.c
index 1b5b9c3b2f5..6e416af180c 100644
--- a/source3/libnet/libnet_samsync.c
+++ b/source3/libnet/libnet_samsync.c
@@ -80,6 +80,10 @@ NTSTATUS libnet_samsync_init_context(TALLOC_CTX *mem_ctx,
NT_STATUS_HAVE_NO_MEMORY(ctx->domain_sid_str);
}
+ ctx->msg_ctx = messaging_init(ctx, procid_self(),
+ event_context_init(ctx));
+ NT_STATUS_HAVE_NO_MEMORY(ctx->msg_ctx);
+
*ctx_p = ctx;
return NT_STATUS_OK;
diff --git a/source3/libnet/libnet_samsync.h b/source3/libnet/libnet_samsync.h
index cc3334050f3..efdbb372bd1 100644
--- a/source3/libnet/libnet_samsync.h
+++ b/source3/libnet/libnet_samsync.h
@@ -75,6 +75,7 @@ struct samsync_context {
struct samsync_object *objects;
struct rpc_pipe_client *cli;
+ struct messaging_context *msg_ctx;
const struct samsync_ops *ops;
diff --git a/source3/libnet/libnet_samsync_keytab.c b/source3/libnet/libnet_samsync_keytab.c
index 0f7c5afac6a..3f7e895928f 100644
--- a/source3/libnet/libnet_samsync_keytab.c
+++ b/source3/libnet/libnet_samsync_keytab.c
@@ -32,22 +32,13 @@
static NTSTATUS keytab_ad_connect(TALLOC_CTX *mem_ctx,
const char *domain_name,
+ const char *dc,
const char *username,
const char *password,
struct libnet_keytab_context *ctx)
{
- NTSTATUS status;
ADS_STATUS ad_status;
ADS_STRUCT *ads;
- struct netr_DsRGetDCNameInfo *info = NULL;
- const char *dc;
-
- status = dsgetdcname(mem_ctx, NULL, domain_name, NULL, NULL, 0, &info);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- dc = strip_hostname(info->dc_unc);
ads = ads_init(NULL, domain_name, dc);
NT_STATUS_HAVE_NO_MEMORY(ads);
@@ -119,17 +110,28 @@ static NTSTATUS init_keytab(TALLOC_CTX *mem_ctx,
struct libnet_keytab_entry *entry;
uint64_t old_sequence_num = 0;
const char *principal = NULL;
+ struct netr_DsRGetDCNameInfo *info = NULL;
+ const char *dc;
ret = libnet_keytab_init(mem_ctx, ctx->output_filename, &keytab_ctx);
if (ret) {
return krb5_to_nt_status(ret);
}
+ status = dsgetdcname(mem_ctx, ctx->msg_ctx,
+ ctx->domain_name, NULL, NULL, 0, &info);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ dc = strip_hostname(info->dc_unc);
+
keytab_ctx->clean_old_entries = ctx->clean_old_entries;
ctx->private_data = keytab_ctx;
status = keytab_ad_connect(mem_ctx,
ctx->domain_name,
+ dc,
ctx->username,
ctx->password,
keytab_ctx);