s4-rpc_server/drsupai: Avoid looping with Azure AD Connect by not incrementing temp_h...
commitfd2fdecdec0b0eef03ac67fcb05faa675566beb6
authorAndrew Bartlett <abartlet@samba.org>
Wed, 26 Jul 2023 02:27:16 +0000 (26 14:27 +1200)
committerJule Anger <janger@samba.org>
Fri, 18 Aug 2023 10:33:44 +0000 (18 10:33 +0000)
tree56aafa8b83e0b70b5f2cf7b9e11b191bd356b4bc
parent7310afa34df397736c900aed04996f84b752dd1f
s4-rpc_server/drsupai: Avoid looping with Azure AD Connect by not incrementing temp_highest_usn for the NC root

We send the NC root first, as a special case for every chunk
that we send until the natural point where it belongs.

We do not bump the tmp_highest_usn in the highwatermark that
the client and server use (it is meant to be an opauqe cookie)
until the 'natural' point where the object appears, similar
to the cache for GET_ANC.

The issue is that without this, because the NC root was sorted
first in whatever chunk it appeared in but could have a 'high'
highwatermark, Azure AD Connect will send back the same
new_highwatermark->tmp_highest_usn, and due to a bug,
a zero reserved_usn, which makes Samba discard it.

The reserved_usn is now much less likely to ever be set because
the tmp_higest_usn is now always advancing.

RN: Avoid infinite loop in initial user sync with Azure AD Connect
 when synchronising a large Samba AD domain.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15401

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 79ca6ef28a6f94965cb030c4a7da8c1b9db7150b)

Autobuild-User(v4-19-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-19-test): Fri Aug 18 10:33:44 UTC 2023 on atb-devel-224
selftest/knownfail.d/getncchanges
source4/rpc_server/drsuapi/getncchanges.c