diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-09-17 12:08:28 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@sn-devel-104.sn.samba.org> | 2010-10-03 15:23:18 +0000 |
commit | e1509ec623480e11760221667c2d8a724e0da05a (patch) | |
tree | e9f6a018c9965dcede52f1140978f450fc955e44 | |
parent | 2b4f6528999243476e8fe25461b54a52f4911683 (diff) | |
download | samba-e1509ec623480e11760221667c2d8a724e0da05a.tar.gz samba-e1509ec623480e11760221667c2d8a724e0da05a.tar.bz2 samba-e1509ec623480e11760221667c2d8a724e0da05a.zip |
s4:repl_meta_data LDB module - consider the SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE flag
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index b459405b57..037dec8aab 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -2442,7 +2442,7 @@ static int replmd_delete_remove_link(struct ldb_module *module, static int replmd_delete(struct ldb_module *module, struct ldb_request *req) { int ret = LDB_ERR_OTHER; - bool retb; + bool retb, disallow_move_on_delete; struct ldb_dn *old_dn, *new_dn; const char *rdn_name; const struct ldb_val *rdn_value, *new_rdn_value; @@ -2554,16 +2554,31 @@ static int replmd_delete(struct ldb_module *module, struct ldb_request *req) msg->dn = old_dn; if (deletion_state == OBJECT_NOT_DELETED){ + /* consider the SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE flag */ + disallow_move_on_delete = + (ldb_msg_find_attr_as_int(old_msg, "systemFlags", 0) + & SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE); + /* work out where we will be renaming this object to */ - ret = dsdb_get_deleted_objects_dn(ldb, tmp_ctx, old_dn, &new_dn); - if (ret != LDB_SUCCESS) { - /* this is probably an attempted delete on a partition - * that doesn't allow delete operations, such as the - * schema partition */ - ldb_asprintf_errstring(ldb, "No Deleted Objects container for DN %s", - ldb_dn_get_linearized(old_dn)); - talloc_free(tmp_ctx); - return LDB_ERR_UNWILLING_TO_PERFORM; + if (!disallow_move_on_delete) { + ret = dsdb_get_deleted_objects_dn(ldb, tmp_ctx, old_dn, + &new_dn); + if (ret != LDB_SUCCESS) { + /* this is probably an attempted delete on a partition + * that doesn't allow delete operations, such as the + * schema partition */ + ldb_asprintf_errstring(ldb, "No Deleted Objects container for DN %s", + ldb_dn_get_linearized(old_dn)); + talloc_free(tmp_ctx); + return LDB_ERR_UNWILLING_TO_PERFORM; + } + } else { + new_dn = ldb_dn_get_parent(tmp_ctx, old_dn); + if (new_dn == NULL) { + ldb_module_oom(module); + talloc_free(tmp_ctx); + return LDB_ERR_OPERATIONS_ERROR; + } } /* get the objects GUID from the search we just did */ |