From 232bc1503fc0e3f85b4711f077d2566dc0f0c823 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 5 May 2004 04:27:29 +0000 Subject: r490: - expanded the test suite to test modify and delete operations - made yet another attempt to make ldb const clean. - "make test" now runs both the tdb and ldap backend tests, and run the ldbtest utility with and without indexing - added prototypes in ldb.h for ldb_msg_*() public functions (This used to be commit 01e87406768cb5a98ac8530a2f361a4987a36cd3) --- source4/lib/ldb/tools/ldbsearch.c | 4 +- source4/lib/ldb/tools/ldbtest.c | 98 +++++++++++++++++++++++++++++++++++---- 2 files changed, 92 insertions(+), 10 deletions(-) (limited to 'source4/lib/ldb/tools') diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index e8275e87c1..541024dd2d 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -49,7 +49,7 @@ static void do_search(struct ldb_context *ldb, const char *basedn, int scope, const char *expression, - const char * const *attrs) + char * const *attrs) { int ret, i; struct ldb_message **msgs; @@ -84,7 +84,7 @@ static void do_search(struct ldb_context *ldb, int main(int argc, char * const argv[]) { struct ldb_context *ldb; - const char * const * attrs = NULL; + char * const * attrs = NULL; const char *ldb_url; const char *basedn = NULL; int opt; diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index b7d1d22db8..bcb8bdcb16 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -36,12 +36,12 @@ static struct timeval tp1,tp2; -static void start_timer() +static void start_timer(void) { gettimeofday(&tp1,NULL); } -static double end_timer() +static double end_timer(void) { gettimeofday(&tp2,NULL); return((tp2.tv_sec - tp1.tv_sec) + @@ -108,6 +108,8 @@ static void add_records(struct ldb_context *ldb, vals[5][0].data = name; vals[5][0].length = strlen(vals[5][0].data); + ldb_delete(ldb, msg.dn); + if (ldb_add(ldb, &msg) != 0) { printf("Add of %s failed - %s\n", name, ldb_errstring(ldb)); exit(1); @@ -126,6 +128,83 @@ static void add_records(struct ldb_context *ldb, printf("\n"); } +static void modify_records(struct ldb_context *ldb, + const char *basedn, + int count) +{ + struct ldb_message msg; + int i; + + for (i=0;i