diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-01-21 16:15:53 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-01-21 16:15:53 +0100 |
commit | f3ecb701335b1129947127d4c45eef970b66875c (patch) | |
tree | 4e670492610ad24817f6717bf1a9762df22cd7f5 /source3/lib/ldb/tools | |
parent | 47951fc5d0085e124666b7667715bba98076820e (diff) | |
download | samba-f3ecb701335b1129947127d4c45eef970b66875c.tar.gz samba-f3ecb701335b1129947127d4c45eef970b66875c.tar.bz2 samba-f3ecb701335b1129947127d4c45eef970b66875c.zip |
Replace ldb_search() with ldb_search_exp_fmt(), like in Samba 4.
Diffstat (limited to 'source3/lib/ldb/tools')
-rw-r--r-- | source3/lib/ldb/tools/ad2oLschema.c | 6 | ||||
-rw-r--r-- | source3/lib/ldb/tools/ldbedit.c | 2 | ||||
-rw-r--r-- | source3/lib/ldb/tools/ldbtest.c | 8 |
3 files changed, 6 insertions, 10 deletions
diff --git a/source3/lib/ldb/tools/ad2oLschema.c b/source3/lib/ldb/tools/ad2oLschema.c index 55406b29be..0f05448a9e 100644 --- a/source3/lib/ldb/tools/ad2oLschema.c +++ b/source3/lib/ldb/tools/ad2oLschema.c @@ -118,12 +118,10 @@ 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, ldb, &res, schemadn, LDB_SCOPE_SUBTREE, - oc_attrs, filter); - talloc_free(filter); + oc_attrs, "(&(&(objectClass=classSchema)(subClassOf=%s))(!(lDAPDisplayName=%s)))", + name, name); if (ret != LDB_SUCCESS) { printf("Search failed: %s\n", ldb_errstring(ldb)); return ret; diff --git a/source3/lib/ldb/tools/ldbedit.c b/source3/lib/ldb/tools/ldbedit.c index dff7270e5d..a33e6ae704 100644 --- a/source3/lib/ldb/tools/ldbedit.c +++ b/source3/lib/ldb/tools/ldbedit.c @@ -306,7 +306,7 @@ int main(int argc, const char **argv) } } - ret = ldb_search(ldb, ldb, &result, basedn, options->scope, attrs, expression); + ret = ldb_search(ldb, ldb, &result, basedn, options->scope, attrs, "%s", expression); if (ret != LDB_SUCCESS) { printf("search failed - %s\n", ldb_errstring(ldb)); exit(1); diff --git a/source3/lib/ldb/tools/ldbtest.c b/source3/lib/ldb/tools/ldbtest.c index 637eb5a7ff..5e8ef1b21c 100644 --- a/source3/lib/ldb/tools/ldbtest.c +++ b/source3/lib/ldb/tools/ldbtest.c @@ -220,20 +220,18 @@ static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, int nreco for (i=0;i<nsearches;i++) { int uid = (i * 700 + 17) % (nrecords * 2); - char *expr; struct ldb_result *res = NULL; int ret; - expr = talloc_asprintf(ldb, "(uid=TEST%d)", uid); - ret = ldb_search(ldb, ldb, &res, basedn, LDB_SCOPE_SUBTREE, NULL, expr); + ret = ldb_search(ldb, ldb, &res, basedn, LDB_SCOPE_SUBTREE, NULL, "(uid=TEST%d)", uid); if (ret != LDB_SUCCESS || (uid < nrecords && res->count != 1)) { - printf("Failed to find %s - %s\n", expr, ldb_errstring(ldb)); + printf("Failed to find TEST%d - %s\n", uid, ldb_errstring(ldb)); exit(1); } if (uid >= nrecords && res->count > 0) { - printf("Found %s !? - %d\n", expr, ret); + printf("Found TEST%d !? - %d\n", uid, ret); exit(1); } |