]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libnet dssync: move determination of request level into build_request()
authorMichael Adam <obnox@samba.org>
Wed, 30 Jul 2008 10:35:45 +0000 (12:35 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 1 Aug 2008 14:07:04 +0000 (16:07 +0200)
...where it belongs.

Michael

source/libnet/libnet_dssync.c

index c829757a3d465e08019f36a38b3b84d09df0ec95..f8e31e87a67097ab1bde542163c45249f61da778 100644 (file)
@@ -363,11 +363,12 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx,
                                            struct dssync_context *ctx,
                                            const char *dn,
                                            struct replUpToDateVectorBlob *utdv,
-                                           int32_t level,
+                                           int32_t *plevel,
                                            union drsuapi_DsGetNCChangesRequest *preq)
 {
        NTSTATUS status;
        uint32_t count;
+       int32_t level;
        union drsuapi_DsGetNCChangesRequest req;
        struct dom_sid null_sid;
        enum drsuapi_DsExtendedOperation extended_op;
@@ -383,6 +384,14 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx,
        ZERO_STRUCT(null_sid);
        ZERO_STRUCT(req);
 
+       if (ctx->remote_info28.supported_extensions
+           & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8)
+       {
+               level = 8;
+       } else {
+               level = 5;
+       }
+
        nc = TALLOC_ZERO_P(mem_ctx, struct drsuapi_DsReplicaObjectIdentifier);
        if (!nc) {
                status = NT_STATUS_NO_MEMORY;
@@ -449,6 +458,10 @@ static NTSTATUS libnet_dssync_build_request(TALLOC_CTX *mem_ctx,
                goto fail;
        }
 
+       if (plevel) {
+               *plevel = level;
+       }
+
        if (preq) {
                *preq = req;
        }
@@ -627,21 +640,13 @@ static NTSTATUS libnet_dssync_process(TALLOC_CTX *mem_ctx,
                goto out;
        }
 
-       if (ctx->remote_info28.supported_extensions
-           & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8)
-       {
-               level = 8;
-       } else {
-               level = 5;
-       }
-
        if (ctx->single && ctx->object_dn) {
                dn = ctx->object_dn;
        } else {
                dn = ctx->nc_dn;
        }
 
-       status = libnet_dssync_build_request(mem_ctx, ctx, dn, old_utdv, level,
+       status = libnet_dssync_build_request(mem_ctx, ctx, dn, old_utdv, &level,
                                             &req);
        if (!NT_STATUS_IS_OK(status)) {
                goto out;