svn commit: samba r2721 - in branches/SAMBA_4_0/source/lib/ldb/tools: .

tridge at samba.org tridge at samba.org
Tue Sep 28 12:06:22 GMT 2004


Author: tridge
Date: 2004-09-28 12:06:22 +0000 (Tue, 28 Sep 2004)
New Revision: 2721

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/lib/ldb/tools&rev=2721&nolog=1

Log:
added a -b option to ldbtest so it can be used with the new smbd ldap server
without changing realms


Modified:
   branches/SAMBA_4_0/source/lib/ldb/tools/ldbtest.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/tools/ldbtest.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/tools/ldbtest.c	2004-09-28 11:57:56 UTC (rev 2720)
+++ branches/SAMBA_4_0/source/lib/ldb/tools/ldbtest.c	2004-09-28 12:06:22 UTC (rev 2721)
@@ -35,6 +35,7 @@
 #include "includes.h"
 
 static const char *ldb_url;
+static const char *base_dn = "ou=Ldb Test,ou=People,o=University of Michigan,c=US";
 
 static struct timeval tp1,tp2;
 
@@ -254,10 +255,8 @@
 
 static void start_test(struct ldb_context *ldb, int nrecords, int nsearches)
 {
-	const char *base = "ou=Ldb Test,ou=People,o=University of Michigan,c=US";
-
 	printf("Adding %d records\n", nrecords);
-	add_records(ldb, base, nrecords);
+	add_records(ldb, base_dn, nrecords);
 
 	printf("Starting search on uid\n");
 	start_timer();
@@ -265,10 +264,10 @@
 	printf("uid search took %.2f seconds\n", end_timer());
 
 	printf("Modifying records\n");
-	modify_records(ldb, base, nrecords);
+	modify_records(ldb, base_dn, nrecords);
 
 	printf("Deleting records\n");
-	delete_records(ldb, base, nrecords);
+	delete_records(ldb, base_dn, nrecords);
 }
 
 
@@ -287,7 +286,6 @@
 */
 static void start_test_index(struct ldb_context **ldb)
 {
-	const char *base = "ou=Ldb Test,ou=People,o=University of Michigan,c=US";
 	struct ldb_message msg;
 	struct ldb_message **res;
 	int ret;
@@ -306,7 +304,7 @@
 	}
 
 	memset(&msg, 0, sizeof(msg));
-	asprintf(&msg.dn, "cn=%s,%s", "test", base);
+	asprintf(&msg.dn, "cn=%s,%s", "test", base_dn);
 	ldb_msg_add_string(*ldb, &msg, "cn", strdup("test"));
 	ldb_msg_add_string(*ldb, &msg, "sn", strdup("test"));
 	ldb_msg_add_string(*ldb, &msg, "uid", strdup("test"));
@@ -366,7 +364,7 @@
 
 	ldb_url = getenv("LDB_URL");
 
-	while ((opt = getopt(argc, argv, "hH:r:s:")) != EOF) {
+	while ((opt = getopt(argc, argv, "hH:r:s:b:")) != EOF) {
 		switch (opt) {
 		case 'H':
 			ldb_url = optarg;
@@ -376,6 +374,10 @@
 			nrecords = atoi(optarg);
 			break;
 
+		case 'b':
+			base_dn = optarg;
+			break;
+
 		case 's':
 			nsearches = atoi(optarg);
 			break;



More information about the samba-cvs mailing list