svn commit: samba r17302 - in branches/SAMBA_4_0: source/dsdb/samdb/ldb_modules testprogs/ejs

abartlet at samba.org abartlet at samba.org
Sat Jul 29 01:52:16 GMT 2006


Author: abartlet
Date: 2006-07-29 01:52:15 +0000 (Sat, 29 Jul 2006)
New Revision: 17302

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17302

Log:
Testing!

This confirms that records are replicated into the correct databases,
and that the case insensitive flags really work.

Andrew Bartlett

Added:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_sync.c
Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c
   branches/SAMBA_4_0/testprogs/ejs/ldb.js


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c	2006-07-29 01:23:50 UTC (rev 17301)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c	2006-07-29 01:52:15 UTC (rev 17302)
@@ -128,7 +128,7 @@
 	struct partition_context *ac;
 
 	if (!context || !ares) {
-		ldb_set_errstring(ldb, talloc_asprintf(ldb, "NULL Context or Result in callback"));
+		ldb_set_errstring(ldb, talloc_asprintf(ldb, "partition_search_callback: NULL Context or Result in 'search' callback"));
 		goto error;
 	}
 
@@ -157,14 +157,16 @@
 {
 	struct partition_context *ac;
 
-	if (!context || !ares) {
-		ldb_set_errstring(ldb, talloc_asprintf(ldb, "NULL Context or Result in callback"));
+	if (!context) {
+		ldb_set_errstring(ldb, talloc_asprintf(ldb, "partition_other_callback: NULL Context in 'other' callback"));
 		goto error;
 	}
 
 	ac = talloc_get_type(context, struct partition_context);
 
-	if (ares->type == LDB_REPLY_EXTENDED && strcmp(ares->response->oid, LDB_EXTENDED_START_TLS_OID)) {
+	if (!ares 
+	    || (ares->type == LDB_REPLY_EXTENDED 
+		&& strcmp(ares->response->oid, LDB_EXTENDED_START_TLS_OID))) {
 		ac->finished_requests++;
 		if (ac->finished_requests == ac->num_requests) {
 			return ac->orig_req->callback(ldb, ac->orig_req->context, ares);
@@ -621,7 +623,7 @@
 		}
 		
 		for (i=0; i < replicate_attributes->num_values; i++) {
-			data->replicate[i] = ldb_dn_explode(data->replicate[i], replicate_attributes->values[i].data);
+			data->replicate[i] = ldb_dn_explode(data->replicate, replicate_attributes->values[i].data);
 			if (!data->replicate[i]) {
 				ldb_set_errstring(module->ldb, 
 						  talloc_asprintf(module, "partition_init: "

Added: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_sync.c
===================================================================

Modified: branches/SAMBA_4_0/testprogs/ejs/ldb.js
===================================================================
--- branches/SAMBA_4_0/testprogs/ejs/ldb.js	2006-07-29 01:23:50 UTC (rev 17301)
+++ branches/SAMBA_4_0/testprogs/ejs/ldb.js	2006-07-29 01:52:15 UTC (rev 17302)
@@ -92,18 +92,22 @@
 partition: cn=Sub,cn=PartTest:" + prefix +  "testsub.ldb
 partition: cn=PartTest:" + prefix +  "testpartition.ldb
 partition: cn=Sub,cn=Sub,cn=PartTest:" + prefix +  "testsubsub.ldb
+replicateEntries: @SUBCLASSES
+replicateEntries: @ATTRIBUTES
+replicateEntries: @INDEXLIST
 ");
 }
 
 /* Test the basic operation of the timestamps,objectguid and name_rdn
    modules */
 
-function modules_test(ldb) 
+function modules_test(ldb, parttestldb) 
 {
         println("Running modules tests");
 
         ok = ldb.add("
 dn: @ATTRIBUTES
+cn: CASE_INSENSITIVE
 caseattr: CASE_INSENSITIVE
 ");
 	if (!ok) {
@@ -111,6 +115,10 @@
 		assert(ok);
 	}
 
+	/* Confirm that the attributes were replicated */
+	var res_attrs =  parttestldb.search("cn=*", "@ATTRIBUTES",  parttestldb.SCOPE_BASE);
+	assert(res_attrs[0].cn == "CASE_INSENSITIVE");
+
 	ok = ldb.add("
 dn: cn=x8,cn=PartTest
 objectClass: foo
@@ -132,6 +140,17 @@
 		assert(ok);
 	}
 
+	ok = ldb.add("
+dn: cn=X9,cn=PartTest
+objectClass: foo
+x: 9
+cn: X9
+");
+	if (ok) {
+		println("Should have failed to add cn=X9,cn=PartTest");
+		assert(!ok);
+	}
+
 	var res = ldb.search("x=8", "cn=PartTest", ldb.SCOPE_DEFAULT);
 	assert(res[0].objectGUID != undefined);
 	assert(res[0].createTimestamp == undefined);
@@ -139,6 +158,14 @@
 	assert(res[0].name == "x8");
 	assert(res[0].cn == "x8");
 
+	/* Confirm that this ended up in the correct LDB */
+	var res_otherldb =  parttestldb.search("x=8", "cn=PartTest",  parttestldb.SCOPE_DEFAULT);
+	assert(res_otherldb[0].objectGUID != undefined);
+	assert(res_otherldb[0].createTimestamp == undefined);
+	assert(res_otherldb[0].whenCreated != undefined);
+	assert(res_otherldb[0].name == "x8");
+	assert(res_otherldb[0].cn == "x8");
+
 	var attrs = new Array("*", "createTimestamp");
 	var res2 = ldb.search("x=9", "cn=PartTest", ldb.SCOPE_DEFAULT, attrs);
 	assert(res2[0].objectGUID != undefined);
@@ -239,6 +266,17 @@
 	}
 
 	ok = ldb.add("
+dn: caseattr=xz,cn=PartTest
+objectClass: foo
+x: Z
+caseattr: xz
+");
+	if (ok) {
+		println("Should have failed to add caseattr=xz,cn=PartTest");
+		assert(!ok);
+	}
+
+	ok = ldb.add("
 dn: caseattr2=XZ,cn=PartTest
 objectClass: foo
 x: Z
@@ -249,6 +287,17 @@
 		assert(ok);
 	}
 
+	ok = ldb.add("
+dn: caseattr2=Xz,cn=PartTest
+objectClass: foo
+x: Z
+caseattr2: Xz
+");
+	if (!ok) {
+		println("Failed to add: " + ldb.errstring());
+		assert(ok);
+	}
+
 	var resX = ldb.search("caseattr=xz", "cn=parttest", ldb.SCOPE_DEFAULT, attrs);
 	assert(resX.length == 1); 
 	assert(resX[0].objectGUID != undefined);
@@ -315,8 +364,12 @@
 var ok = ldb.connect("tdb://" + prefix + dbfile);
 assert(ok);
 
-modules_test(ldb);
+parttestldb = ldb_init();
+var ok = parttestldb.connect("tdb://" + prefix + "testpartition.ldb");
+assert(ok);
 
+modules_test(ldb, parttestldb);
+
 sys.unlink(prefix + dbfile);
 sys.unlink(prefix + "testpartition.ldb");
 sys.unlink(prefix + "testsub.ldb");



More information about the samba-cvs mailing list