From 61aaf82b6280292ad29439b15ab3bcde065a4c45 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 26 Aug 2005 16:12:25 +0000 Subject: r9654: introduce the samdb_search_dn call (This used to be commit 333ebb40d55c60465564b894d5028b364e99ee00) --- source4/dsdb/samdb/samdb.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source4/dsdb') diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 9cb9a93446..aed47d1ed2 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -127,6 +127,28 @@ const char *samdb_search_string(struct ldb_context *sam_ldb, return str; } +struct ldb_dn *samdb_search_dn(struct ldb_context *sam_ldb, + TALLOC_CTX *mem_ctx, + const struct ldb_dn *basedn, + const char *format, ...) _PRINTF_ATTRIBUTE(4,5) +{ + va_list ap; + struct ldb_dn *ret; + struct ldb_message **res = NULL; + int count; + + va_start(ap, format); + count = gendb_search_v(sam_ldb, mem_ctx, basedn, &res, NULL, format, ap); + va_end(ap); + + if (count != 1) return NULL; + + ret = talloc_steal(mem_ctx, res[0]->dn); + talloc_free(res); + + return ret; +} + /* search the sam for a dom_sid attribute in exactly 1 record */ -- cgit