summaryrefslogtreecommitdiffstats
path: root/source4/kdc
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-12-05 04:25:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:51 -0500
commitea212eb00fd358e7335648b9cd556227e53df367 (patch)
tree6ae2ea6e14f0439e5e367937f289d97f5e0bb839 /source4/kdc
parent07b7d84f0601c7047341c33493fcc9695e5e703b (diff)
downloadsamba-ea212eb00fd358e7335648b9cd556227e53df367.tar.gz
samba-ea212eb00fd358e7335648b9cd556227e53df367.tar.xz
samba-ea212eb00fd358e7335648b9cd556227e53df367.zip
r20034: Start using ldb_search_exp_fmt()
(This used to be commit 4f07542143ddf5066f0360d965f26a8470504047)
Diffstat (limited to 'source4/kdc')
-rw-r--r--source4/kdc/hdb-ldb.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c
index 7ba9a4692e4..f7bbbb9a9b5 100644
--- a/source4/kdc/hdb-ldb.c
+++ b/source4/kdc/hdb-ldb.c
@@ -525,26 +525,20 @@ static krb5_error_code LDB_lookup_realm(krb5_context context, struct ldb_context
struct ldb_message ***pmsg)
{
int ret;
- char *cross_ref_filter;
struct ldb_result *cross_ref_res;
struct ldb_dn *partitions_basedn = samdb_partitions_dn(ldb_ctx, mem_ctx);
- cross_ref_filter = talloc_asprintf(mem_ctx,
- "(&(&(|(&(dnsRoot=%s)(nETBIOSName=*))(nETBIOSName=%s))(objectclass=crossRef))(ncName=*))",
- realm, realm);
- if (!cross_ref_filter) {
- krb5_set_error_string(context, "asprintf: out of memory");
- return ENOMEM;
- }
-
- ret = ldb_search(ldb_ctx, partitions_basedn, LDB_SCOPE_SUBTREE, cross_ref_filter, realm_ref_attrs, &cross_ref_res);
+ ret = ldb_search_exp_fmt(ldb_ctx, mem_ctx, &cross_ref_res,
+ partitions_basedn, LDB_SCOPE_SUBTREE, realm_ref_attrs,
+ "(&(&(|(&(dnsRoot=%s)(nETBIOSName=*))(nETBIOSName=%s))(objectclass=crossRef))(ncName=*))",
+ realm, realm);
if (ret != LDB_SUCCESS) {
- DEBUG(3, ("Failed to search for %s: %s\n", cross_ref_filter, ldb_errstring(ldb_ctx)));
+ DEBUG(3, ("Failed to search to lookup realm(%s): %s\n", realm, ldb_errstring(ldb_ctx)));
talloc_free(cross_ref_res);
return HDB_ERR_NOENTRY;
} else if (cross_ref_res->count == 0 || cross_ref_res->count > 1) {
- DEBUG(3, ("Failed find a single entry for %s: got %d\n", cross_ref_filter, cross_ref_res->count));
+ DEBUG(3, ("Failed find a single entry for realm %s: got %d\n", realm, cross_ref_res->count));
talloc_free(cross_ref_res);
return HDB_ERR_NOENTRY;
}