From: Stefan Metzmacher Date: Wed, 13 Jul 2016 06:15:20 +0000 (+0200) Subject: s4:dsdb/repl_meta_data: remember originating updates when applying replicated changes X-Git-Tag: tdb-1.3.10~156 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=049b50766ab623b47f79335d905dd03048a7bbfe;p=thirdparty%2Fsamba.git s4:dsdb/repl_meta_data: remember originating updates when applying replicated changes The caller needs to know about them in order to decide about possible notifications. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 183747a38a5..caf65f33057 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -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); } diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h index 438960d4da8..497f1da61aa 100644 --- a/source4/dsdb/samdb/samdb.h +++ b/source4/dsdb/samdb/samdb.h @@ -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"