diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-12-16 13:41:21 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-12-16 20:56:22 +1100 |
commit | 6c2125572cfbcd1878dfe99893ddae37f95d1f6e (patch) | |
tree | 8975727480caa76bd459a00b87feeb531e33af50 /source4/dsdb/common | |
parent | 3c1f18c5e2c3f56d512aa9a8cfab2f5698bafbb0 (diff) | |
download | samba-6c2125572cfbcd1878dfe99893ddae37f95d1f6e.tar.gz samba-6c2125572cfbcd1878dfe99893ddae37f95d1f6e.tar.bz2 samba-6c2125572cfbcd1878dfe99893ddae37f95d1f6e.zip |
s4-dsdb: added dsdb_get_deleted_objects_dn()
This is based on the code from Eduardo Lima <eduardoll@gmail.com>, but
uses the new helper functions added in the last couple of commits
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r-- | source4/dsdb/common/util.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index ffc11b02f7..b437d0849b 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -2846,3 +2846,25 @@ int dsdb_find_nc_root(struct ldb_context *samdb, TALLOC_CTX *mem_ctx, struct ldb talloc_free(tmp_ctx); return LDB_ERR_NO_SUCH_OBJECT; } + + +/* + find the deleted objects DN for any object, by looking for the NC + root, then looking up the wellknown GUID + */ +int dsdb_get_deleted_objects_dn(struct ldb_context *ldb, + TALLOC_CTX *mem_ctx, struct ldb_dn *obj_dn, + struct ldb_dn **do_dn) +{ + struct ldb_dn *nc_root; + int ret; + + ret = dsdb_find_nc_root(ldb, mem_ctx, obj_dn, &nc_root); + if (ret != LDB_SUCCESS) { + return ret; + } + + ret = dsdb_wellknown_dn(ldb, mem_ctx, nc_root, DS_GUID_DELETED_OBJECTS_CONTAINER, do_dn); + talloc_free(nc_root); + return ret; +} |