diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-03 18:27:29 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-03 18:36:09 +1000 |
commit | c37f290043c55ec6428a313b4ec3ca2f91e5e98e (patch) | |
tree | 1c43617c83c3df4a12134cc857b897a88cbda7e1 /source4/dsdb/common | |
parent | 617bbd913dcd6335cfcee3db6d23e8d3262dd566 (diff) | |
download | samba-c37f290043c55ec6428a313b4ec3ca2f91e5e98e.tar.gz samba-c37f290043c55ec6428a313b4ec3ca2f91e5e98e.tar.bz2 samba-c37f290043c55ec6428a313b4ec3ca2f91e5e98e.zip |
added dsdb_find_guid_by_dn()
This will be used by the linked_attribute module
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r-- | source4/dsdb/common/util.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 32a8906884..0ffec8a7eb 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -2111,7 +2111,7 @@ int dsdb_find_dn_by_guid(struct ldb_context *ldb, partitions module that can return two here with the search_options control set */ if (res->count < 1) { - return LDB_ERR_OPERATIONS_ERROR; + return LDB_ERR_NO_SUCH_OBJECT; } *dn = res->msgs[0]->dn; @@ -2120,3 +2120,23 @@ int dsdb_find_dn_by_guid(struct ldb_context *ldb, } +/* + use a DN to find a GUID + */ +int dsdb_find_guid_by_dn(struct ldb_context *ldb, + struct ldb_dn *dn, struct GUID *guid) +{ + int ret; + struct ldb_result *res; + const char *attrs[] = { "objectGUID" }; + TALLOC_CTX *tmp_ctx = talloc_new(ldb); + + ret = ldb_search(ldb, tmp_ctx, &res, dn, LDB_SCOPE_BASE, attrs, NULL); + if (ret != LDB_SUCCESS) { + talloc_free(tmp_ctx); + return ret; + } + *guid = samdb_result_guid(res->msgs[0], "objectGUID"); + talloc_free(tmp_ctx); + return LDB_SUCCESS; +} |