diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-08-15 16:01:39 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-08-18 09:26:59 +1000 |
commit | c5dc26b9769bbaf2883a8cc8fc6fbe3168ff1c9b (patch) | |
tree | 828f4fedeb577fa3995b491aab08229e309138f0 /source4/dsdb | |
parent | 16fa0f68bdce39eb19f0fa5486ff231467662b12 (diff) | |
download | samba-c5dc26b9769bbaf2883a8cc8fc6fbe3168ff1c9b.tar.gz samba-c5dc26b9769bbaf2883a8cc8fc6fbe3168ff1c9b.tar.bz2 samba-c5dc26b9769bbaf2883a8cc8fc6fbe3168ff1c9b.zip |
s4-dsdb: added comments and fixed backlink check in repl_meta_data
added comments explaining the backlink deletion code, plus fix a use
of a bitwise operation in a boolean expression, and avoid calling
dsdb_functional_level() inside a loop
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 54741e6f9d..e50e2a06ca 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -2724,6 +2724,7 @@ static int replmd_delete(struct ldb_module *module, struct ldb_request *req) OBJECT_TOMBSTONE=4, OBJECT_REMOVED=5 }; enum deletion_state deletion_state, next_deletion_state; bool enabled; + int functional_level; if (ldb_dn_is_special(req->op.del.dn)) { return ldb_next_request(module, req); @@ -2740,6 +2741,8 @@ static int replmd_delete(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } + functional_level = dsdb_functional_level(ldb); + old_dn = ldb_dn_copy(tmp_ctx, req->op.del.dn); /* we need the complete msg off disk, so we can work out which @@ -2940,7 +2943,7 @@ static int replmd_delete(struct ldb_module *module, struct ldb_request *req) /* we also mark it as recycled, meaning this object can't be recovered (we are stripping its attributes) */ - if (dsdb_functional_level(ldb) >= DS_DOMAIN_FUNCTION_2008_R2) { + if (functional_level >= DS_DOMAIN_FUNCTION_2008_R2) { ret = ldb_msg_add_string(msg, "isRecycled", "TRUE"); if (ret != LDB_SUCCESS) { DEBUG(0,(__location__ ": Failed to add isRecycled string to the msg\n")); @@ -2964,12 +2967,24 @@ static int replmd_delete(struct ldb_module *module, struct ldb_request *req) /* don't remove the rDN */ continue; } - if (sa->linkID && sa->linkID & 1) { + if (sa->linkID && (sa->linkID & 1)) { + /* + we have a backlink in this object + that needs to be removed. We're not + allowed to remove it directly + however, so we instead setup a + modify to delete the corresponding + forward link + */ ret = replmd_delete_remove_link(module, schema, old_dn, el, sa, req); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return LDB_ERR_OPERATIONS_ERROR; } + /* now we continue, which means we + won't remove this backlink + directly + */ continue; } if (!sa->linkID && ldb_attr_in_list(preserved_attrs, el->name)) { |