summaryrefslogtreecommitdiff
path: root/source/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
commit4f07542143ddf5066f0360d965f26a8470504047 (patch)
treef16069fd7a0a7220a27f51ebb26377a0d64979f7 /source/kdc
parentfdd6ce6b7e288137aeaf62f9869441c73bedbd45 (diff)
downloadsamba-4f07542143ddf5066f0360d965f26a8470504047.tar.gz
r20034: Start using ldb_search_exp_fmt()
Diffstat (limited to 'source/kdc')
-rw-r--r--source/kdc/hdb-ldb.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/source/kdc/hdb-ldb.c b/source/kdc/hdb-ldb.c
index 7ba9a4692e4..f7bbbb9a9b5 100644
--- a/source/kdc/hdb-ldb.c
+++ b/source/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;
}