1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

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 <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Tim Beale 2017-09-28 15:09:34 +13:00 committed by Andrew Bartlett
parent cef17ce4f0
commit 4cb260f8c0
2 changed files with 5 additions and 7 deletions

View File

@ -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\)

View File

@ -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;
/*