From 2341f3381d32972eade1286891a8c45ebce756df Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 23 Jun 2008 23:13:21 +0200 Subject: net_vampire: add basic libnet_dssync() infrastructure. Guenther (This used to be commit 9486e532da602da587769d4ff8a1a2825e541a30) --- source3/libnet/libnet_dssync.c | 353 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 353 insertions(+) create mode 100644 source3/libnet/libnet_dssync.c (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c new file mode 100644 index 0000000000..63a5c8bef1 --- /dev/null +++ b/source3/libnet/libnet_dssync.c @@ -0,0 +1,353 @@ +/* + Unix SMB/CIFS implementation. + + Copyright (C) Stefan (metze) Metzmacher 2005 + Copyright (C) Guenther Deschner 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + + +#include "includes.h" +#include "libnet/libnet_dssync.h" + +/**************************************************************** +****************************************************************/ + +static int libnet_dssync_free_context(struct dssync_context *ctx) +{ + if (!ctx) { + return 0; + } + + if (is_valid_policy_hnd(&ctx->bind_handle) && ctx->cli) { + rpccli_drsuapi_DsUnbind(ctx->cli, ctx, &ctx->bind_handle, NULL); + } + + return 0; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS libnet_dssync_init_context(TALLOC_CTX *mem_ctx, + struct dssync_context **ctx_p) +{ + struct dssync_context *ctx; + + ctx = TALLOC_ZERO_P(mem_ctx, struct dssync_context); + NT_STATUS_HAVE_NO_MEMORY(ctx); + + talloc_set_destructor(ctx, libnet_dssync_free_context); + + *ctx_p = ctx; + + return NT_STATUS_OK; +} + +/**************************************************************** +****************************************************************/ + +static NTSTATUS libnet_dssync_bind(TALLOC_CTX *mem_ctx, + struct dssync_context *ctx) +{ + NTSTATUS status; + WERROR werr; + + struct GUID bind_guid; + struct drsuapi_DsBindInfoCtr bind_info; + struct drsuapi_DsBindInfo28 info28; + + ZERO_STRUCT(info28); + + GUID_from_string(DRSUAPI_DS_BIND_GUID, &bind_guid); + + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_BASE; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7; + info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT; + info28.site_guid = GUID_zero(); + info28.u1 = 508; + info28.repl_epoch = 0; + + bind_info.length = 28; + bind_info.info.info28 = info28; + + status = rpccli_drsuapi_DsBind(ctx->cli, mem_ctx, + &bind_guid, + &bind_info, + &ctx->bind_handle, + &werr); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (!W_ERROR_IS_OK(werr)) { + return werror_to_ntstatus(werr); + } + + return status; +} + +/**************************************************************** +****************************************************************/ + +static NTSTATUS libnet_dssync_lookup_nc(TALLOC_CTX *mem_ctx, + struct dssync_context *ctx) +{ + NTSTATUS status; + WERROR werr; + int32_t level = 1; + union drsuapi_DsNameRequest req; + int32_t level_out; + struct drsuapi_DsNameString names[1]; + union drsuapi_DsNameCtr ctr; + + names[0].str = talloc_asprintf(mem_ctx, "%s\\", ctx->domain_name); + NT_STATUS_HAVE_NO_MEMORY(names[0].str); + + req.req1.codepage = 1252; /* german */ + req.req1.language = 0x00000407; /* german */ + req.req1.count = 1; + req.req1.names = names; + req.req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; + req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_UKNOWN; + req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; + + status = rpccli_drsuapi_DsCrackNames(ctx->cli, mem_ctx, + &ctx->bind_handle, + level, + &req, + &level_out, + &ctr, + &werr); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (!W_ERROR_IS_OK(werr)) { + return werror_to_ntstatus(werr); + } + + if (ctr.ctr1->count != 1) { + return NT_STATUS_UNSUCCESSFUL; + } + + if (ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + return NT_STATUS_UNSUCCESSFUL; + } + + ctx->nc_dn = talloc_strdup(mem_ctx, ctr.ctr1->array[0].result_name); + NT_STATUS_HAVE_NO_MEMORY(ctx->nc_dn); + + return NT_STATUS_OK; +} + +/**************************************************************** +****************************************************************/ + +static NTSTATUS libnet_dssync_init(TALLOC_CTX *mem_ctx, + struct dssync_context *ctx) +{ + NTSTATUS status; + + status = libnet_dssync_bind(mem_ctx, ctx); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (!ctx->nc_dn) { + status = libnet_dssync_lookup_nc(mem_ctx, ctx); + } + + return status; +} + +/**************************************************************** +****************************************************************/ + +static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, + struct dssync_context *ctx) +{ + NTSTATUS status; + WERROR werr; + + int32_t level = 8; + int32_t level_out = 0; + union drsuapi_DsGetNCChangesRequest req; + union drsuapi_DsGetNCChangesCtr ctr; + struct drsuapi_DsReplicaObjectIdentifier nc; + struct dom_sid null_sid; + + struct drsuapi_DsGetNCChangesCtr1 *ctr1 = NULL; + struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL; + int32_t out_level = 0; + int y; + + ZERO_STRUCT(null_sid); + ZERO_STRUCT(req); + + nc.dn = ctx->nc_dn; + nc.guid = GUID_zero(); + nc.sid = null_sid; + + req.req8.naming_context = &nc; + req.req8.replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE | + DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP | + DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS | + DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS | + DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED; + req.req8.max_object_count = 402; + req.req8.max_ndr_size = 402116; + + for (y=0; ;y++) { + + if (level == 8) { + DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, + (long long)req.req8.highwatermark.tmp_highest_usn, + (long long)req.req8.highwatermark.highest_usn)); + } + + status = rpccli_drsuapi_DsGetNCChanges(ctx->cli, mem_ctx, + &ctx->bind_handle, + level, + &req, + &level_out, + &ctr, + &werr); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto out; + } + + if (!W_ERROR_IS_OK(werr)) { + goto out; + } + + if (level_out == 1) { + out_level = 1; + ctr1 = &ctr.ctr1; + } else if (level_out == 2) { + out_level = 1; + ctr1 = ctr.ctr2.ctr.mszip1.ctr1; + } + + status = cli_get_session_key(ctx->cli, &ctx->session_key); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (out_level == 1) { + DEBUG(1,("end[%d] tmp_highest_usn: %llu , highest_usn: %llu\n",y, + (long long)ctr1->new_highwatermark.tmp_highest_usn, + (long long)ctr1->new_highwatermark.highest_usn)); + + if (ctx->processing_fn) { + status = ctx->processing_fn(mem_ctx, + ctr1->first_object, + ctx); + if (!NT_STATUS_IS_OK(status)) { + goto out; + } + } + + if (ctr1->new_highwatermark.tmp_highest_usn > ctr1->new_highwatermark.highest_usn) { + req.req5.highwatermark = ctr1->new_highwatermark; + continue; + } + } + + if (level_out == 6) { + out_level = 6; + ctr6 = &ctr.ctr6; + } else if (level_out == 7 + && ctr.ctr7.level == 6 + && ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP) { + out_level = 6; + ctr6 = ctr.ctr7.ctr.mszip6.ctr6; + } + + if (out_level == 6) { + DEBUG(1,("end[%d] tmp_highest_usn: %llu , highest_usn: %llu\n",y, + (long long)ctr6->new_highwatermark.tmp_highest_usn, + (long long)ctr6->new_highwatermark.highest_usn)); + + if (ctx->processing_fn) { + status = ctx->processing_fn(mem_ctx, + ctr6->first_object, + ctx); + if (!NT_STATUS_IS_OK(status)) { + goto out; + } + } + + if (ctr6->new_highwatermark.tmp_highest_usn > ctr6->new_highwatermark.highest_usn) { + req.req8.highwatermark = ctr6->new_highwatermark; + continue; + } + } + + break; + } + + out: + return status; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS libnet_dssync(TALLOC_CTX *mem_ctx, + struct dssync_context *ctx) +{ + NTSTATUS status; + + status = libnet_dssync_init(mem_ctx, ctx); + if (!NT_STATUS_IS_OK(status)) { + goto out; + } + + status = libnet_dssync_process(mem_ctx, ctx); + if (!NT_STATUS_IS_OK(status)) { + goto out; + } + + out: + return status; +} -- cgit From 92bd665aea68ee8d198f72c95af5da487efcfc36 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 25 Jun 2008 00:21:37 +0200 Subject: rpc_client: let cli_get_session_key() return talloced session key. Thanks, Volker, for pointing this out. Guenther (This used to be commit b47899195e0c190445953243fe80da4e92994dd1) --- source3/libnet/libnet_dssync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 63a5c8bef1..b1392acd7e 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -268,7 +268,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, ctr1 = ctr.ctr2.ctr.mszip1.ctr1; } - status = cli_get_session_key(ctx->cli, &ctx->session_key); + status = cli_get_session_key(mem_ctx, ctx->cli, &ctx->session_key); if (!NT_STATUS_IS_OK(status)) { return status; } -- cgit From eb6903344c82c04ff01d55f1dcf289608cb95065 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 26 Jun 2008 10:22:40 +0200 Subject: net_vampire: add some error output to libnet_dssync. Guenther (This used to be commit 891d4cca0ca5ccb075940517af25f3760a315219) --- source3/libnet/libnet_dssync.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index b1392acd7e..0866db59bd 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -158,6 +158,9 @@ static NTSTATUS libnet_dssync_lookup_nc(TALLOC_CTX *mem_ctx, &ctr, &werr); if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to lookup DN for domain name: %s", + get_friendly_werror_msg(werr)); return status; } @@ -252,11 +255,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, &ctr, &werr); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to get NC Changes: %s", + get_friendly_werror_msg(werr)); goto out; } if (!W_ERROR_IS_OK(werr)) { + status = werror_to_ntstatus(werr); goto out; } @@ -270,6 +276,9 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, status = cli_get_session_key(mem_ctx, ctx->cli, &ctx->session_key); if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to get Session Key: %s", + nt_errstr(status)); return status; } @@ -283,6 +292,9 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, ctr1->first_object, ctx); if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to call processing function: %s", + nt_errstr(status)); goto out; } } @@ -313,6 +325,9 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, ctr6->first_object, ctx); if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to call processing function: %s", + nt_errstr(status)); goto out; } } -- cgit From a8b8994c2df9069c0776298592ef14fe476863f1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 26 Jun 2008 15:06:58 +0200 Subject: libnet_dssync: always decrypt attributes before passing them to the processing routine. Guenther (This used to be commit 6eedd167e77969e2ab7d5abe7311de62fc413d17) --- source3/libnet/libnet_dssync.c | 127 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 0866db59bd..ef6f161f34 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -59,6 +59,125 @@ NTSTATUS libnet_dssync_init_context(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ +static DATA_BLOB *decrypt_attr_val(TALLOC_CTX *mem_ctx, + DATA_BLOB *session_key, + uint32_t rid, + enum drsuapi_DsAttributeId id, + DATA_BLOB *raw_data) +{ + bool rcrypt = false; + DATA_BLOB out_data; + + ZERO_STRUCT(out_data); + + switch (id) { + case DRSUAPI_ATTRIBUTE_dBCSPwd: + case DRSUAPI_ATTRIBUTE_unicodePwd: + case DRSUAPI_ATTRIBUTE_ntPwdHistory: + case DRSUAPI_ATTRIBUTE_lmPwdHistory: + rcrypt = true; + break; + case DRSUAPI_ATTRIBUTE_supplementalCredentials: + case DRSUAPI_ATTRIBUTE_priorValue: + case DRSUAPI_ATTRIBUTE_currentValue: + case DRSUAPI_ATTRIBUTE_trustAuthOutgoing: + case DRSUAPI_ATTRIBUTE_trustAuthIncoming: + case DRSUAPI_ATTRIBUTE_initialAuthOutgoing: + case DRSUAPI_ATTRIBUTE_initialAuthIncoming: + break; + default: + return raw_data; + } + + out_data = decrypt_drsuapi_blob(mem_ctx, session_key, rcrypt, + rid, raw_data); + + if (out_data.length) { + return (DATA_BLOB *)talloc_memdup(mem_ctx, &out_data, sizeof(DATA_BLOB)); + } + + return raw_data; +} + +/**************************************************************** +****************************************************************/ + +static void parse_obj_identifier(struct drsuapi_DsReplicaObjectIdentifier *id, + uint32_t *rid) +{ + if (!id || !rid) { + return; + } + + *rid = 0; + + if (id->sid.num_auths > 0) { + *rid = id->sid.sub_auths[id->sid.num_auths - 1]; + } +} + +/**************************************************************** +****************************************************************/ + +static void parse_obj_attribute(TALLOC_CTX *mem_ctx, + DATA_BLOB *session_key, + uint32_t rid, + struct drsuapi_DsReplicaAttribute *attr) +{ + int i = 0; + + for (i=0; ivalue_ctr.num_values; i++) { + + DATA_BLOB *plain_data = NULL; + + plain_data = decrypt_attr_val(mem_ctx, + session_key, + rid, + attr->attid, + attr->value_ctr.values[i].blob); + + attr->value_ctr.values[i].blob = plain_data; + } +} + +/**************************************************************** +****************************************************************/ + +static void libnet_dssync_decrypt_attributes(TALLOC_CTX *mem_ctx, + DATA_BLOB *session_key, + struct drsuapi_DsReplicaObjectListItemEx *cur) +{ + for (; cur; cur = cur->next_object) { + + uint32_t i; + uint32_t rid = 0; + + parse_obj_identifier(cur->object.identifier, &rid); + + for (i=0; i < cur->object.attribute_ctr.num_attributes; i++) { + + struct drsuapi_DsReplicaAttribute *attr; + + attr = &cur->object.attribute_ctr.attributes[i]; + + if (attr->value_ctr.num_values < 1) { + continue; + } + + if (!attr->value_ctr.values[0].blob) { + continue; + } + + parse_obj_attribute(mem_ctx, + session_key, + rid, + attr); + } + } +} +/**************************************************************** +****************************************************************/ + static NTSTATUS libnet_dssync_bind(TALLOC_CTX *mem_ctx, struct dssync_context *ctx) { @@ -287,6 +406,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, (long long)ctr1->new_highwatermark.tmp_highest_usn, (long long)ctr1->new_highwatermark.highest_usn)); + libnet_dssync_decrypt_attributes(mem_ctx, + &ctx->session_key, + ctr1->first_object); + if (ctx->processing_fn) { status = ctx->processing_fn(mem_ctx, ctr1->first_object, @@ -320,6 +443,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, (long long)ctr6->new_highwatermark.tmp_highest_usn, (long long)ctr6->new_highwatermark.highest_usn)); + libnet_dssync_decrypt_attributes(mem_ctx, + &ctx->session_key, + ctr6->first_object); + if (ctx->processing_fn) { status = ctx->processing_fn(mem_ctx, ctr6->first_object, -- cgit From 31f1ad43114cca6684f59fdf93cd8230c5ca21b4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 26 Jun 2008 15:10:00 +0200 Subject: libnet_dssync: pass down drsuapi_DsReplicaOIDMapping_Ctr to callback. Guenther (This used to be commit cbff970facae295650742d12768f23c7f67380a6) --- source3/libnet/libnet_dssync.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index ef6f161f34..1fb30d796a 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -413,6 +413,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, if (ctx->processing_fn) { status = ctx->processing_fn(mem_ctx, ctr1->first_object, + &ctr1->mapping_ctr, ctx); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, @@ -450,6 +451,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, if (ctx->processing_fn) { status = ctx->processing_fn(mem_ctx, ctr6->first_object, + &ctr6->mapping_ctr, ctx); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, -- cgit From e58b2db024293b0d76441e19e0afd4734b550aa8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 26 Jun 2008 23:24:25 +0200 Subject: libnet_dssync: add output filename and dns_domain_name to dssync struct. Guenther (This used to be commit c16e1820f86f105853aa855eda322ba6cbff3a84) --- source3/libnet/libnet_dssync.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 1fb30d796a..b596da816a 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -298,6 +298,12 @@ static NTSTATUS libnet_dssync_lookup_nc(TALLOC_CTX *mem_ctx, ctx->nc_dn = talloc_strdup(mem_ctx, ctr.ctr1->array[0].result_name); NT_STATUS_HAVE_NO_MEMORY(ctx->nc_dn); + if (!ctx->dns_domain_name) { + ctx->dns_domain_name = talloc_strdup_upper(mem_ctx, + ctr.ctr1->array[0].dns_domain_name); + NT_STATUS_HAVE_NO_MEMORY(ctx->dns_domain_name); + } + return NT_STATUS_OK; } -- cgit From 46dd2d77ecad82bcc296a0023f344a40b8a9992f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 27 Jun 2008 01:41:26 +0200 Subject: libnet_dssync: add last_query flag to processing routine. Guenther (This used to be commit 22bdee7fe0cdcd95e0bade70cacb095e0b348abf) --- source3/libnet/libnet_dssync.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index b596da816a..87d5e8aade 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -366,6 +366,8 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, for (y=0; ;y++) { + bool last_query = true; + if (level == 8) { DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, (long long)req.req8.highwatermark.tmp_highest_usn, @@ -416,10 +418,16 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, &ctx->session_key, ctr1->first_object); + if (ctr1->new_highwatermark.tmp_highest_usn > ctr1->new_highwatermark.highest_usn) { + req.req5.highwatermark = ctr1->new_highwatermark; + last_query = false; + } + if (ctx->processing_fn) { status = ctx->processing_fn(mem_ctx, ctr1->first_object, &ctr1->mapping_ctr, + last_query, ctx); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, @@ -429,8 +437,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, } } - if (ctr1->new_highwatermark.tmp_highest_usn > ctr1->new_highwatermark.highest_usn) { - req.req5.highwatermark = ctr1->new_highwatermark; + if (!last_query) { continue; } } @@ -454,10 +461,16 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, &ctx->session_key, ctr6->first_object); + if (ctr6->new_highwatermark.tmp_highest_usn > ctr6->new_highwatermark.highest_usn) { + req.req8.highwatermark = ctr6->new_highwatermark; + last_query = false; + } + if (ctx->processing_fn) { status = ctx->processing_fn(mem_ctx, ctr6->first_object, &ctr6->mapping_ctr, + last_query, ctx); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, @@ -467,8 +480,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, } } - if (ctr6->new_highwatermark.tmp_highest_usn > ctr6->new_highwatermark.highest_usn) { - req.req8.highwatermark = ctr6->new_highwatermark; + if (!last_query) { continue; } } -- cgit From ddc0d9deb32082a5d8d591800d638d0e96fa6ff3 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Jul 2008 15:30:03 +0200 Subject: libnet_dssync: use ctr[1|6]->more_data metze (This used to be commit 6b7ddb6d664f5f3b62161cdb3abf12633b263a64) --- source3/libnet/libnet_dssync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 87d5e8aade..a251e418f9 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -418,7 +418,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, &ctx->session_key, ctr1->first_object); - if (ctr1->new_highwatermark.tmp_highest_usn > ctr1->new_highwatermark.highest_usn) { + if (ctr1->more_data) { req.req5.highwatermark = ctr1->new_highwatermark; last_query = false; } @@ -461,7 +461,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, &ctx->session_key, ctr6->first_object); - if (ctr6->new_highwatermark.tmp_highest_usn > ctr6->new_highwatermark.highest_usn) { + if (ctr6->more_data) { req.req8.highwatermark = ctr6->new_highwatermark; last_query = false; } -- cgit From 0bb7c0a5d92336e0fd1450e6e1b7ad8983ee36f4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jul 2008 01:03:57 +0200 Subject: dssync: fix missing prototype warning by including the proper header. Michael (This used to be commit 7d7b63e89bb2a067783362a24d81e44e0d67e2ec) --- source3/libnet/libnet_dssync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index a251e418f9..9abff69ae1 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -20,7 +20,7 @@ #include "includes.h" -#include "libnet/libnet_dssync.h" +#include "libnet/libnet.h" /**************************************************************** ****************************************************************/ -- cgit From 2bd58bf3839d9c8b04deb84bd8d5cdc2ad9e9d97 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 22 Jul 2008 16:18:03 +0200 Subject: Change occurrences of the u1 member of DsBindInfo* to pid after idl change. Michael (This used to be commit 42f3d681cac4a443347d1ed253848d45f8746f89) --- source3/libnet/libnet_dssync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 9abff69ae1..b55e6d1906 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -221,7 +221,7 @@ static NTSTATUS libnet_dssync_bind(TALLOC_CTX *mem_ctx, info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7; info28.supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT; info28.site_guid = GUID_zero(); - info28.u1 = 508; + info28.pid = 508; info28.repl_epoch = 0; bind_info.length = 28; -- cgit From 16c2190b149a2232aa49a16a41e570410edd2eaf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jul 2008 17:12:04 +0200 Subject: dssync: replace the processing_fn by startup/process/finish ops. This remove static a variable for the keytab context in the keytab processing function and simplifies the signature. The keytab context is instead in the new private data member of the dssync_context struct. This is in preparation of adding support for keeping track of the up-to-date-ness vector, in order to be able to sync diffs instead of the whole database. Michael (This used to be commit c51c3339f35e3bd921080d2e226e2422fc23e1e6) --- source3/libnet/libnet_dssync.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index b55e6d1906..f33369ee4b 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -355,6 +355,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, nc.guid = GUID_zero(); nc.sid = null_sid; + status = ctx->ops->startup(ctx, mem_ctx); + if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to call startup operation: %s", + nt_errstr(status)); + goto out; + } + req.req8.naming_context = &nc; req.req8.replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP | @@ -423,12 +431,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, last_query = false; } - if (ctx->processing_fn) { - status = ctx->processing_fn(mem_ctx, - ctr1->first_object, - &ctr1->mapping_ctr, - last_query, - ctx); + if (ctx->ops->process_objects) { + status = ctx->ops->process_objects(ctx, mem_ctx, + ctr1->first_object, + &ctr1->mapping_ctr); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, "Failed to call processing function: %s", @@ -466,12 +472,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, last_query = false; } - if (ctx->processing_fn) { - status = ctx->processing_fn(mem_ctx, - ctr6->first_object, - &ctr6->mapping_ctr, - last_query, - ctx); + if (ctx->ops->process_objects) { + status = ctx->ops->process_objects(ctx, mem_ctx, + ctr6->first_object, + &ctr6->mapping_ctr); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, "Failed to call processing function: %s", @@ -485,6 +489,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, } } + status = ctx->ops->finish(ctx, mem_ctx); + if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to call finishing operation: %s", + nt_errstr(status)); + goto out; + } + break; } -- cgit From 0db26805da4f62c313237e762a81cebbe0f0357c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jul 2008 00:54:35 +0200 Subject: dssync keytab: add support for keeping track of the up-to-date-ness vector. The startup operation should get the old up-to-date-ness vector from the backend and the finish operation should store the new vector to the backend after replication. This adds the change of the signatures of the operations ot the dssync_ops struct and the implementation for the keytab ops. The up-to-date-ness vector is stored under the principal constructed as UTDV/$naming_context_dn@$dns_domain_name. The vector is still uninterpreted in libnet_dssync_process(). This will be the next step... This code is essentially by Metze. Michael (This used to be commit 01318fb27a1aa9e5fed0d4dd882a123ab568ac37) --- source3/libnet/libnet_dssync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index f33369ee4b..9801ec76d0 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -355,7 +355,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, nc.guid = GUID_zero(); nc.sid = null_sid; - status = ctx->ops->startup(ctx, mem_ctx); + status = ctx->ops->startup(ctx, mem_ctx, NULL); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, "Failed to call startup operation: %s", @@ -489,7 +489,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, } } - status = ctx->ops->finish(ctx, mem_ctx); + status = ctx->ops->finish(ctx, mem_ctx, NULL); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, "Failed to call finishing operation: %s", -- cgit From 0f98b9948389c6662d484646b4a2aeee199e9431 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jul 2008 13:04:04 +0200 Subject: dssync: record the bind info in the new remote_info28 in libnet_dssync_bind(). This extracts the info24 data in case this is what was returned (instead of info28). E.g. windows 2000 returns info24. Michael (This used to be commit 61b41aa615d5d46305653845584df7b1803f07ec) --- source3/libnet/libnet_dssync.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 9801ec76d0..35f420c901 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -241,6 +241,35 @@ static NTSTATUS libnet_dssync_bind(TALLOC_CTX *mem_ctx, return werror_to_ntstatus(werr); } + ZERO_STRUCT(ctx->remote_info28); + switch (bind_info.length) { + case 24: { + struct drsuapi_DsBindInfo24 *info24; + info24 = &bind_info.info.info24; + ctx->remote_info28.site_guid = info24->site_guid; + ctx->remote_info28.supported_extensions = info24->supported_extensions; + ctx->remote_info28.pid = info24->pid; + ctx->remote_info28.repl_epoch = 0; + break; + } + case 28: + ctx->remote_info28 = bind_info.info.info28; + break; + case 48: { + struct drsuapi_DsBindInfo48 *info48; + info48 = &bind_info.info.info48; + ctx->remote_info28.site_guid = info48->site_guid; + ctx->remote_info28.supported_extensions = info48->supported_extensions; + ctx->remote_info28.pid = info48->pid; + ctx->remote_info28.repl_epoch = info48->repl_epoch; + break; + } + default: + DEBUG(1, ("Warning: invalid info length in bind info: %d\n", + bind_info.length)); + break; + } + return status; } -- cgit From 26cceb81188f2fa59f13441ff982725dbf9f0539 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jul 2008 13:05:43 +0200 Subject: dssync: either use the req5 or the req8 request, depending on the supported_extenstion that have been recorded in the remote_info28 in the dssync_context. Michael (This used to be commit 3a2a69137e69c4bd0faa6af22d17e11dac022049) --- source3/libnet/libnet_dssync.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 35f420c901..1bec903427 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -376,6 +376,11 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL; int32_t out_level = 0; int y; + uint32_t replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE | + DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP | + DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS | + DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS | + DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED; ZERO_STRUCT(null_sid); ZERO_STRUCT(req); @@ -392,14 +397,21 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, goto out; } - req.req8.naming_context = &nc; - req.req8.replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE | - DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP | - DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS | - DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS | - DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED; - req.req8.max_object_count = 402; - req.req8.max_ndr_size = 402116; + if (ctx->remote_info28.supported_extensions + & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) + { + level = 8; + req.req8.naming_context = &nc; + req.req8.replica_flags = replica_flags; + req.req8.max_object_count = 402; + req.req8.max_ndr_size = 402116; + } else { + level = 5; + req.req5.naming_context = &nc; + req.req5.replica_flags = replica_flags; + req.req5.max_object_count = 402; + req.req5.max_ndr_size = 402116; + } for (y=0; ;y++) { @@ -409,6 +421,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, (long long)req.req8.highwatermark.tmp_highest_usn, (long long)req.req8.highwatermark.highest_usn)); + } else if (level == 5) { + DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, + (long long)req.req5.highwatermark.tmp_highest_usn, + (long long)req.req5.highwatermark.highest_usn)); } status = rpccli_drsuapi_DsGetNCChanges(ctx->cli, mem_ctx, -- cgit From 4d946b5932faa89cc1f48b1d13c4c8357e47d83e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jul 2008 01:05:06 +0200 Subject: dssync: pass uptodateness vector into and out of DsGetNCChanges request. Also store the new uptodateness vector in the backend after completion and retrieve the old vector before sending the DsGetNCChanges request. This effectively accomplishes differential replication. Michael (This used to be commit a2a88808df16d153f45337b740391d419d87e87a) --- source3/libnet/libnet_dssync.c | 44 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 1bec903427..54bdbb7b22 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -374,6 +374,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, struct drsuapi_DsGetNCChangesCtr1 *ctr1 = NULL; struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL; + struct replUpToDateVectorBlob *old_utdv = NULL; + struct drsuapi_DsReplicaCursorCtrEx cursors; + struct drsuapi_DsReplicaCursorCtrEx *pcursors = NULL; + struct replUpToDateVectorBlob new_utdv; int32_t out_level = 0; int y; uint32_t replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE | @@ -389,7 +393,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, nc.guid = GUID_zero(); nc.sid = null_sid; - status = ctx->ops->startup(ctx, mem_ctx, NULL); + status = ctx->ops->startup(ctx, mem_ctx, &old_utdv); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, "Failed to call startup operation: %s", @@ -397,6 +401,30 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, goto out; } + if (old_utdv) { + pcursors = &cursors; + ZERO_STRUCTP(pcursors); + + switch (old_utdv->version) { + case 1: + pcursors->count = old_utdv->ctr.ctr1.count; + pcursors->cursors = old_utdv->ctr.ctr1.cursors; + break; + case 2: + pcursors->count = old_utdv->ctr.ctr2.count; + pcursors->cursors = talloc_array(mem_ctx, + struct drsuapi_DsReplicaCursor, + pcursors->count); + for (y = 0; y < pcursors->count; y++) { + pcursors->cursors[y].source_dsa_invocation_id = + old_utdv->ctr.ctr2.cursors[y].source_dsa_invocation_id; + pcursors->cursors[y].highest_usn = + old_utdv->ctr.ctr2.cursors[y].highest_usn; + } + break; + } + } + if (ctx->remote_info28.supported_extensions & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) { @@ -405,12 +433,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, req.req8.replica_flags = replica_flags; req.req8.max_object_count = 402; req.req8.max_ndr_size = 402116; + req.req8.uptodateness_vector = pcursors; } else { level = 5; req.req5.naming_context = &nc; req.req5.replica_flags = replica_flags; req.req5.max_object_count = 402; req.req5.max_ndr_size = 402116; + req.req5.uptodateness_vector = pcursors; } for (y=0; ;y++) { @@ -491,6 +521,11 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, if (!last_query) { continue; } + + ZERO_STRUCT(new_utdv); + new_utdv.version = 1; + new_utdv.ctr.ctr1.count = ctr1->uptodateness_vector->count; + new_utdv.ctr.ctr1.cursors = ctr1->uptodateness_vector->cursors; } if (level_out == 6) { @@ -532,9 +567,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, if (!last_query) { continue; } + + ZERO_STRUCT(new_utdv); + new_utdv.version = 2; + new_utdv.ctr.ctr2.count = ctr6->uptodateness_vector->count; + new_utdv.ctr.ctr2.cursors = ctr6->uptodateness_vector->cursors; } - status = ctx->ops->finish(ctx, mem_ctx, NULL); + status = ctx->ops->finish(ctx, mem_ctx, &new_utdv); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, "Failed to call finishing operation: %s", -- cgit From d42160f9de385693f12c54bf6c53652e64d113cb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jul 2008 00:18:40 +0200 Subject: dssync: allow replications of a single obj with net rpc vampire keytab. This is triggered by setting the new "single" flag in the dssync_context and filling the "object_dn" member with the dn of the object to be fetched. This call is accomplished by specifying the DRSUAPI_EXOP_REPL_OBJ extended operation in the DsGetNCCHanges request. This variant does honor an up-to-date-ness vectore passed in, but the answer does not return a new up-to-dateness vector. Call this operation as "net rpc vampire keytab /path/keytab object_dn" . Michael (This used to be commit f4a01178a3d8d71f416a3b67ce6b872420f211c0) --- source3/libnet/libnet_dssync.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 54bdbb7b22..fa2bb2de14 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -378,6 +378,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, struct drsuapi_DsReplicaCursorCtrEx cursors; struct drsuapi_DsReplicaCursorCtrEx *pcursors = NULL; struct replUpToDateVectorBlob new_utdv; + struct replUpToDateVectorBlob *pnew_utdv = NULL; int32_t out_level = 0; int y; uint32_t replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE | @@ -389,10 +390,18 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, ZERO_STRUCT(null_sid); ZERO_STRUCT(req); - nc.dn = ctx->nc_dn; + if (ctx->single && ctx->object_dn) { + nc.dn = ctx->object_dn; + } else { + nc.dn = ctx->nc_dn; + } nc.guid = GUID_zero(); nc.sid = null_sid; + if (!ctx->single) { + pnew_utdv = &new_utdv; + } + status = ctx->ops->startup(ctx, mem_ctx, &old_utdv); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, @@ -434,6 +443,9 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, req.req8.max_object_count = 402; req.req8.max_ndr_size = 402116; req.req8.uptodateness_vector = pcursors; + if (ctx->single) { + req.req8.extended_op = DRSUAPI_EXOP_REPL_OBJ; + } } else { level = 5; req.req5.naming_context = &nc; @@ -441,6 +453,9 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, req.req5.max_object_count = 402; req.req5.max_ndr_size = 402116; req.req5.uptodateness_vector = pcursors; + if (ctx->single) { + req.req5.extended_op = DRSUAPI_EXOP_REPL_OBJ; + } } for (y=0; ;y++) { @@ -524,8 +539,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, ZERO_STRUCT(new_utdv); new_utdv.version = 1; - new_utdv.ctr.ctr1.count = ctr1->uptodateness_vector->count; - new_utdv.ctr.ctr1.cursors = ctr1->uptodateness_vector->cursors; + if (ctr1->uptodateness_vector) { + new_utdv.ctr.ctr1.count = ctr1->uptodateness_vector->count; + new_utdv.ctr.ctr1.cursors = ctr1->uptodateness_vector->cursors; + } } if (level_out == 6) { @@ -570,11 +587,13 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, ZERO_STRUCT(new_utdv); new_utdv.version = 2; - new_utdv.ctr.ctr2.count = ctr6->uptodateness_vector->count; - new_utdv.ctr.ctr2.cursors = ctr6->uptodateness_vector->cursors; + if (ctr6->uptodateness_vector) { + new_utdv.ctr.ctr2.count = ctr6->uptodateness_vector->count; + new_utdv.ctr.ctr2.cursors = ctr6->uptodateness_vector->cursors; + } } - status = ctx->ops->finish(ctx, mem_ctx, &new_utdv); + status = ctx->ops->finish(ctx, mem_ctx, pnew_utdv); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, "Failed to call finishing operation: %s", @@ -610,3 +629,4 @@ NTSTATUS libnet_dssync(TALLOC_CTX *mem_ctx, out: return status; } + -- cgit From c655e295efce4b3f637f1be2c1d79bf1c16bac7b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 29 Jul 2008 22:52:59 +0200 Subject: vampire keytab: add switch --repl-nodiff to trigger full replication. I.e. replication without keeping track of the up to date vector. Michael (This used to be commit d4b36e447bce8692416e132ab9f53a6282f54cac) --- source3/libnet/libnet_dssync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index fa2bb2de14..cb8fa80ffa 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -410,7 +410,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, goto out; } - if (old_utdv) { + if (!ctx->repl_nodiff && old_utdv) { pcursors = &cursors; ZERO_STRUCTP(pcursors); -- cgit From 58e0b8d56859ff179387025424af69f3fc3f61d8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 30 Jul 2008 10:27:00 +0200 Subject: libnet dssync: refactor creation of request out into new function libnet_dssync_build_request(). Michael (This used to be commit d745c1af405058ec23d7d0c139505576a99f9057) --- source3/libnet/libnet_dssync.c | 186 +++++++++++++++++++++++++++-------------- 1 file changed, 122 insertions(+), 64 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index cb8fa80ffa..b93f906de2 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -359,28 +359,21 @@ static NTSTATUS libnet_dssync_init(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ -static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, - struct dssync_context *ctx) +static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx, + struct dssync_context *ctx, + const char *dn, + struct replUpToDateVectorBlob *utdv, + int32_t level, + union drsuapi_DsGetNCChangesRequest *preq) { NTSTATUS status; - WERROR werr; - - int32_t level = 8; - int32_t level_out = 0; + uint32_t count; union drsuapi_DsGetNCChangesRequest req; - union drsuapi_DsGetNCChangesCtr ctr; - struct drsuapi_DsReplicaObjectIdentifier nc; struct dom_sid null_sid; + enum drsuapi_DsExtendedOperation extended_op; + struct drsuapi_DsReplicaObjectIdentifier *nc = NULL; + struct drsuapi_DsReplicaCursorCtrEx *cursors = NULL; - struct drsuapi_DsGetNCChangesCtr1 *ctr1 = NULL; - struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL; - struct replUpToDateVectorBlob *old_utdv = NULL; - struct drsuapi_DsReplicaCursorCtrEx cursors; - struct drsuapi_DsReplicaCursorCtrEx *pcursors = NULL; - struct replUpToDateVectorBlob new_utdv; - struct replUpToDateVectorBlob *pnew_utdv = NULL; - int32_t out_level = 0; - int y; uint32_t replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS | @@ -390,18 +383,104 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, ZERO_STRUCT(null_sid); ZERO_STRUCT(req); - if (ctx->single && ctx->object_dn) { - nc.dn = ctx->object_dn; + nc = TALLOC_ZERO_P(mem_ctx, struct drsuapi_DsReplicaObjectIdentifier); + if (!nc) { + status = NT_STATUS_NO_MEMORY; + goto fail; + } + nc->dn = dn; + nc->guid = GUID_zero(); + nc->sid = null_sid; + + if (!ctx->repl_nodiff && utdv) { + cursors = TALLOC_ZERO_P(mem_ctx, + struct drsuapi_DsReplicaCursorCtrEx); + if (!cursors) { + status = NT_STATUS_NO_MEMORY; + goto fail; + } + + switch (utdv->version) { + case 1: + cursors->count = utdv->ctr.ctr1.count; + cursors->cursors = utdv->ctr.ctr1.cursors; + break; + case 2: + cursors->count = utdv->ctr.ctr2.count; + cursors->cursors = talloc_array(cursors, + struct drsuapi_DsReplicaCursor, + cursors->count); + if (!cursors->cursors) { + status = NT_STATUS_NO_MEMORY; + goto fail; + } + for (count = 0; count < cursors->count; count++) { + cursors->cursors[count].source_dsa_invocation_id = + utdv->ctr.ctr2.cursors[count].source_dsa_invocation_id; + cursors->cursors[count].highest_usn = + utdv->ctr.ctr2.cursors[count].highest_usn; + } + break; + } + } + + if (ctx->single) { + extended_op = DRSUAPI_EXOP_REPL_OBJ; } else { - nc.dn = ctx->nc_dn; + extended_op = DRSUAPI_EXOP_NONE; } - nc.guid = GUID_zero(); - nc.sid = null_sid; - if (!ctx->single) { - pnew_utdv = &new_utdv; + if (level == 8) { + req.req8.naming_context = nc; + req.req8.replica_flags = replica_flags; + req.req8.max_object_count = 402; + req.req8.max_ndr_size = 402116; + req.req8.uptodateness_vector = cursors; + req.req8.extended_op = extended_op; + } else if (level == 5) { + req.req5.naming_context = nc; + req.req5.replica_flags = replica_flags; + req.req5.max_object_count = 402; + req.req5.max_ndr_size = 402116; + req.req5.uptodateness_vector = cursors; + req.req5.extended_op = extended_op; + } else { + status = NT_STATUS_INVALID_PARAMETER; + goto fail; } + if (preq) { + *preq = req; + } + + return NT_STATUS_OK; + +fail: + TALLOC_FREE(nc); + TALLOC_FREE(cursors); + return status; +} + +static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, + struct dssync_context *ctx) +{ + NTSTATUS status; + WERROR werr; + + int32_t level; + int32_t level_out = 0; + union drsuapi_DsGetNCChangesRequest req; + union drsuapi_DsGetNCChangesCtr ctr; + + struct drsuapi_DsGetNCChangesCtr1 *ctr1 = NULL; + struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL; + struct replUpToDateVectorBlob *old_utdv = NULL; + struct replUpToDateVectorBlob new_utdv; + struct replUpToDateVectorBlob *pnew_utdv = NULL; + int32_t out_level = 0; + int y; + const char *dn; + status = ctx->ops->startup(ctx, mem_ctx, &old_utdv); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, @@ -410,52 +489,31 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, goto out; } - if (!ctx->repl_nodiff && old_utdv) { - pcursors = &cursors; - ZERO_STRUCTP(pcursors); - - switch (old_utdv->version) { - case 1: - pcursors->count = old_utdv->ctr.ctr1.count; - pcursors->cursors = old_utdv->ctr.ctr1.cursors; - break; - case 2: - pcursors->count = old_utdv->ctr.ctr2.count; - pcursors->cursors = talloc_array(mem_ctx, - struct drsuapi_DsReplicaCursor, - pcursors->count); - for (y = 0; y < pcursors->count; y++) { - pcursors->cursors[y].source_dsa_invocation_id = - old_utdv->ctr.ctr2.cursors[y].source_dsa_invocation_id; - pcursors->cursors[y].highest_usn = - old_utdv->ctr.ctr2.cursors[y].highest_usn; - } - break; - } - } - if (ctx->remote_info28.supported_extensions & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) { level = 8; - req.req8.naming_context = &nc; - req.req8.replica_flags = replica_flags; - req.req8.max_object_count = 402; - req.req8.max_ndr_size = 402116; - req.req8.uptodateness_vector = pcursors; - if (ctx->single) { - req.req8.extended_op = DRSUAPI_EXOP_REPL_OBJ; - } } else { level = 5; - req.req5.naming_context = &nc; - req.req5.replica_flags = replica_flags; - req.req5.max_object_count = 402; - req.req5.max_ndr_size = 402116; - req.req5.uptodateness_vector = pcursors; - if (ctx->single) { - req.req5.extended_op = DRSUAPI_EXOP_REPL_OBJ; - } + } + + if (ctx->single && ctx->object_dn) { + dn = ctx->object_dn; + } else { + dn = ctx->nc_dn; + } + + status = libnet_dssync_build_request(mem_ctx, ctx, dn, old_utdv, level, + &req); + if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to build DsGetNCChanges request: %s", + nt_errstr(status)); + goto out; + } + + if (!ctx->single) { + pnew_utdv = &new_utdv; } for (y=0; ;y++) { -- cgit From 9e1eccc9112eb64cfd64781941811267a02866de Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 30 Jul 2008 12:00:49 +0200 Subject: libnet dssync: simplify logic of libnet_dssync_process() main loop. Untangle parsing of results and processing. Make loop logic more obvious. Call finishing operation after the loop, not inside. Michael (This used to be commit 47c8b3391cb1bb9656f93b55f9ea39c78b74ed36) --- source3/libnet/libnet_dssync.c | 147 ++++++++++++++++++----------------------- 1 file changed, 64 insertions(+), 83 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index b93f906de2..11ebf2ae3b 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -479,6 +479,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, struct replUpToDateVectorBlob *pnew_utdv = NULL; int32_t out_level = 0; int y; + bool last_query; const char *dn; status = ctx->ops->startup(ctx, mem_ctx, &old_utdv); @@ -512,13 +513,9 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, goto out; } - if (!ctx->single) { - pnew_utdv = &new_utdv; - } - - for (y=0; ;y++) { - - bool last_query = true; + for (y=0, last_query = false; !last_query; y++) { + struct drsuapi_DsReplicaObjectListItemEx *first_object; + struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr; if (level == 8) { DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, @@ -555,14 +552,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, } else if (level_out == 2) { out_level = 1; ctr1 = ctr.ctr2.ctr.mszip1.ctr1; - } - - status = cli_get_session_key(mem_ctx, ctx->cli, &ctx->session_key); - if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, - "Failed to get Session Key: %s", - nt_errstr(status)); - return status; + } else if (level_out == 6) { + out_level = 6; + ctr6 = &ctr.ctr6; + } else if (level_out == 7 + && ctr.ctr7.level == 6 + && ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP) { + out_level = 6; + ctr6 = ctr.ctr7.ctr.mszip6.ctr6; } if (out_level == 1) { @@ -570,96 +567,80 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, (long long)ctr1->new_highwatermark.tmp_highest_usn, (long long)ctr1->new_highwatermark.highest_usn)); - libnet_dssync_decrypt_attributes(mem_ctx, - &ctx->session_key, - ctr1->first_object); + first_object = ctr1->first_object; + mapping_ctr = &ctr1->mapping_ctr; if (ctr1->more_data) { req.req5.highwatermark = ctr1->new_highwatermark; - last_query = false; - } - - if (ctx->ops->process_objects) { - status = ctx->ops->process_objects(ctx, mem_ctx, - ctr1->first_object, - &ctr1->mapping_ctr); - if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, - "Failed to call processing function: %s", - nt_errstr(status)); - goto out; + } else { + last_query = true; + ZERO_STRUCT(new_utdv); + new_utdv.version = 1; + if (ctr1->uptodateness_vector) { + new_utdv.ctr.ctr1.count = + ctr1->uptodateness_vector->count; + new_utdv.ctr.ctr1.cursors = + ctr1->uptodateness_vector->cursors; } } - - if (!last_query) { - continue; - } - - ZERO_STRUCT(new_utdv); - new_utdv.version = 1; - if (ctr1->uptodateness_vector) { - new_utdv.ctr.ctr1.count = ctr1->uptodateness_vector->count; - new_utdv.ctr.ctr1.cursors = ctr1->uptodateness_vector->cursors; - } - } - - if (level_out == 6) { - out_level = 6; - ctr6 = &ctr.ctr6; - } else if (level_out == 7 - && ctr.ctr7.level == 6 - && ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP) { - out_level = 6; - ctr6 = ctr.ctr7.ctr.mszip6.ctr6; - } - - if (out_level == 6) { + } else if (out_level == 6) { DEBUG(1,("end[%d] tmp_highest_usn: %llu , highest_usn: %llu\n",y, (long long)ctr6->new_highwatermark.tmp_highest_usn, (long long)ctr6->new_highwatermark.highest_usn)); - libnet_dssync_decrypt_attributes(mem_ctx, - &ctx->session_key, - ctr6->first_object); + first_object = ctr6->first_object; + mapping_ctr = &ctr6->mapping_ctr; if (ctr6->more_data) { req.req8.highwatermark = ctr6->new_highwatermark; - last_query = false; - } - - if (ctx->ops->process_objects) { - status = ctx->ops->process_objects(ctx, mem_ctx, - ctr6->first_object, - &ctr6->mapping_ctr); - if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, - "Failed to call processing function: %s", - nt_errstr(status)); - goto out; + } else { + last_query = true; + ZERO_STRUCT(new_utdv); + new_utdv.version = 2; + if (ctr6->uptodateness_vector) { + new_utdv.ctr.ctr2.count = + ctr6->uptodateness_vector->count; + new_utdv.ctr.ctr2.cursors = + ctr6->uptodateness_vector->cursors; } } - - if (!last_query) { - continue; - } - - ZERO_STRUCT(new_utdv); - new_utdv.version = 2; - if (ctr6->uptodateness_vector) { - new_utdv.ctr.ctr2.count = ctr6->uptodateness_vector->count; - new_utdv.ctr.ctr2.cursors = ctr6->uptodateness_vector->cursors; - } } - status = ctx->ops->finish(ctx, mem_ctx, pnew_utdv); + status = cli_get_session_key(mem_ctx, ctx->cli, &ctx->session_key); if (!NT_STATUS_IS_OK(status)) { ctx->error_message = talloc_asprintf(mem_ctx, - "Failed to call finishing operation: %s", + "Failed to get Session Key: %s", nt_errstr(status)); goto out; } - break; + libnet_dssync_decrypt_attributes(mem_ctx, + &ctx->session_key, + first_object); + + if (ctx->ops->process_objects) { + status = ctx->ops->process_objects(ctx, mem_ctx, + first_object, + mapping_ctr); + if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to call processing function: %s", + nt_errstr(status)); + goto out; + } + } + } + + if (!ctx->single) { + pnew_utdv = &new_utdv; + } + + status = ctx->ops->finish(ctx, mem_ctx, pnew_utdv); + if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to call finishing operation: %s", + nt_errstr(status)); + goto out; } out: -- cgit From 0099c4b0c7500ee395802f099fb12db08eee9faf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 30 Jul 2008 12:31:38 +0200 Subject: libnet dssync: fix single object replication by adding one check. Before, this used the old uptodate vector in the request... Michael (This used to be commit 04fb9322d5f52d5cb3d9fe2a95dbfb2481ab7f9d) --- source3/libnet/libnet_dssync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 11ebf2ae3b..068491e6bb 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -392,7 +392,7 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx, nc->guid = GUID_zero(); nc->sid = null_sid; - if (!ctx->repl_nodiff && utdv) { + if (!ctx->single && !ctx->repl_nodiff && utdv) { cursors = TALLOC_ZERO_P(mem_ctx, struct drsuapi_DsReplicaCursorCtrEx); if (!cursors) { -- cgit From 89d817386c8fd1f92f490a844aa198af7fec12cb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 30 Jul 2008 12:32:30 +0200 Subject: libnet dssync: refactor dsgetncchanges loop out into libnet_dssync_getncchanges(). Michael (This used to be commit 93cda1aa0a627e81eff46547b247801aec2880a3) --- source3/libnet/libnet_dssync.c | 139 ++++++++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 59 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 068491e6bb..c829757a3d 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -461,56 +461,29 @@ fail: return status; } -static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, - struct dssync_context *ctx) +static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx, + struct dssync_context *ctx, + int32_t level, + union drsuapi_DsGetNCChangesRequest *req, + struct replUpToDateVectorBlob **pnew_utdv) { NTSTATUS status; WERROR werr; - - int32_t level; - int32_t level_out = 0; - union drsuapi_DsGetNCChangesRequest req; union drsuapi_DsGetNCChangesCtr ctr; - struct drsuapi_DsGetNCChangesCtr1 *ctr1 = NULL; struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL; - struct replUpToDateVectorBlob *old_utdv = NULL; - struct replUpToDateVectorBlob new_utdv; - struct replUpToDateVectorBlob *pnew_utdv = NULL; + struct replUpToDateVectorBlob *new_utdv = NULL; + int32_t level_out = 0; int32_t out_level = 0; int y; bool last_query; - const char *dn; - - status = ctx->ops->startup(ctx, mem_ctx, &old_utdv); - if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, - "Failed to call startup operation: %s", - nt_errstr(status)); - goto out; - } - - if (ctx->remote_info28.supported_extensions - & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) - { - level = 8; - } else { - level = 5; - } - - if (ctx->single && ctx->object_dn) { - dn = ctx->object_dn; - } else { - dn = ctx->nc_dn; - } - status = libnet_dssync_build_request(mem_ctx, ctx, dn, old_utdv, level, - &req); - if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, - "Failed to build DsGetNCChanges request: %s", - nt_errstr(status)); - goto out; + if (!ctx->single) { + new_utdv = TALLOC_ZERO_P(mem_ctx, struct replUpToDateVectorBlob); + if (!new_utdv) { + status = NT_STATUS_NO_MEMORY; + goto out; + } } for (y=0, last_query = false; !last_query; y++) { @@ -519,18 +492,18 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, if (level == 8) { DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, - (long long)req.req8.highwatermark.tmp_highest_usn, - (long long)req.req8.highwatermark.highest_usn)); + (long long)req->req8.highwatermark.tmp_highest_usn, + (long long)req->req8.highwatermark.highest_usn)); } else if (level == 5) { DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, - (long long)req.req5.highwatermark.tmp_highest_usn, - (long long)req.req5.highwatermark.highest_usn)); + (long long)req->req5.highwatermark.tmp_highest_usn, + (long long)req->req5.highwatermark.highest_usn)); } status = rpccli_drsuapi_DsGetNCChanges(ctx->cli, mem_ctx, &ctx->bind_handle, level, - &req, + req, &level_out, &ctr, &werr); @@ -571,15 +544,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, mapping_ctr = &ctr1->mapping_ctr; if (ctr1->more_data) { - req.req5.highwatermark = ctr1->new_highwatermark; + req->req5.highwatermark = ctr1->new_highwatermark; } else { last_query = true; - ZERO_STRUCT(new_utdv); - new_utdv.version = 1; - if (ctr1->uptodateness_vector) { - new_utdv.ctr.ctr1.count = + if (ctr1->uptodateness_vector && !ctx->single) { + new_utdv->version = 1; + new_utdv->ctr.ctr1.count = ctr1->uptodateness_vector->count; - new_utdv.ctr.ctr1.cursors = + new_utdv->ctr.ctr1.cursors = ctr1->uptodateness_vector->cursors; } } @@ -592,15 +564,14 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, mapping_ctr = &ctr6->mapping_ctr; if (ctr6->more_data) { - req.req8.highwatermark = ctr6->new_highwatermark; + req->req8.highwatermark = ctr6->new_highwatermark; } else { last_query = true; - ZERO_STRUCT(new_utdv); - new_utdv.version = 2; - if (ctr6->uptodateness_vector) { - new_utdv.ctr.ctr2.count = + if (ctr6->uptodateness_vector && !ctx->single) { + new_utdv->version = 2; + new_utdv->ctr.ctr2.count = ctr6->uptodateness_vector->count; - new_utdv.ctr.ctr2.cursors = + new_utdv->ctr.ctr2.cursors = ctr6->uptodateness_vector->cursors; } } @@ -631,8 +602,58 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, } } - if (!ctx->single) { - pnew_utdv = &new_utdv; + *pnew_utdv = new_utdv; + +out: + return status; +} + +static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, + struct dssync_context *ctx) +{ + NTSTATUS status; + + int32_t level; + union drsuapi_DsGetNCChangesRequest req; + struct replUpToDateVectorBlob *old_utdv = NULL; + struct replUpToDateVectorBlob *pnew_utdv = NULL; + const char *dn; + + status = ctx->ops->startup(ctx, mem_ctx, &old_utdv); + if (!NT_STATUS_IS_OK(status)) { + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to call startup operation: %s", + nt_errstr(status)); + goto out; + } + + if (ctx->remote_info28.supported_extensions + & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) + { + level = 8; + } else { + level = 5; + } + + if (ctx->single && ctx->object_dn) { + dn = ctx->object_dn; + } else { + dn = ctx->nc_dn; + } + + status = libnet_dssync_build_request(mem_ctx, ctx, dn, 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 = ctx->ops->finish(ctx, mem_ctx, pnew_utdv); -- cgit From ab5a6712b6cc83716ad73d99d3235ecafa8d5717 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 30 Jul 2008 12:35:45 +0200 Subject: libnet dssync: move determination of request level into build_request() ...where it belongs. Michael (This used to be commit 012b33f1c52df086e4f20e7494248d98fbced76a) --- source3/libnet/libnet_dssync.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index c829757a3d..f8e31e87a6 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -363,11 +363,12 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx, struct dssync_context *ctx, const char *dn, struct replUpToDateVectorBlob *utdv, - int32_t level, + int32_t *plevel, union drsuapi_DsGetNCChangesRequest *preq) { NTSTATUS status; uint32_t count; + int32_t level; union drsuapi_DsGetNCChangesRequest req; struct dom_sid null_sid; enum drsuapi_DsExtendedOperation extended_op; @@ -383,6 +384,14 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx, ZERO_STRUCT(null_sid); ZERO_STRUCT(req); + if (ctx->remote_info28.supported_extensions + & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) + { + level = 8; + } else { + level = 5; + } + nc = TALLOC_ZERO_P(mem_ctx, struct drsuapi_DsReplicaObjectIdentifier); if (!nc) { status = NT_STATUS_NO_MEMORY; @@ -449,6 +458,10 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx, goto fail; } + if (plevel) { + *plevel = level; + } + if (preq) { *preq = req; } @@ -627,21 +640,13 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, goto out; } - if (ctx->remote_info28.supported_extensions - & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) - { - level = 8; - } else { - level = 5; - } - if (ctx->single && ctx->object_dn) { dn = ctx->object_dn; } else { dn = ctx->nc_dn; } - status = libnet_dssync_build_request(mem_ctx, ctx, dn, old_utdv, level, + status = libnet_dssync_build_request(mem_ctx, ctx, dn, old_utdv, &level, &req); if (!NT_STATUS_IS_OK(status)) { goto out; -- cgit From f060b744efe6af1ad1a21e9e155b30eab502f81a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 30 Jul 2008 13:02:36 +0200 Subject: 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) --- source3/libnet/libnet_dssync.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') 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); -- cgit From 072bd871946134b3c5e57809b4831ed6fe5586b2 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 30 Jul 2008 17:44:22 +0200 Subject: libnet dssync: rename repl_nodiff flag to force_full_replication. Michael (This used to be commit ec959b4609c3f4927a9f2811c46d738f9c78a914) --- source3/libnet/libnet_dssync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index f3b2363824..8f13cc8e24 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -401,7 +401,7 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx, nc->guid = GUID_zero(); nc->sid = null_sid; - if (!ctx->single && !ctx->repl_nodiff && utdv) { + if (!ctx->single && !ctx->force_full_replication && utdv) { cursors = TALLOC_ZERO_P(mem_ctx, struct drsuapi_DsReplicaCursorCtrEx); if (!cursors) { -- cgit From 9d12511e45a48eae0064c35501402aa0572261d7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 30 Jul 2008 17:53:28 +0200 Subject: libnet dssync: rename flag single to single_object_replication So that it is more obvious what this controls. Michael (This used to be commit 2360f0a19f0fb89798b814a02cfca335a4a35b6d) --- source3/libnet/libnet_dssync.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 8f13cc8e24..f1a98f67d3 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -401,7 +401,9 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx, nc->guid = GUID_zero(); nc->sid = null_sid; - if (!ctx->single && !ctx->force_full_replication && utdv) { + if (!ctx->single_object_replication && + !ctx->force_full_replication && utdv) + { cursors = TALLOC_ZERO_P(mem_ctx, struct drsuapi_DsReplicaCursorCtrEx); if (!cursors) { @@ -433,7 +435,7 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx, } } - if (ctx->single) { + if (ctx->single_object_replication) { extended_op = DRSUAPI_EXOP_REPL_OBJ; } else { extended_op = DRSUAPI_EXOP_NONE; @@ -491,7 +493,7 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx, int y; bool last_query; - if (!ctx->single) { + if (!ctx->single_object_replication) { new_utdv = TALLOC_ZERO_P(mem_ctx, struct replUpToDateVectorBlob); if (!new_utdv) { status = NT_STATUS_NO_MEMORY; @@ -560,7 +562,9 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx, req->req5.highwatermark = ctr1->new_highwatermark; } else { last_query = true; - if (ctr1->uptodateness_vector && !ctx->single) { + if (ctr1->uptodateness_vector && + !ctx->single_object_replication) + { new_utdv->version = 1; new_utdv->ctr.ctr1.count = ctr1->uptodateness_vector->count; @@ -580,7 +584,9 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx, req->req8.highwatermark = ctr6->new_highwatermark; } else { last_query = true; - if (ctr6->uptodateness_vector && !ctx->single) { + if (ctr6->uptodateness_vector && + !ctx->single_object_replication) + { new_utdv->version = 2; new_utdv->ctr.ctr2.count = ctr6->uptodateness_vector->count; @@ -642,7 +648,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, goto out; } - if (ctx->single && ctx->object_dns) { + if (ctx->single_object_replication && ctx->object_dns) { dns = ctx->object_dns; dn_count = ctx->object_count; } else { -- cgit From 10225fbef737217d3e1b88bdfcbf4e62dff3cadd Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 1 Aug 2008 00:09:28 +0200 Subject: dssync: add clean_old_entries flag to dssync_ctx. Initialize it to false. And pass it down to the libnet_keytab context in libnet_dssync_keytab.c:keytab_startup(). Unused yet. Michael Note: This might not be not 100% clean design to put this into the toplevel dssync context while it is keytab specific. But then, on the other hand, other imaginable backends might want to use this flag, too... (This used to be commit 12e884f227e240860e49f9e41d8c1f45e10ad3be) --- source3/libnet/libnet_dssync.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index f1a98f67d3..92000b432b 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -50,6 +50,7 @@ NTSTATUS libnet_dssync_init_context(TALLOC_CTX *mem_ctx, NT_STATUS_HAVE_NO_MEMORY(ctx); talloc_set_destructor(ctx, libnet_dssync_free_context); + ctx->clean_old_entries = false; *ctx_p = ctx; -- cgit From a5d4b540e27bc716efa2f72a6013ab841eeca140 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 1 Aug 2008 14:26:46 +0200 Subject: libnet dssync: add my C after dssync keytab changes. Michael (This used to be commit 9391aec8d4600c685b14d3cd1624f8758f2cc80d) --- source3/libnet/libnet_dssync.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 92000b432b..e03a6023c9 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -3,6 +3,7 @@ Copyright (C) Stefan (metze) Metzmacher 2005 Copyright (C) Guenther Deschner 2008 + Copyright (C) Michael Adam 2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit From 84ee630ee973189ca9f2ce2afe4987998aaeccc7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 1 Aug 2008 17:10:59 +0200 Subject: libnet dssync: fix memory allocation for error/result messages. Use the libnet_dssync_context as a talloc context for the result_message and error_message string members. Using the passed in mem_ctx makes the implicit assumption that mem_ctx is at least as long-lived as the libnet_dssync_context, which is wrong. Michael (This used to be commit 635baf6b7d2a1822ceb48aa4bc47569ef19d51cc) --- source3/libnet/libnet_dssync.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index e03a6023c9..3641505d99 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -308,7 +308,7 @@ static NTSTATUS libnet_dssync_lookup_nc(TALLOC_CTX *mem_ctx, &ctr, &werr); if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, + ctx->error_message = talloc_asprintf(ctx, "Failed to lookup DN for domain name: %s", get_friendly_werror_msg(werr)); return status; @@ -525,7 +525,7 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx, &ctr, &werr); if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, + ctx->error_message = talloc_asprintf(ctx, "Failed to get NC Changes: %s", get_friendly_werror_msg(werr)); goto out; @@ -600,7 +600,7 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx, status = cli_get_session_key(mem_ctx, ctx->cli, &ctx->session_key); if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, + ctx->error_message = talloc_asprintf(ctx, "Failed to get Session Key: %s", nt_errstr(status)); goto out; @@ -615,7 +615,7 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx, first_object, mapping_ctr); if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, + ctx->error_message = talloc_asprintf(ctx, "Failed to call processing function: %s", nt_errstr(status)); goto out; @@ -644,7 +644,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, status = ctx->ops->startup(ctx, mem_ctx, &old_utdv); if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, + ctx->error_message = talloc_asprintf(ctx, "Failed to call startup operation: %s", nt_errstr(status)); goto out; @@ -670,7 +670,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, status = libnet_dssync_getncchanges(mem_ctx, ctx, level, &req, &pnew_utdv); if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, + ctx->error_message = talloc_asprintf(ctx, "Failed to call DsGetNCCHanges: %s", nt_errstr(status)); goto out; @@ -679,7 +679,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, status = ctx->ops->finish(ctx, mem_ctx, pnew_utdv); if (!NT_STATUS_IS_OK(status)) { - ctx->error_message = talloc_asprintf(mem_ctx, + ctx->error_message = talloc_asprintf(ctx, "Failed to call finishing operation: %s", nt_errstr(status)); goto out; -- cgit From 87c7496761f2f165df5fafcf860c3d3f8285cee8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 1 Aug 2008 17:13:42 +0200 Subject: libnet dssync: start memory allocation cleanup: use tmp ctx in libnet_dssync(). Don't leak temporary data to callers but use a temporary context that is freed at the end. Michael (This used to be commit 2d98ad57f56ddd4318bc721929a3ca9ede189a25) --- source3/libnet/libnet_dssync.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 3641505d99..684a2cc63b 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -696,18 +696,25 @@ NTSTATUS libnet_dssync(TALLOC_CTX *mem_ctx, struct dssync_context *ctx) { NTSTATUS status; + TALLOC_CTX *tmp_ctx; - status = libnet_dssync_init(mem_ctx, ctx); + tmp_ctx = talloc_new(mem_ctx); + if (!tmp_ctx) { + return NT_STATUS_NO_MEMORY; + } + + status = libnet_dssync_init(tmp_ctx, ctx); if (!NT_STATUS_IS_OK(status)) { goto out; } - status = libnet_dssync_process(mem_ctx, ctx); + status = libnet_dssync_process(tmp_ctx, ctx); if (!NT_STATUS_IS_OK(status)) { goto out; } out: + TALLOC_FREE(tmp_ctx); return status; } -- cgit From 3907392459533832ada823e614154951365348ee Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 7 Aug 2008 17:49:19 -0700 Subject: Fix "might be used uninitialized" warnings. Jeremy. (This used to be commit 5abd12eec1c9b6d30af5ec1ba16c0922e78d5bea) --- source3/libnet/libnet_dssync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/libnet/libnet_dssync.c') diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 684a2cc63b..bae03effed 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -504,8 +504,8 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx, } for (y=0, last_query = false; !last_query; y++) { - struct drsuapi_DsReplicaObjectListItemEx *first_object; - struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr; + struct drsuapi_DsReplicaObjectListItemEx *first_object = NULL; + struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr = NULL; if (level == 8) { DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, @@ -634,7 +634,7 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx, { NTSTATUS status; - int32_t level; + int32_t level = 0; union drsuapi_DsGetNCChangesRequest req; struct replUpToDateVectorBlob *old_utdv = NULL; struct replUpToDateVectorBlob *pnew_utdv = NULL; -- cgit