s4-drs: return objects with uSN > highest_usn
authorAndrew Tridgell <tridge@samba.org>
Sat, 12 Sep 2009 02:42:40 +0000 (12:42 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 12 Sep 2009 02:42:40 +0000 (12:42 +1000)
When the client tells us the highest_usn they have is N, then we want
to send them objects with usn>N, not>=N, as otherwise we end up
sending them the same object (the one with the highest uSN) again and
again.

source4/rpc_server/drsuapi/getncchanges.c

index 7183b2f45bf0927ee31e3f4fdb6f87039f85b617..4cd71addf0433fd27a39871a05f6ba328b69b05f 100644 (file)
@@ -316,7 +316,7 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
        ret = drsuapi_search_with_extended_dn(sam_ctx, mem_ctx, &site_res,
                                              ncRoot_dn, LDB_SCOPE_SUBTREE, attrs,
                                              "uSNChanged>=%llu", 
-                                             (unsigned long long)r->in.req->req8.highwatermark.highest_usn);
+                                             (unsigned long long)(r->in.req->req8.highwatermark.highest_usn+1));
        if (ret != LDB_SUCCESS) {
                return WERR_DS_DRA_INTERNAL_ERROR;
        }
@@ -391,8 +391,12 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
 
 
        DEBUG(4,("DsGetNCChanges with uSNChanged >= %llu on %s gave %u objects\n", 
-                (unsigned long long)r->in.req->req8.highwatermark.highest_usn,
+                (unsigned long long)(r->in.req->req8.highwatermark.highest_usn+1),
                 ncRoot->dn, r->out.ctr->ctr6.object_count));
 
+       if (r->out.ctr->ctr6.object_count <= 10 && DEBUGLVL(6)) {
+               NDR_PRINT_FUNCTION_DEBUG(drsuapi_DsGetNCChanges, NDR_IN|NDR_OUT, r);
+       }
+
        return WERR_OK;
 }