From: Jennifer Sutton Date: Thu, 29 Aug 2024 01:37:05 +0000 (+1200) Subject: python: Simplify GetNCChanges call setup X-Git-Tag: tevent-0.17.0~136 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6fa5aff8466c227cd8a30de1b7ed034da2cf1dd7;p=thirdparty%2Fsamba.git python: Simplify GetNCChanges call setup BUG: https://bugzilla.samba.org/show_bug.cgi?id=15852 Signed-off-by: Jennifer Sutton Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/drs_utils.py b/python/samba/drs_utils.py index 8fac14e78af..92fc32485ba 100644 --- a/python/samba/drs_utils.py +++ b/python/samba/drs_utils.py @@ -260,12 +260,15 @@ class drs_Replicate(object): # setup for a GetNCChanges call if self.supports_ext & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10: + req_level = 10 req = drsuapi.DsGetNCChangesRequest10() req.more_flags = self.more_flags - req_level = 10 - else: + elif self.supports_ext & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8: req_level = 8 req = drsuapi.DsGetNCChangesRequest8() + else: + req_level = 5 + req = drsuapi.DsGetNCChangesRequest5() req.destination_dsa_guid = destination_dsa_guid req.source_dsa_invocation_id = source_dsa_invocation_id @@ -330,22 +333,10 @@ class drs_Replicate(object): req.max_ndr_size = 402116 req.extended_op = exop req.fsmo_info = 0 - req.partial_attribute_set = None - req.partial_attribute_set_ex = None - req.mapping_ctr.num_mappings = 0 - req.mapping_ctr.mappings = None - if not schema and rodc: + if hasattr(req, "partial_attribute_set") and not schema and rodc: req.partial_attribute_set = drs_get_rodc_partial_attribute_set(self.samdb) - if not self.supports_ext & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8: - req_level = 5 - req5 = drsuapi.DsGetNCChangesRequest5() - for a in dir(req5): - if a[0] != '_': - setattr(req5, a, getattr(req, a)) - req = req5 - num_objects = 0 num_links = 0 first_chunk = True