summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-08-26 16:12:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:38 -0500
commit61aaf82b6280292ad29439b15ab3bcde065a4c45 (patch)
treeda46c5b8661d391800e7ef95d52dfe657f9c2c32 /source4/dsdb/samdb
parent44a27265fb2aed8ce976aa6cd5875faaa5aec4d9 (diff)
downloadsamba-61aaf82b6280292ad29439b15ab3bcde065a4c45.tar.gz
samba-61aaf82b6280292ad29439b15ab3bcde065a4c45.tar.bz2
samba-61aaf82b6280292ad29439b15ab3bcde065a4c45.zip
r9654: introduce the samdb_search_dn call
(This used to be commit 333ebb40d55c60465564b894d5028b364e99ee00)
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/samdb.c22
1 files changed, 22 insertions, 0 deletions
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
*/