s4-rpc_server/drsupai: Avoid looping with Azure AD Connect by not incrementing temp_h...
authorAndrew Bartlett <abartlet@samba.org>
Wed, 26 Jul 2023 02:27:16 +0000 (14:27 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 13 Aug 2023 21:59:29 +0000 (21:59 +0000)
commit79ca6ef28a6f94965cb030c4a7da8c1b9db7150b
treea106286c482b4444c43097b3a9756aa6e538a092
parent17359afa627a3086ec8d6862f007a3479574a8b4
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.

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>
selftest/knownfail.d/getncchanges
source4/rpc_server/drsuapi/getncchanges.c