From: Stefan Metzmacher Date: Tue, 29 Nov 2016 12:23:23 +0000 (+0100) Subject: getncchanges: only set nc_{object,linked_attributes}_count with DRSUAPI_DRS_GET_NC_SIZE X-Git-Tag: talloc-2.1.9~272 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e935a04afb017ff52b6caf9bfa66888ab541c894;p=thirdparty%2Fsamba.git getncchanges: only set nc_{object,linked_attributes}_count with DRSUAPI_DRS_GET_NC_SIZE The main change is that we return 0 values if DRSUAPI_DRS_GET_NC_SIZE is not present in order to get the same result as a Windows server in that case. If DRSUAPI_DRS_GET_NC_SIZE is return the number of links we found so far during the cycle in addition the number of objects returned in this cycle. Both values doesn't match what Windows returns, but doing that correctly and efficient is a task for another day. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- diff --git a/selftest/knownfail b/selftest/knownfail index b453b9c820b..d96e238796c 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -312,5 +312,3 @@ ^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_add_duplicate_different_type.* ^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_rank_none.* ^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_security_descriptor.* -# nc_object_count is updated without GET_NC_SIZE -^samba4.drs.getnc_exop.python.*getnc_exop.DrsReplicaSyncTestCase.test_link_utdv_hwm.* diff --git a/source4/rpc_server/drsuapi/getncchanges.c b/source4/rpc_server/drsuapi/getncchanges.c index 705c8cfd89f..c8f2e91911f 100644 --- a/source4/rpc_server/drsuapi/getncchanges.c +++ b/source4/rpc_server/drsuapi/getncchanges.c @@ -2305,8 +2305,6 @@ allowed: getnc_state->num_processed = i; - r->out.ctr->ctr6.nc_object_count = getnc_state->num_records; - /* the client can us to call UpdateRefs on its behalf to re-establish monitoring of the NC */ if ((req10->replica_flags & (DRSUAPI_DRS_ADD_REF | DRSUAPI_DRS_REF_GCSPN)) && @@ -2435,6 +2433,22 @@ allowed: } } + if (req10->replica_flags & DRSUAPI_DRS_GET_NC_SIZE) { + /* + * TODO: This implementation is wrong + * we should find out the total number of + * objects and links in the whole naming context + * at the start of the cycle and return these + * values in each message. + * + * For now we keep our current strategy and return + * the number of objects for this cycle and the number + * of links we found so far during the cycle. + */ + r->out.ctr->ctr6.nc_object_count = getnc_state->num_records; + r->out.ctr->ctr6.nc_linked_attributes_count = getnc_state->la_count; + } + if (!r->out.ctr->ctr6.more_data) { talloc_steal(mem_ctx, getnc_state->la_list);