diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-12-16 12:01:16 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-12-16 20:56:21 +1100 |
commit | 8a74633eaa9404ac43788a38c8bf3178b1101b1c (patch) | |
tree | c4bdd4fe012343c0b0f9273de8ebcb64d5b3fa61 | |
parent | 9fa1f96172ffd2552a0e6b385b63e7d7dca024e7 (diff) | |
download | samba-8a74633eaa9404ac43788a38c8bf3178b1101b1c.tar.gz samba-8a74633eaa9404ac43788a38c8bf3178b1101b1c.tar.bz2 samba-8a74633eaa9404ac43788a38c8bf3178b1101b1c.zip |
s4-dsdb: added a dsdb_module_rename() call
This will be used by the replmd_delete() code
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/util.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index 1d5c74c46d..d8d55ae42a 100644 --- a/source4/dsdb/samdb/ldb_modules/util.c +++ b/source4/dsdb/samdb/ldb_modules/util.c @@ -294,3 +294,46 @@ int dsdb_module_modify(struct ldb_module *module, talloc_free(tmp_ctx); return ret; } + + + +/* + a ldb_rename request operating on modules below the + current module + */ +int dsdb_module_rename(struct ldb_module *module, + struct ldb_dn *olddn, struct ldb_dn *newdn, + uint32_t dsdb_flags) +{ + struct ldb_request *req; + int ret; + struct ldb_context *ldb = ldb_module_get_ctx(module); + TALLOC_CTX *tmp_ctx = talloc_new(module); + + ret = ldb_build_rename_req(&req, ldb, tmp_ctx, + olddn, + newdn, + NULL, + NULL, + ldb_op_default_callback, + NULL); + if (ret != LDB_SUCCESS) { + talloc_free(tmp_ctx); + return ret; + } + + ret = dsdb_request_add_controls(module, req, dsdb_flags); + if (ret != LDB_SUCCESS) { + talloc_free(tmp_ctx); + return ret; + } + + /* Run the new request */ + ret = ldb_next_request(module, req); + if (ret == LDB_SUCCESS) { + ret = ldb_wait(req->handle, LDB_WAIT_ALL); + } + + talloc_free(tmp_ctx); + return ret; +} |