summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-07-30 13:02:36 +0200
committerMichael Adam <obnox@samba.org>2008-08-01 16:07:04 +0200
commitf060b744efe6af1ad1a21e9e155b30eab502f81a (patch)
treef64c3002cfc84f0ba209d6a2396f05ffa790d4ad /source3
parentab5a6712b6cc83716ad73d99d3235ecafa8d5717 (diff)
downloadsamba-f060b744efe6af1ad1a21e9e155b30eab502f81a.tar.gz
samba-f060b744efe6af1ad1a21e9e155b30eab502f81a.tar.bz2
samba-f060b744efe6af1ad1a21e9e155b30eab502f81a.zip
libnet dssync: support lists of dns (instead of one dn) for single object replication.
Just specify several DNs separated by spaces on the command line of "net rpc vampire keytab" to get the passwords for each of these accouns via single object replication. Michael (This used to be commit 6e53dc2db882d88470be5dfa1155b420fac8e6c5)
Diffstat (limited to 'source3')
-rw-r--r--source3/libnet/libnet_dssync.c40
-rw-r--r--source3/libnet/libnet_dssync.h3
-rw-r--r--source3/utils/net_rpc_samsync.c3
3 files changed, 28 insertions, 18 deletions
diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c
index f8e31e87a6..f3b2363824 100644
--- a/source3/libnet/libnet_dssync.c
+++ b/source3/libnet/libnet_dssync.c
@@ -630,7 +630,9 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx,
union drsuapi_DsGetNCChangesRequest req;
struct replUpToDateVectorBlob *old_utdv = NULL;
struct replUpToDateVectorBlob *pnew_utdv = NULL;
- const char *dn;
+ const char **dns;
+ uint32_t dn_count;
+ uint32_t count;
status = ctx->ops->startup(ctx, mem_ctx, &old_utdv);
if (!NT_STATUS_IS_OK(status)) {
@@ -640,25 +642,31 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx,
goto out;
}
- if (ctx->single && ctx->object_dn) {
- dn = ctx->object_dn;
+ if (ctx->single && ctx->object_dns) {
+ dns = ctx->object_dns;
+ dn_count = ctx->object_count;
} else {
- dn = ctx->nc_dn;
+ dns = &ctx->nc_dn;
+ dn_count = 1;
}
- status = libnet_dssync_build_request(mem_ctx, ctx, dn, old_utdv, &level,
- &req);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
+ for (count=0; count < dn_count; count++) {
+ status = libnet_dssync_build_request(mem_ctx, ctx,
+ dns[count],
+ old_utdv, &level,
+ &req);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto out;
+ }
- status = libnet_dssync_getncchanges(mem_ctx, ctx, level, &req,
- &pnew_utdv);
- if (!NT_STATUS_IS_OK(status)) {
- ctx->error_message = talloc_asprintf(mem_ctx,
- "Failed to call DsGetNCCHanges: %s",
- nt_errstr(status));
- goto out;
+ status = libnet_dssync_getncchanges(mem_ctx, ctx, level, &req,
+ &pnew_utdv);
+ if (!NT_STATUS_IS_OK(status)) {
+ ctx->error_message = talloc_asprintf(mem_ctx,
+ "Failed to call DsGetNCCHanges: %s",
+ nt_errstr(status));
+ goto out;
+ }
}
status = ctx->ops->finish(ctx, mem_ctx, pnew_utdv);
diff --git a/source3/libnet/libnet_dssync.h b/source3/libnet/libnet_dssync.h
index 7869b1620a..56de46ff34 100644
--- a/source3/libnet/libnet_dssync.h
+++ b/source3/libnet/libnet_dssync.h
@@ -37,7 +37,8 @@ struct dssync_context {
const char *nc_dn;
bool single;
bool repl_nodiff;
- const char *object_dn;
+ uint32_t object_count;
+ const char **object_dns;
struct policy_handle bind_handle;
DATA_BLOB session_key;
const char *output_filename;
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index 1e477e3a09..77911f4d5e 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -302,7 +302,8 @@ static NTSTATUS rpc_vampire_keytab_ds_internals(struct net_context *c,
ctx->output_filename = argv[0];
}
if (argc >= 2) {
- ctx->object_dn = argv[1];
+ ctx->object_dns = &argv[1];
+ ctx->object_count = argc - 1;
ctx->single = true;
}