diff options
author | Fernando J V da Silva <fernandojvsilva@yahoo.com.br> | 2010-02-04 16:46:52 -0200 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-02-15 21:57:07 +1100 |
commit | 5aa42f8010d0895b5bc5018567c431f79c40f8f6 (patch) | |
tree | 252d2f7623babf534215c60daa0e1ae361220b4a /source4/dsdb/samdb/ldb_modules | |
parent | ddbda92f87aeedb1a1a976a43a1e5ada3897646e (diff) | |
download | samba-5aa42f8010d0895b5bc5018567c431f79c40f8f6.tar.gz samba-5aa42f8010d0895b5bc5018567c431f79c40f8f6.tar.bz2 samba-5aa42f8010d0895b5bc5018567c431f79c40f8f6.zip |
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 <tridge@samba.org>
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 23 |
1 files changed, 16 insertions, 7 deletions
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]); } |