]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:dsdb/repl_meta_data: remember originating updates when applying replicated changes
authorStefan Metzmacher <metze@samba.org>
Wed, 13 Jul 2016 06:15:20 +0000 (08:15 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 22 Jul 2016 21:34:22 +0000 (23:34 +0200)
The caller needs to know about them in order to decide about possible
notifications.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/repl_meta_data.c
source4/dsdb/samdb/samdb.h

index 183747a38a584ac854adb570728ebb10a35d9c3b..caf65f330576c6720253dba4ddaf56b16b50376d 100644 (file)
@@ -68,6 +68,7 @@ struct replmd_private {
                uint64_t mod_usn_urgent;
        } *ncs;
        struct ldb_dn *schema_dn;
+       bool originating_updates;
 };
 
 struct la_entry {
@@ -525,6 +526,9 @@ static int replmd_op_callback(struct ldb_request *req, struct ldb_reply *ares)
                                modified_partition->mod_usn_urgent = ac->seq_num;
                        }
                }
+               if (!ac->apply_mode) {
+                       replmd_private->originating_updates = true;
+               }
        }
 
        if (ac->apply_mode) {
@@ -5828,7 +5832,10 @@ static int replmd_replicated_uptodate_search_callback(struct ldb_request *req,
 
 static int replmd_replicated_uptodate_vector(struct replmd_replicated_request *ar)
 {
-       struct ldb_context *ldb;
+       struct ldb_context *ldb = ldb_module_get_ctx(ar->module);
+       struct replmd_private *replmd_private =
+               talloc_get_type_abort(ldb_module_get_private(ar->module),
+               struct replmd_private);
        int ret;
        static const char *attrs[] = {
                "replUpToDateVector",
@@ -5838,9 +5845,13 @@ static int replmd_replicated_uptodate_vector(struct replmd_replicated_request *a
        };
        struct ldb_request *search_req;
 
-       ldb = ldb_module_get_ctx(ar->module);
        ar->search_msg = NULL;
 
+       /*
+        * Let the caller know that we did an originating updates
+        */
+       ar->objs->originating_updates = replmd_private->originating_updates;
+
        ret = ldb_build_search_req(&search_req,
                                   ldb,
                                   ar,
@@ -6388,6 +6399,8 @@ static int replmd_start_transaction(struct ldb_module *module)
                talloc_free(e);
        }
 
+       replmd_private->originating_updates = false;
+
        return ldb_next_start_trans(module);
 }
 
index 438960d4da8d072452c10d35b7c5e32549e1f2cf..497f1da61aaf996912b5539552ad2f40fc00d8fa 100644 (file)
@@ -203,7 +203,7 @@ struct dsdb_extended_replicated_objects {
         * this is the version of the dsdb_extended_replicated_objects
         * version 0: initial implementation
         */
-#define DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION 2
+#define DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION 3
        uint32_t version;
 
        /* DSDB_REPL_FLAG_* flags */
@@ -221,6 +221,8 @@ struct dsdb_extended_replicated_objects {
        const struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
 
        WERROR error;
+
+       bool originating_updates;
 };
 
 #define DSDB_EXTENDED_CREATE_PARTITION_OID "1.3.6.1.4.1.7165.4.4.4"