dssync: either use the req5 or the req8 request, depending on the supported_extenstion
authorMichael Adam <obnox@samba.org>
Thu, 17 Jul 2008 11:05:43 +0000 (13:05 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 1 Aug 2008 14:04:41 +0000 (16:04 +0200)
that have been recorded in the remote_info28 in the dssync_context.

Michael
(This used to be commit 3a2a69137e69c4bd0faa6af22d17e11dac022049)

source3/libnet/libnet_dssync.c

index 35f420c9016c956bdefcb4eb16dd9abaf36eaccf..1bec9034275b08ffa7b78db4b20e68956c614418 100644 (file)
@@ -376,6 +376,11 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx,
        struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL;
        int32_t out_level = 0;
        int y;
+       uint32_t replica_flags  = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE |
+                                 DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP |
+                                 DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS |
+                                 DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS |
+                                 DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED;
 
        ZERO_STRUCT(null_sid);
        ZERO_STRUCT(req);
@@ -392,14 +397,21 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx,
                goto out;
        }
 
-       req.req8.naming_context         = &nc;
-       req.req8.replica_flags          = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE |
-                                         DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP |
-                                         DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS |
-                                         DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS |
-                                         DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED;
-       req.req8.max_object_count       = 402;
-       req.req8.max_ndr_size           = 402116;
+       if (ctx->remote_info28.supported_extensions
+           & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8)
+       {
+               level = 8;
+               req.req8.naming_context         = &nc;
+               req.req8.replica_flags          = replica_flags;
+               req.req8.max_object_count       = 402;
+               req.req8.max_ndr_size           = 402116;
+       } else {
+               level = 5;
+               req.req5.naming_context         = &nc;
+               req.req5.replica_flags          = replica_flags;
+               req.req5.max_object_count       = 402;
+               req.req5.max_ndr_size           = 402116;
+       }
 
        for (y=0; ;y++) {
 
@@ -409,6 +421,10 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx,
                        DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y,
                                (long long)req.req8.highwatermark.tmp_highest_usn,
                                (long long)req.req8.highwatermark.highest_usn));
+               } else if (level == 5) {
+                       DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y,
+                               (long long)req.req5.highwatermark.tmp_highest_usn,
+                               (long long)req.req5.highwatermark.highest_usn));
                }
 
                status = rpccli_drsuapi_DsGetNCChanges(ctx->cli, mem_ctx,