From 4cb260f8c06edd3ab1f9a52867fc4d8124ebb0b5 Mon Sep 17 00:00:00 2001 From: Tim Beale Date: Thu, 28 Sep 2017 15:09:34 +1300 Subject: [PATCH] replmd: Fix RMD_VERSION inital value to match Windows The initial value for RMD_VERSION is one on Windows. The MS-DRSR spec states the following in section 5.11 AttributeStamp: dwVersion: A 32-bit integer. Set to 1 when a value for the attribute is set for the first time. On each subsequent originating update, if the current value of dwVersion is less than 0xFFFFFFFF, then increment it by 1; otherwise set it to 0 BUG: https://bugzilla.samba.org/show_bug.cgi?id=13059 Signed-off-by: Tim Beale Reviewed-by: Garming Sam Reviewed-by: Andrew Bartlett --- selftest/knownfail.d/link_conflicts | 5 ----- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 7 +++++-- 2 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 selftest/knownfail.d/link_conflicts diff --git a/selftest/knownfail.d/link_conflicts b/selftest/knownfail.d/link_conflicts deleted file mode 100644 index 8c1c94f0eb5..00000000000 --- a/selftest/knownfail.d/link_conflicts +++ /dev/null @@ -1,5 +0,0 @@ -# Samba starts its RMD_VERSION from zero. Windows starts from one. -samba4.drs.link_conflicts.python\(vampire_dc\).link_conflicts.DrsReplicaLinkConflictTestCase.test_link_attr_version\(vampire_dc\) -samba4.drs.link_conflicts.python\(promoted_dc\).link_conflicts.DrsReplicaLinkConflictTestCase.test_link_attr_version\(promoted_dc\) - - diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index f4cad0d074f..4737222bcbc 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -54,6 +54,9 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_DRS_REPL +/* the RMD_VERSION for linked attributes starts from 1 */ +#define RMD_VERSION_INITIAL 1 + /* * It's 29/12/9999 at 23:59:59 UTC as specified in MS-ADTS 7.1.1.4.2 * Deleted Objects Container @@ -2150,7 +2153,7 @@ static int replmd_build_la_val(TALLOC_CTX *mem_ctx, struct ldb_val *v, struct ds int ret; const char *dnstring; char *vstring; - uint32_t version = 0; + uint32_t version = RMD_VERSION_INITIAL; uint32_t rmd_flags = 0; tstring = talloc_asprintf(mem_ctx, "%llu", (unsigned long long)nttime); @@ -2397,7 +2400,7 @@ static int replmd_update_la_val(TALLOC_CTX *mem_ctx, struct ldb_val *v, struct d bool deleted) { uint32_t old_version; - uint32_t version = 0; + uint32_t version = RMD_VERSION_INITIAL; NTSTATUS status; /*