summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c12
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_sync.c0
-rwxr-xr-xtestprogs/ejs/ldb.js57
3 files changed, 62 insertions, 7 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index a21fabb747..aa692547ce 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -128,7 +128,7 @@ static int partition_search_callback(struct ldb_context *ldb, void *context, str
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 @@ static int partition_other_callback(struct ldb_context *ldb, void *context, stru
{
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 @@ static int partition_init(struct ldb_module *module)
}
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: "
diff --git a/source4/dsdb/samdb/ldb_modules/password_sync.c b/source4/dsdb/samdb/ldb_modules/password_sync.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/source4/dsdb/samdb/ldb_modules/password_sync.c
diff --git a/testprogs/ejs/ldb.js b/testprogs/ejs/ldb.js
index fb1a2d4b0d..6851ee0b30 100755
--- a/testprogs/ejs/ldb.js
+++ b/testprogs/ejs/ldb.js
@@ -92,18 +92,22 @@ partition: cn=SideTest:" + prefix + "testside.ldb
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 @@ caseattr: CASE_INSENSITIVE
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 @@ cn: X9
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 @@ cn: X9
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 @@ caseattr: XZ
}
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 @@ caseattr2: XZ
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,7 +364,11 @@ ldb = ldb_init();
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");