s3:libnet: add 'process_links' to dssync_ops
authorStefan Metzmacher <metze@samba.org>
Thu, 13 Jan 2011 16:18:24 +0000 (17:18 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 2 Feb 2011 14:45:20 +0000 (15:45 +0100)
This allows the backend to handle linked attributes.

metze

source3/libnet/libnet_dssync.c
source3/libnet/libnet_dssync.h

index 3aed8b68ed895d9e7fc6673020bc25060943f4c8..64a4df0f7f4cddd595e2066f49ea0edbb4b8e8e4 100644 (file)
@@ -451,6 +451,8 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
        for (y=0, last_query = false; !last_query; y++) {
                struct drsuapi_DsReplicaObjectListItemEx *first_object = NULL;
                struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr = NULL;
+               uint32_t linked_attributes_count = 0;
+               struct drsuapi_DsReplicaLinkedAttribute *linked_attributes = NULL;
 
                if (level == 8) {
                        DEBUG(1,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y,
@@ -537,6 +539,9 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
                        first_object = ctr6->first_object;
                        mapping_ctr = &ctr6->mapping_ctr;
 
+                       linked_attributes = ctr6->linked_attributes;
+                       linked_attributes_count = ctr6->linked_attributes_count;
+
                        if (ctr6->more_data) {
                                req->req8.highwatermark = ctr6->new_highwatermark;
                        } else {
@@ -576,6 +581,23 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
                                goto out;
                        }
                }
+
+               if (linked_attributes_count == 0) {
+                       continue;
+               }
+
+               if (ctx->ops->process_links) {
+                       status = ctx->ops->process_links(ctx, mem_ctx,
+                                                        linked_attributes_count,
+                                                        linked_attributes,
+                                                        mapping_ctr);
+                       if (!NT_STATUS_IS_OK(status)) {
+                               ctx->error_message = talloc_asprintf(ctx,
+                                       "Failed to call processing function: %s",
+                                       nt_errstr(status));
+                               goto out;
+                       }
+               }
        }
 
        *pnew_utdv = new_utdv;
index 91f48f5e8511dc0e19ab739b59ac6460e19cfd2d..f47365263feb3bdf226bf52921e977e0ff5d6370 100644 (file)
@@ -30,6 +30,11 @@ struct dssync_ops {
                                    TALLOC_CTX *mem_ctx,
                                    struct drsuapi_DsReplicaObjectListItemEx *objects,
                                    struct drsuapi_DsReplicaOIDMapping_Ctr *mappings);
+       NTSTATUS (*process_links)(struct dssync_context *ctx,
+                                 TALLOC_CTX *mem_ctx,
+                                 uint32_t count,
+                                 struct drsuapi_DsReplicaLinkedAttribute *links,
+                                 struct drsuapi_DsReplicaOIDMapping_Ctr *mappings);
        NTSTATUS (*finish)(struct dssync_context *ctx, TALLOC_CTX *mem_ctx,
                           struct replUpToDateVectorBlob *new_utdv);
 };