From 5aa42f8010d0895b5bc5018567c431f79c40f8f6 Mon Sep 17 00:00:00 2001 From: Fernando J V da Silva Date: Thu, 4 Feb 2010 16:46:52 -0200 Subject: s4-drs: Fixes bugs regarding Urgent Replication on wrong situations It fixes the bug which causes an urgent replication to be enabled incorrectly when an object is modified, but it should happen only when it was created. This patch also fixes the bug that enable an urgent replication when an object is deleted, but it should happen only when it was modified and fixes the bug that does not enable an urgent replication when an object is deleted and it should happen only when it is deleted (not when it is modified). Signed-off-by: Andrew Tridgell --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules') diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 725ba2a47c..51611aca1d 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -92,7 +92,7 @@ struct replmd_replicated_request { enum urgent_situation { REPL_URGENT_ON_CREATE = 1, - REPL_URGENT_ON_UPDATE = 3, /* activated on creating as well*/ + REPL_URGENT_ON_UPDATE = 2, REPL_URGENT_ON_DELETE = 4 }; @@ -103,10 +103,10 @@ static const struct { } urgent_objects[] = { {"nTDSDSA", (REPL_URGENT_ON_CREATE | REPL_URGENT_ON_DELETE)}, {"crossRef", (REPL_URGENT_ON_CREATE | REPL_URGENT_ON_DELETE)}, - {"attributeSchema", REPL_URGENT_ON_UPDATE}, - {"classSchema", REPL_URGENT_ON_UPDATE}, - {"secret", REPL_URGENT_ON_UPDATE}, - {"rIDManager", REPL_URGENT_ON_UPDATE}, + {"attributeSchema", (REPL_URGENT_ON_CREATE | REPL_URGENT_ON_UPDATE)}, + {"classSchema", (REPL_URGENT_ON_CREATE | REPL_URGENT_ON_UPDATE)}, + {"secret", (REPL_URGENT_ON_CREATE | REPL_URGENT_ON_UPDATE)}, + {"rIDManager", (REPL_URGENT_ON_CREATE | REPL_URGENT_ON_UPDATE)}, {NULL, 0} }; @@ -1077,6 +1077,7 @@ static int replmd_update_rpmd(struct ldb_module *module, struct ldb_result *res; struct ldb_context *ldb; struct ldb_message_element *objectclass_el; + enum urgent_situation situation; ldb = ldb_module_get_ctx(module); @@ -1098,9 +1099,17 @@ static int replmd_update_rpmd(struct ldb_module *module, return LDB_ERR_OPERATIONS_ERROR; } + /* if isDeleted is present and is TRUE, then we consider we are deleting, + * otherwise we consider we are updating */ + if (ldb_msg_check_string_attribute(msg, "isDeleted", "TRUE")) { + situation = REPL_URGENT_ON_DELETE; + } else { + situation = REPL_URGENT_ON_UPDATE; + } + objectclass_el = ldb_msg_find_element(res->msgs[0], "objectClass"); if (is_urgent && replmd_check_urgent_objectclass(objectclass_el, - REPL_URGENT_ON_UPDATE)) { + situation)) { *is_urgent = true; } @@ -1133,7 +1142,7 @@ static int replmd_update_rpmd(struct ldb_module *module, return ret; } - if (is_urgent && !*is_urgent) { + if (is_urgent && !*is_urgent && (situation == REPL_URGENT_ON_UPDATE)) { *is_urgent = replmd_check_urgent_attribute(&msg->elements[i]); } -- cgit