drs_utils: Avoid invalid dereference of v8 requests

Enterprise / Samba - Tim Beale [catalyst.net.nz] - 6 November 2018 06:15 EST

req.more_flags only exists for v10 requests, so we throw an exception if we try to dereference that field on a v8 (or v5) request. Unfortunately, we were checking that we support v10 *after* we had tried to access the more_flags. This patch fixes up the order of the checks.

This may be a problem trying to replicate with an older Windows DC (pre-2008R2), and was reported on the samba mailing-list at one point: https://lists.samba.org/archive/samba/2018-June/216541.html

Unfortunately this patch doesn't help the overall situation at all (the join will fail because we can't resolve the link target and we can't use GET_TGT). But it now gives you a more meaningful error, i.e.

ERROR(runtime): uncaught exception - (8639, "Failed to process 'chunk' of DRS replicated objects: DOS code 0x000021bf" instead of: ERROR(): uncaught exception -'drsuapi.DsGetNCChangesRequest8' object has no attribute 'more_flags'

2229f4620d5 drs_utils: Avoid invalid dereference of v8 requests
python/samba/drs_utils.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Upstream: gitweb.samba.org

  • Share