summaryrefslogtreecommitdiff
path: root/source4/lib
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/lib
parent07b7d84f0601c7047341c33493fcc9695e5e703b (diff)
downloadsamba-ea212eb00fd358e7335648b9cd556227e53df367.tar.gz
samba-ea212eb00fd358e7335648b9cd556227e53df367.tar.bz2
samba-ea212eb00fd358e7335648b9cd556227e53df367.zip
r20034: Start using ldb_search_exp_fmt()
(This used to be commit 4f07542143ddf5066f0360d965f26a8470504047)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/include/ldb.h3
-rw-r--r--source4/lib/ldb/tools/ad2oLschema.c12
2 files changed, 7 insertions, 8 deletions
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 9d48810078..dfa447b534 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -989,6 +989,9 @@ int ldb_search(struct ldb_context *ldb,
const char *expression,
const char * const *attrs, struct ldb_result **res);
+int ldb_search_exp_fmt(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, struct ldb_result **result,
+ struct ldb_dn *base, enum ldb_scope scope, const char * const *attrs,
+ const char *exp_fmt, ...);
/*
like ldb_search() but takes a parse tree
*/
diff --git a/source4/lib/ldb/tools/ad2oLschema.c b/source4/lib/ldb/tools/ad2oLschema.c
index 49c4fa1fd6..875882659b 100644
--- a/source4/lib/ldb/tools/ad2oLschema.c
+++ b/source4/lib/ldb/tools/ad2oLschema.c
@@ -120,20 +120,16 @@ static int fetch_oc_recursive(struct ldb_context *ldb, struct ldb_dn *schemadn,
struct ldb_result *res;
const char *name = ldb_msg_find_attr_as_string(search_from->msgs[i],
"lDAPDisplayname", NULL);
- char *filter = talloc_asprintf(mem_ctx, "(&(&(objectClass=classSchema)(subClassOf=%s))(!(lDAPDisplayName=%s)))",
- name, name);
- ret = ldb_search(ldb, schemadn, LDB_SCOPE_SUBTREE,
- filter,
- oc_attrs, &res);
- talloc_free(filter);
+ ret = ldb_search_exp_fmt(ldb, mem_ctx, &res,
+ schemadn, LDB_SCOPE_SUBTREE, oc_attrs,
+ "(&(&(objectClass=classSchema)(subClassOf=%s))(!(lDAPDisplayName=%s)))",
+ name, name);
if (ret != LDB_SUCCESS) {
printf("Search failed: %s\n", ldb_errstring(ldb));
return ret;
}
- talloc_steal(mem_ctx, res);
-
res_list->msgs = talloc_realloc(res_list, res_list->msgs,
struct ldb_message *, res_list->count + 2);
if (!res_list->msgs) {