summaryrefslogtreecommitdiff
path: root/testprogs/ejs
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2007-02-14 21:55:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:18 -0500
commit7ca399c0755e186508a4ed9796cbbbe6f50181e9 (patch)
tree50c7ce84b894bfdd46a773c16a890401afe751c1 /testprogs/ejs
parentbd7df755f326e9c601439c0aa727961c4a4f4518 (diff)
downloadsamba-7ca399c0755e186508a4ed9796cbbbe6f50181e9.tar.gz
samba-7ca399c0755e186508a4ed9796cbbbe6f50181e9.tar.bz2
samba-7ca399c0755e186508a4ed9796cbbbe6f50181e9.zip
r21351: Change ldb ejs bindings return codes.
We were returning just true/false and discarding error number and string. This checking probably breaks swat, will fix it in next round as swat is what made me look into this as I had no way to get back error messages to show to the users. Simo. (This used to be commit 35886b4ae68be475b0fc8b2689ca04d766661261)
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-xtestprogs/ejs/ldap.js372
-rwxr-xr-xtestprogs/ejs/ldb.js202
-rwxr-xr-xtestprogs/ejs/minschema.js54
-rwxr-xr-xtestprogs/ejs/samba3sam.js1035
4 files changed, 851 insertions, 812 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
index 1b7a8f891e..67eb28f6e3 100755
--- a/testprogs/ejs/ldap.js
+++ b/testprogs/ejs/ldap.js
@@ -37,11 +37,11 @@ objectClass: user
objectClass: person
cn: LDAPtestUSER
");
- if (!ok) {
+ if (ok.error != 0) {
ok = ldb.del("cn=ldaptestuser,cn=users," + base_dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
dn: cn=ldaptestuser,cn=users," + base_dn + "
@@ -49,9 +49,9 @@ objectClass: user
objectClass: person
cn: LDAPtestUSER
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
}
@@ -60,20 +60,20 @@ dn: cn=ldaptestcomputer,cn=computers," + base_dn + "
objectClass: computer
cn: LDAPtestCOMPUTER
");
- if (!ok) {
+ if (ok.error != 0) {
ok = ldb.del("cn=ldaptestcomputer,cn=computers," + base_dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
dn: cn=ldaptestcomputer,cn=computers," + base_dn + "
objectClass: computer
cn: LDAPtestCOMPUTER
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
}
@@ -83,11 +83,11 @@ objectClass: computer
cn: LDAPtest2COMPUTER
userAccountControl: 4096
");
- if (!ok) {
+ if (ok.error != 0) {
ok = ldb.del("cn=ldaptest2computer,cn=computers," + base_dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
dn: cn=ldaptest2computer,cn=computers," + base_dn + "
@@ -95,9 +95,9 @@ objectClass: computer
cn: LDAPtest2COMPUTER
userAccountControl: 4096
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
}
@@ -107,11 +107,11 @@ objectClass: person
objectClass: user
cn: LDAPtestUSER2
");
- if (!ok) {
+ if (ok.error != 0) {
ok = ldb.del("cn=ldaptestuser2,cn=users," + base_dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
dn: cn=ldaptestuser2,cn=users," + base_dn + "
@@ -119,9 +119,9 @@ objectClass: person
objectClass: user
cn: LDAPtestUSER2
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
}
@@ -129,19 +129,19 @@ cn: LDAPtestUSER2
dn: cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn + "
objectClass: user
");
- if (!ok) {
+ if (ok.error != 0) {
ok = ldb.del("cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
dn: cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn + "
objectClass: user
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
}
@@ -149,276 +149,296 @@ objectClass: user
dn: cn=ldaptestutf8user2 èùéìòà ,cn=users," + base_dn + "
objectClass: user
");
- if (!ok) {
+ if (ok.error != 0) {
ok = ldb.del("cn=ldaptestutf8user2 èùéìòà ,cn=users," + base_dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
dn: cn=ldaptestutf8user2 èùéìòà ,cn=users," + base_dn + "
objectClass: user
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
}
println("Testing ldb.search for (&(cn=ldaptestuser)(objectClass=user))");
var res = ldb.search("(&(cn=ldaptestuser)(objectClass=user))");
- if (res.length != 1) {
+ if (res.error != 0 || res.msgs.length != 1) {
println("Could not find (&(cn=ldaptestuser)(objectClass=user))");
- assert(res.length == 1);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
}
- assert(res[0].dn == "cn=ldaptestuser,cn=users," + base_dn);
- assert(res[0].cn == "ldaptestuser");
- assert(res[0].name == "ldaptestuser");
- assert(res[0].objectClass[0] == "top");
- assert(res[0].objectClass[1] == "person");
- assert(res[0].objectClass[2] == "organizationalPerson");
- assert(res[0].objectClass[3] == "user");
- assert(res[0].objectGUID != undefined);
- assert(res[0].whenCreated != undefined);
- assert(res[0].objectCategory == "cn=Person,cn=Schema,cn=Configuration," + base_dn);
- assert(res[0].sAMAccountType == 805306368);
+ assert(res.msgs[0].dn == "cn=ldaptestuser,cn=users," + base_dn);
+ assert(res.msgs[0].cn == "ldaptestuser");
+ assert(res.msgs[0].name == "ldaptestuser");
+ assert(res.msgs[0].objectClass[0] == "top");
+ assert(res.msgs[0].objectClass[1] == "person");
+ assert(res.msgs[0].objectClass[2] == "organizationalPerson");
+ assert(res.msgs[0].objectClass[3] == "user");
+ assert(res.msgs[0].objectGUID != undefined);
+ assert(res.msgs[0].whenCreated != undefined);
+ assert(res.msgs[0].objectCategory == "cn=Person,cn=Schema,cn=Configuration," + base_dn);
+ assert(res.msgs[0].sAMAccountType == 805306368);
// assert(res[0].userAccountControl == 546);
println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))");
var res2 = ldb.search("(&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))");
- if (res2.length != 1) {
+ if (res2.error != 0 || res2.msgs.length != 1) {
println("Could not find (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))");
- assert(res2.length == 1);
+ assert(res2.error == 0);
+ assert(res2.msgs.length == 1);
}
- assert(res[0].dn == res2[0].dn);
+ assert(res.msgs[0].dn == res2.msgs[0].dn);
println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon))");
var res3 = ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))");
- if (res3.length != 1) {
+ if (res3.error != 0 || res3.msgs.length != 1) {
println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon))");
- assert(res3.length == 1);
+ assert(res3.error == 0);
+ assert(res3.msgs.length == 1);
}
- assert(res[0].dn == res3[0].dn);
+ assert(res.msgs[0].dn == res3.msgs[0].dn);
if (gc_ldb != undefined) {
println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog");
var res3gc = gc_ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))");
- if (res3gc.length != 1) {
+ if (res3gc.error != 0 || res3gc.msgs.length != 1) {
println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog");
- assert(res3gc.length == 1);
+ assert(res3gc.error == 0);
+ assert(res3gc.msgs.length == 1);
}
- assert(res[0].dn == res3gc[0].dn);
+ assert(res.msgs[0].dn == res3gc.msgs[0].dn);
}
- ok = ldb.del(res[0].dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ ok = ldb.del(res.msgs[0].dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectClass=user))");
var res = ldb.search("(&(cn=ldaptestcomputer)(objectClass=user))");
- if (res.length != 1) {
+ if (res.error != 0 || res.msgs.length != 1) {
println("Could not find (&(cn=ldaptestuser)(objectClass=user))");
- assert(res.length == 1);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
}
- assert(res[0].dn == "cn=ldaptestcomputer,cn=computers," + base_dn);
- assert(res[0].cn == "ldaptestcomputer");
- assert(res[0].name == "ldaptestcomputer");
- assert(res[0].objectClass[0] == "top");
- assert(res[0].objectClass[1] == "person");
- assert(res[0].objectClass[2] == "organizationalPerson");
- assert(res[0].objectClass[3] == "user");
- assert(res[0].objectClass[4] == "computer");
- assert(res[0].objectGUID != undefined);
- assert(res[0].whenCreated != undefined);
- assert(res[0].objectCategory == "cn=Computer,cn=Schema,cn=Configuration," + base_dn);
-// assert(res[0].sAMAccountType == 805306368);
-// assert(res[0].userAccountControl == 546);
+ assert(res.msgs[0].dn == "cn=ldaptestcomputer,cn=computers," + base_dn);
+ assert(res.msgs[0].cn == "ldaptestcomputer");
+ assert(res.msgs[0].name == "ldaptestcomputer");
+ assert(res.msgs[0].objectClass[0] == "top");
+ assert(res.msgs[0].objectClass[1] == "person");
+ assert(res.msgs[0].objectClass[2] == "organizationalPerson");
+ assert(res.msgs[0].objectClass[3] == "user");
+ assert(res.msgs[0].objectClass[4] == "computer");
+ assert(res.msgs[0].objectGUID != undefined);
+ assert(res.msgs[0].whenCreated != undefined);
+ assert(res.msgs[0].objectCategory == "cn=Computer,cn=Schema,cn=Configuration," + base_dn);
+// assert(res.msgs[0].sAMAccountType == 805306368);
+// assert(res.msgs[0].userAccountControl == 546);
println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))");
var res2 = ldb.search("(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))");
- if (res2.length != 1) {
+ if (res2.error != 0 || res2.msgs.length != 1) {
println("Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))");
- assert(res2.length == 1);
+ assert(res2.error == 0);
+ assert(res2.msgs.length == 1);
}
- assert(res[0].dn == res2[0].dn);
+ assert(res.msgs[0].dn == res2.msgs[0].dn);
if (gc_ldb != undefined) {
println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog");
var res2gc = gc_ldb.search("(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))");
- if (res2gc.length != 1) {
+ if (res2gc.error != 0 || res2gc.msgs.length != 1) {
println("Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog");
- assert(res2gc.length == 1);
+ assert(res2gc.error == 0);
+ assert(res2gc.msgs.length == 1);
}
- assert(res[0].dn == res2gc[0].dn);
+ assert(res.msgs[0].dn == res2gc.msgs[0].dn);
}
println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER))");
var res3 = ldb.search("(&(cn=ldaptestcomputer)(objectCategory=compuTER))");
- if (res3.length != 1) {
+ if (res3.error != 0 || res3.msgs.length != 1) {
println("Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER))");
- assert(res3.length == 1);
+ assert(res3.error == 0);
+ assert(res3.msgs.length == 1);
}
- assert(res[0].dn == res3[0].dn);
+ assert(res.msgs[0].dn == res3.msgs[0].dn);
if (gc_ldb != undefined) {
println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog");
var res3gc = gc_ldb.search("(&(cn=ldaptestcomputer)(objectCategory=compuTER))");
- if (res3gc.length != 1) {
+ if (res3gc.error != 0 || res3gc.msgs.length != 1) {
println("Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog");
- assert(res3gc.length == 1);
+ assert(res3gc.error == 0);
+ assert(res3gc.msgs.length == 1);
}
- assert(res[0].dn == res3gc[0].dn);
+ assert(res.msgs[0].dn == res3gc.msgs[0].dn);
}
println("Testing ldb.search for (&(cn=ldaptestcomp*r)(objectCategory=compuTER))");
var res4 = ldb.search("(&(cn=ldaptestcomp*r)(objectCategory=compuTER))");
- if (res4.length != 1) {
+ if (res4.error != 0 || res4.msgs.length != 1) {
println("Could not find (&(cn=ldaptestcomp*r)(objectCategory=compuTER))");
- assert(res4.length == 1);
+ assert(res4.error == 0);
+ assert(res4.msgs.length == 1);
}
- assert(res[0].dn == res4[0].dn);
+ assert(res.msgs[0].dn == res4.msgs[0].dn);
println("Testing ldb.search for (&(cn=ldaptestcomput*)(objectCategory=compuTER))");
var res5 = ldb.search("(&(cn=ldaptestcomput*)(objectCategory=compuTER))");
- if (res5.length != 1) {
+ if (res5.error != 0 || res5.msgs.length != 1) {
println("Could not find (&(cn=ldaptestcomput*)(objectCategory=compuTER))");
- assert(res5.length == 1);
+ assert(res5.error == 0);
+ assert(res5.msgs.length == 1);
}
- assert(res[0].dn == res5[0].dn);
+ assert(res.msgs[0].dn == res5.msgs[0].dn);
println("Testing ldb.search for (&(cn=*daptestcomputer)(objectCategory=compuTER))");
var res6 = ldb.search("(&(cn=*daptestcomputer)(objectCategory=compuTER))");
- if (res6.length != 1) {
+ if (res6.error != 0 || res6.msgs.length != 1) {
println("Could not find (&(cn=*daptestcomputer)(objectCategory=compuTER))");
- assert(res6.length == 1);
+ assert(res6.error == 0);
+ assert(res6.msgs.length == 1);
}
- assert(res[0].dn == res6[0].dn);
+ assert(res.msgs[0].dn == res6.msgs[0].dn);
- ok = ldb.del(res[0].dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ ok = ldb.del(res.msgs[0].dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
println("Testing ldb.search for (&(cn=ldaptest2computer)(objectClass=user))");
var res = ldb.search("(&(cn=ldaptest2computer)(objectClass=user))");
- if (res.length != 1) {
+ if (res.error != 0 || res.msgs.length != 1) {
println("Could not find (&(cn=ldaptest2computer)(objectClass=user))");
- assert(res.length == 1);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
}
- assert(res[0].dn == "cn=ldaptest2computer,cn=computers," + base_dn);
- assert(res[0].cn == "ldaptest2computer");
- assert(res[0].name == "ldaptest2computer");
- assert(res[0].objectClass[0] == "top");
- assert(res[0].objectClass[1] == "person");
- assert(res[0].objectClass[2] == "organizationalPerson");
- assert(res[0].objectClass[3] == "user");
- assert(res[0].objectClass[4] == "computer");
- assert(res[0].objectGUID != undefined);
- assert(res[0].whenCreated != undefined);
- assert(res[0].objectCategory == "cn=Computer,cn=Schema,cn=Configuration," + base_dn);
- assert(res[0].sAMAccountType == 805306369);
-// assert(res[0].userAccountControl == 4098);
+ assert(res.msgs[0].dn == "cn=ldaptest2computer,cn=computers," + base_dn);
+ assert(res.msgs[0].cn == "ldaptest2computer");
+ assert(res.msgs[0].name == "ldaptest2computer");
+ assert(res.msgs[0].objectClass[0] == "top");
+ assert(res.msgs[0].objectClass[1] == "person");
+ assert(res.msgs[0].objectClass[2] == "organizationalPerson");
+ assert(res.msgs[0].objectClass[3] == "user");
+ assert(res.msgs[0].objectClass[4] == "computer");
+ assert(res.msgs[0].objectGUID != undefined);
+ assert(res.msgs[0].whenCreated != undefined);
+ assert(res.msgs[0].objectCategory == "cn=Computer,cn=Schema,cn=Configuration," + base_dn);
+ assert(res.msgs[0].sAMAccountType == 805306369);
+// assert(res.msgs[0].userAccountControl == 4098);
println("Testing ldb.search for (&(cn=ldaptestUSer2)(objectClass=user))");
var res = ldb.search("(&(cn=ldaptestUSer2)(objectClass=user))");
- if (res.length != 1) {
+ if (res.error != 0 || res.msgs.length != 1) {
println("Could not find (&(cn=ldaptestUSer2)(objectClass=user))");
- assert(res.length == 1);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
}
- assert(res[0].dn == "cn=ldaptestuser2,cn=users," + base_dn);
- assert(res[0].cn == "ldaptestuser2");
- assert(res[0].name == "ldaptestuser2");
- assert(res[0].objectClass[0] == "top");
- assert(res[0].objectClass[1] == "person");
- assert(res[0].objectClass[2] == "organizationalPerson");
- assert(res[0].objectClass[3] == "user");
- assert(res[0].objectGUID != undefined);
- assert(res[0].whenCreated != undefined);
-
- ok = ldb.del(res[0].dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ assert(res.msgs[0].dn == "cn=ldaptestuser2,cn=users," + base_dn);
+ assert(res.msgs[0].cn == "ldaptestuser2");
+ assert(res.msgs[0].name == "ldaptestuser2");
+ assert(res.msgs[0].objectClass[0] == "top");
+ assert(res.msgs[0].objectClass[1] == "person");
+ assert(res.msgs[0].objectClass[2] == "organizationalPerson");
+ assert(res.msgs[0].objectClass[3] == "user");
+ assert(res.msgs[0].objectGUID != undefined);
+ assert(res.msgs[0].whenCreated != undefined);
+
+ ok = ldb.del(res.msgs[0].dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
println("Testing ldb.search for (&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))");
var res = ldb.search("(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))");
- if (res.length != 1) {
+ if (res.error != 0 || res.msgs.length != 1) {
println("Could not find (&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))");
- assert(res.length == 1);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
}
- assert(res[0].dn == "cn=ldaptestutf8user èùéìòà,cn=users," + base_dn);
- assert(res[0].cn == "ldaptestutf8user èùéìòà");
- assert(res[0].name == "ldaptestutf8user èùéìòà");
- assert(res[0].objectClass[0] == "top");
- assert(res[0].objectClass[1] == "person");
- assert(res[0].objectClass[2] == "organizationalPerson");
- assert(res[0].objectClass[3] == "user");
- assert(res[0].objectGUID != undefined);
- assert(res[0].whenCreated != undefined);
-
- ok = ldb.del(res[0].dn);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ assert(res.msgs[0].dn == "cn=ldaptestutf8user èùéìòà,cn=users," + base_dn);
+ assert(res.msgs[0].cn == "ldaptestutf8user èùéìòà");
+ assert(res.msgs[0].name == "ldaptestutf8user èùéìòà");
+ assert(res.msgs[0].objectClass[0] == "top");
+ assert(res.msgs[0].objectClass[1] == "person");
+ assert(res.msgs[0].objectClass[2] == "organizationalPerson");
+ assert(res.msgs[0].objectClass[3] == "user");
+ assert(res.msgs[0].objectGUID != undefined);
+ assert(res.msgs[0].whenCreated != undefined);
+
+ ok = ldb.del(res.msgs[0].dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
println("Testing ldb.search for (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))");
var res = ldb.search("(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))");
- if (res.length != 1) {
+ if (res.error != 0 || res.msgs.length != 1) {
println("Could not find (expect space collapse, win2k3 fails) (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))");
} else {
- assert(res[0].dn == "cn=ldaptestutf8user2 èùéìòà,cn=users," + base_dn);
- assert(res[0].cn == "ldaptestutf8user2 èùéìòà");
+ assert(res.msgs[0].dn == "cn=ldaptestutf8user2 èùéìòà,cn=users," + base_dn);
+ assert(res.msgs[0].cn == "ldaptestutf8user2 èùéìòà");
}
println("Testing that we can't get at the configuration DN from the main search base");
var attrs = new Array("cn");
var res = ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs);
- assert (res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
if (gc_ldb != undefined) {
println("Testing that we do find configuration elements in the global catlog");
var attrs = new Array("cn");
var res = gc_ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs);
- assert (res.length > 0);
+ assert(res.error == 0);
+ assert (res.msgs.length > 0);
println("Testing that we do find configuration elements and user elements at the same time");
var attrs = new Array("cn");
var res = gc_ldb.search("(|(objectClass=crossRef)(objectClass=person))", base_dn, ldb.SCOPE_SUBTREE, attrs);
- assert (res.length > 0);
+ assert(res.error == 0);
+ assert (res.msgs.length > 0);
println("Testing that we do find configuration elements in the global catlog, with the configuration basedn");
var attrs = new Array("cn");
var res = gc_ldb.search("objectClass=crossRef", configuration_dn, ldb.SCOPE_SUBTREE, attrs);
- assert (res.length > 0);
+ assert(res.error == 0);
+ assert (res.msgs.length > 0);
}
println("Testing that we can get at the configuration DN on the main LDAP port");
var attrs = new Array("cn");
var res = ldb.search("objectClass=crossRef", configuration_dn, ldb.SCOPE_SUBTREE, attrs);
- assert (res.length > 0);
+ assert(res.error == 0);
+ assert (res.msgs.length > 0);
}
@@ -427,40 +447,46 @@ function basedn_tests(ldb, gc_ldb)
println("Testing for all rootDSE attributes");
var attrs = new Array();
var res = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- assert(res.length == 1);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
println("Testing for highestCommittedUSN");
var attrs = new Array("highestCommittedUSN");
var res = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- assert(res.length == 1);
- assert(res[0].highestCommittedUSN != undefined);
- assert(res[0].highestCommittedUSN != 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].highestCommittedUSN != undefined);
+ assert(res.msgs[0].highestCommittedUSN != 0);
println("Testing for netlogon via LDAP");
var attrs = new Array("netlogon");
var res = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
println("Testing for netlogon and highestCommittedUSN via LDAP");
var attrs = new Array("netlogon", "highestCommittedUSN");
var res = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
}
function find_basedn(ldb)
{
var attrs = new Array("defaultNamingContext");
var res = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- assert(res.length == 1);
- return res[0].defaultNamingContext;
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ return res.msgs[0].defaultNamingContext;
}
function find_configurationdn(ldb)
{
var attrs = new Array("configurationNamingContext");
var res = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- assert(res.length == 1);
- return res[0].configurationNamingContext;
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ return res.msgs[0].configurationNamingContext;
}
/* use command line creds if available */
diff --git a/testprogs/ejs/ldb.js b/testprogs/ejs/ldb.js
index 06b6ec7f50..774219a1ab 100755
--- a/testprogs/ejs/ldb.js
+++ b/testprogs/ejs/ldb.js
@@ -32,33 +32,33 @@ dn: cn=x,cn=test
objectClass: foo
x: 3
");
- assert(ok);
+ assert(ok.error == 0);
println("Testing ldb.search");
var res = ldb.search("(objectClass=*)");
- assert(res[0].objectClass[0] == "foo");
- assert(res[0].dn == "cn=x,cn=test");
- assert(res[0].x == 3);
+ assert(res.msgs[0].objectClass[0] == "foo");
+ assert(res.msgs[0].dn == "cn=x,cn=test");
+ assert(res.msgs[0].x == 3);
ok = ldb.add("
dn: cn=x2,cn=test
objectClass: foo
x: 4
");
- assert(ok);
+ assert(ok.error == 0);
var attrs = new Array("x");
res = ldb.search("x=4", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res[0].x == 4);
- assert(res[0].objectClass == undefined);
- assert(res[0].dn == "cn=x2,cn=test");
+ assert(res.msgs[0].x == 4);
+ assert(res.msgs[0].objectClass == undefined);
+ assert(res.msgs[0].dn == "cn=x2,cn=test");
ok = ldb.del("cn=x,cn=test");
- assert(ok);
+ assert(ok.error == 0);
ok = ldb.rename("cn=x2,cn=test", "cn=x3,cn=test");
- assert(ok);
+ assert(ok.error == 0);
res = ldb.search("x=4", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res[0].dn == "cn=x3,cn=test");
+ assert(res.msgs[0].dn == "cn=x3,cn=test");
ok = ldb.modify("
dn: cn=x3,cn=test
@@ -68,13 +68,13 @@ x: 7
");
res = ldb.search("x=7");
- assert(res.length == 1);
- assert(res[0].x.length == 2);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].x.length == 2);
/* Check a few things before we add modules */
- assert(res[0].objectGUID == undefined);
- assert(res[0].createTimestamp == undefined);
- assert(res[0].whenCreated == undefined);
+ assert(res.msgs[0].objectGUID == undefined);
+ assert(res.msgs[0].createTimestamp == undefined);
+ assert(res.msgs[0].whenCreated == undefined);
}
@@ -111,23 +111,23 @@ dn: @ATTRIBUTES
cn: CASE_INSENSITIVE
caseattr: CASE_INSENSITIVE
");
- if (!ok) {
- println("Failed to add: " + ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println("Failed to add: " + ok.errstr);
+ assert(ok.error == 0);
}
/* Confirm that the attributes were replicated */
var res_attrs = parttestldb.search("cn=*", "@ATTRIBUTES", parttestldb.SCOPE_BASE);
- assert(res_attrs[0].cn == "CASE_INSENSITIVE");
+ assert(res_attrs.msgs[0].cn == "CASE_INSENSITIVE");
ok = ldb.add("
dn: cn=x8,cn=PartTest
objectClass: foo
x: 8
");
- if (!ok) {
- println("Failed to add: " + ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println("Failed to add: " + ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
@@ -136,9 +136,9 @@ objectClass: foo
x: 9
cn: X9
");
- if (!ok) {
- println("Failed to add: " + ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println("Failed to add: " + ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
@@ -147,59 +147,59 @@ objectClass: foo
x: 9
cn: X9
");
- if (ok) {
+ if (ok.error == 0) {
println("Should have failed to add cn=X9,cn=PartTest");
- assert(!ok);
+ assert(ok.error != 0);
}
var res = ldb.search("x=8", "cn=PartTest", ldb.SCOPE_DEFAULT);
- assert(res[0].objectGUID != undefined);
- assert(res[0].uSNCreated != undefined);
- assert(res[0].uSNChanged != undefined);
- assert(res[0].createTimestamp == undefined);
- assert(res[0].whenCreated != undefined);
- assert(res[0].name == "x8");
- assert(res[0].cn == "x8");
+ assert(res.msgs[0].objectGUID != undefined);
+ assert(res.msgs[0].uSNCreated != undefined);
+ assert(res.msgs[0].uSNChanged != undefined);
+ assert(res.msgs[0].createTimestamp == undefined);
+ assert(res.msgs[0].whenCreated != undefined);
+ assert(res.msgs[0].name == "x8");
+ assert(res.msgs[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");
+ assert(res_otherldb.msgs[0].objectGUID != undefined);
+ assert(res_otherldb.msgs[0].createTimestamp == undefined);
+ assert(res_otherldb.msgs[0].whenCreated != undefined);
+ assert(res_otherldb.msgs[0].name == "x8");
+ assert(res_otherldb.msgs[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);
- assert(res2[0].createTimestamp != undefined);
- assert(res2[0].whenCreated != undefined);
- assert(res2[0].name == "x9");
- assert(res2[0].cn == "x9");
+ assert(res2.msgs[0].objectGUID != undefined);
+ assert(res2.msgs[0].createTimestamp != undefined);
+ assert(res2.msgs[0].whenCreated != undefined);
+ assert(res2.msgs[0].name == "x9");
+ assert(res2.msgs[0].cn == "x9");
- assert(res[0].objectGUID != res2[0].objectGUID);
+ assert(res.msgs[0].objectGUID != res2.msgs[0].objectGUID);
var attrs = new Array("*");
var res3 = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- assert(res3[0].cn == undefined);
- assert(res3[0].distinguishedName == undefined);
- assert(res3[0].name == undefined);
- assert(res3[0].currentTime != undefined);
- assert(res3[0].highestCommittedUSN != undefined);
-
- assert(res3[0].namingContexts[0] == "cn=Sub,cn=Sub,cn=PartTest");
- assert(res3[0].namingContexts[1] == "cn=Sub,cn=PartTest");
- assert(res3[0].namingContexts[2] == "cn=PartTest");
- assert(res3[0].namingContexts[3] == "cn=SideTest");
- var usn = res3[0].highestCommittedUSN;
+ assert(res3.msgs[0].cn == undefined);
+ assert(res3.msgs[0].distinguishedName == undefined);
+ assert(res3.msgs[0].name == undefined);
+ assert(res3.msgs[0].currentTime != undefined);
+ assert(res3.msgs[0].highestCommittedUSN != undefined);
+
+ assert(res3.msgs[0].namingContexts[0] == "cn=Sub,cn=Sub,cn=PartTest");
+ assert(res3.msgs[0].namingContexts[1] == "cn=Sub,cn=PartTest");
+ assert(res3.msgs[0].namingContexts[2] == "cn=PartTest");
+ assert(res3.msgs[0].namingContexts[3] == "cn=SideTest");
+ var usn = res3.msgs[0].highestCommittedUSN;
/* Start a transaction. We are going to abort it later, to
* show we clean up all partitions */
ok = ldb.transaction_start()
if (!ok) {
- println("Failed to start a transaction: " + ldb.errstring());
- assert(ok);
+ println("Failed to start a transaction: " + ok.errstr);
+ assert(ok.error == 0);
}
@@ -208,53 +208,53 @@ dn: cn=x10,cn=parttest
objectClass: foo
x: 10
");
- if (!ok) {
- println("Failed to add: " + ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println("Failed to add: " + ok.errstr);
+ assert(ok.error == 0);
}
var attrs = new Array("highestCommittedUSN");
var res4 = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- var usn2 = res4[0].highestCommittedUSN;
- assert(usn < res4[0].highestCommittedUSN);
+ var usn2 = res4.msgs[0].highestCommittedUSN;
+ assert(usn < res4.msgs[0].highestCommittedUSN);
ok = ldb.add("
dn: cn=x11,cn=sub,cn=parttest
objectClass: foo
x: 11
");
- if (!ok) {
- println("Failed to add: " + ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println("Failed to add: " + ok.errstr);
+ assert(ok.error == 0);
}
var attrs = new Array("highestCommittedUSN");
var res5 = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- assert(usn2 < res5[0].highestCommittedUSN);
+ assert(usn2 < res5.msgs[0].highestCommittedUSN);
var attrs = new Array("*", "createTimestamp");
var res6 = ldb.search("x=11", "cn=parttest", ldb.SCOPE_SUB, attrs);
- assert(res6.length == 0);
+ assert(res6.msgs.length == 0);
var attrs = new Array("*", "createTimestamp");
var res7 = ldb.search("x=10", "cn=sub,cn=parttest", ldb.SCOPE_DEFAULT, attrs);
- assert(res7.length == 0);
+ assert(res7.msgs.length == 0);
var res8 = ldb.search("x=11", "cn=sub,cn=parttest", ldb.SCOPE_DEFAULT, attrs);
- assert(res8[0].objectGUID == undefined); /* The objectGUID module is not loaded here */
- assert(res8[0].uSNCreated == undefined); /* The objectGUID module is not loaded here */
- assert(res8[0].name == "x11");
- assert(res8[0].cn == "x11");
+ assert(res8.msgs[0].objectGUID == undefined); /* The objectGUID module is not loaded here */
+ assert(res8.msgs[0].uSNCreated == undefined); /* The objectGUID module is not loaded here */
+ assert(res8.msgs[0].name == "x11");
+ assert(res8.msgs[0].cn == "x11");
ok = ldb.add("
dn: caseattr=XY,cn=PartTest
objectClass: foo
x: Y
");
- if (!ok) {
- println("Failed to add: " + ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println("Failed to add: " + ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
@@ -263,9 +263,9 @@ objectClass: foo
x: Z
caseattr: XZ
");
- if (!ok) {
- println("Failed to add: " + ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println("Failed to add: " + ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
@@ -274,9 +274,9 @@ objectClass: foo
x: Z
caseattr: xz
");
- if (ok) {
+ if (ok.error == 0) {
println("Should have failed to add caseattr=xz,cn=PartTest");
- assert(!ok);
+ assert(ok.error != 0);
}
ok = ldb.add("
@@ -285,9 +285,9 @@ objectClass: foo
x: Z
caseattr2: XZ
");
- if (!ok) {
- println("Failed to add: " + ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println("Failed to add: " + ok.errstr);
+ assert(ok.error == 0);
}
ok = ldb.add("
@@ -296,35 +296,35 @@ objectClass: foo
x: Z
caseattr2: Xz
");
- if (!ok) {
- println("Failed to add: " + ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println("Failed to add: " + ok.errstr);
+ assert(ok.error == 0);
}
var resX = ldb.search("caseattr=xz", "cn=parttest", ldb.SCOPE_DEFAULT, attrs);
- assert(resX.length == 1);
- assert(resX[0].objectGUID != undefined);
- assert(resX[0].createTimestamp != undefined);
- assert(resX[0].whenCreated != undefined);
- assert(resX[0].name == "XZ");
+ assert(resX.msgs.length == 1);
+ assert(resX.msgs[0].objectGUID != undefined);
+ assert(resX.msgs[0].createTimestamp != undefined);
+ assert(resX.msgs[0].whenCreated != undefined);
+ assert(resX.msgs[0].name == "XZ");
var rescount = ldb.search("(|(caseattr=*)(cn=*))", "cn=parttest", ldb.SCOPE_DEFAULT, attrs);
- assert(rescount.length == 5);
+ assert(rescount.msgs.length == 5);
/* Check this attribute is *not* case sensitive */
var resXcount = ldb.search("caseattr=x*", "cn=parttest", ldb.SCOPE_DEFAULT, attrs);
- assert(resXcount.length == 2);
+ assert(resXcount.msgs.length == 2);
/* Check that this attribute *is* case sensitive */
var resXcount2 = ldb.search("caseattr2=xz", "cn=parttest", ldb.SCOPE_DEFAULT, attrs);
- assert(resXcount2.length == 0);
+ assert(resXcount2.msgs.length == 0);
/* Now abort the transaction to show that even with
* partitions, it is aborted everywhere */
ok = ldb.transaction_cancel();
if (!ok) {
- println("Failed to cancel a transaction: " + ldb.errstring());
+ println("Failed to cancel a transaction: " + ok.errstr);
assert(ok);
}
@@ -332,19 +332,19 @@ caseattr2: Xz
var attrs = new Array("highestCommittedUSN");
var res9 = ldb.search("", "", ldb.SCOPE_BASE, attrs);
- assert(usn == res9[0].highestCommittedUSN);
+ assert(usn == res9.msgs[0].highestCommittedUSN);
var attrs = new Array("*");
var res10 = ldb.search("x=11", "cn=sub,cn=parttest", ldb.SCOPE_DEFAULT, attrs);
- assert(res10.length == 0);
+ assert(res10.msgs.length == 0);
var attrs = new Array("*");
var res11 = ldb.search("x=10", "cn=parttest", ldb.SCOPE_DEFAULT, attrs);
- assert(res11.length == 0);
+ assert(res11.msgs.length == 0);
var attrs = new Array("*");
var res12 = ldb.search("caseattr=*", "cn=parttest", ldb.SCOPE_DEFAULT, attrs);
- assert(res12.length == 0);
+ assert(res12.msgs.length == 0);
}
diff --git a/testprogs/ejs/minschema.js b/testprogs/ejs/minschema.js
index 01fcc411c9..ffa6db6669 100755
--- a/testprogs/ejs/minschema.js
+++ b/testprogs/ejs/minschema.js
@@ -157,9 +157,9 @@ function get_object_cn(ldb, name) {
var res = ldb.search(sprintf("(ldapDisplayName=%s)", name), rootDse.schemaNamingContext, ldb.SCOPE_SUBTREE, attrs);
assert(res != undefined);
- assert(res.length == 1);
+ assert(res.msgs.length == 1);
- var cn = res[0]["cn"];
+ var cn = res.msgs[0]["cn"];
assert(cn != undefined);
if (typeof(cn) == "string") {
return cn;
@@ -287,8 +287,8 @@ function find_objectclass_properties(ldb, o) {
sprintf("(ldapDisplayName=%s)", o.name),
rootDse.schemaNamingContext, ldb.SCOPE_SUBTREE, class_attrs);
assert(res != undefined);
- assert(res.length == 1);
- var msg = res[0];
+ assert(res.msgs.length == 1);
+ var msg = res.msgs[0];
var a;
for (a in msg) {
o[a] = msg[a];
@@ -303,8 +303,8 @@ function find_attribute_properties(ldb, o) {
sprintf("(ldapDisplayName=%s)", o.name),
rootDse.schemaNamingContext, ldb.SCOPE_SUBTREE, attrib_attrs);
assert(res != undefined);
- assert(res.length == 1);
- var msg = res[0];
+ assert(res.msgs.length == 1);
+ var msg = res.msgs[0];
var a;
for (a in msg) {
/* special case for oMObjectClass, which is a binary object */
@@ -332,18 +332,18 @@ function find_objectclass_auto(ldb, o) {
var ldif = "dn: " + testdn;
ldif = ldif + "\nobjectClass: " + o.name;
ok = ldb.add(ldif);
- if (!ok) {
- dprintf("error adding %s: %s\n", o.name, ldb.errstring());
+ if (ok.error != 0) {
+ dprintf("error adding %s: %s\n", o.name, ok.errstr);
dprintf("%s\n", ldif);
return;
}
var res = ldb.search("", testdn, ldb.SCOPE_BASE);
ok = ldb.del(testdn);
- assert(ok);
+ assert(ok.error == 0);
var a;
- for (a in res[0]) {
+ for (a in res.msgs[0]) {
attributes[a].autocreate = true;
}
}
@@ -363,8 +363,8 @@ function expand_objectclass(ldb, o) {
var a;
dprintf("Expanding class %s\n", o.name);
assert(res != undefined);
- assert(res.length == 1);
- var msg = res[0];
+ assert(res.msgs.length == 1);
+ var msg = res.msgs[0];
for (a=0;a<attrs.length;a++) {
var aname = attrs[a];
if (msg[aname] == undefined) {
@@ -422,20 +422,20 @@ function walk_dn(ldb, dn) {
/* get a list of all possible attributes for this object */
var attrs = new Array("allowedAttributes");
var res = ldb.search("objectClass=*", dn, ldb.SCOPE_BASE, attrs);
- if (res == undefined) {
+ if (res.error != 0) {
dprintf("Unable to fetch allowedAttributes for '%s' - %s\n",
- dn, ldb.errstring());
+ dn, res.errstr);
return;
}
- var allattrs = res[0].allowedAttributes;
+ var allattrs = res.msgs[0].allowedAttributes;
res = ldb.search("objectClass=*", dn, ldb.SCOPE_BASE, allattrs);
- if (res == undefined) {
+ if (res.error != 0) {
dprintf("Unable to fetch all attributes for '%s' - %s\n",
- dn, ldb.errstring());
+ dn, res.errstr);
return;
}
var a;
- var msg = res[0];
+ var msg = res.msgs[0];
for (a in msg) {
if (attributes[a] == undefined) {
attributes[a] = obj_attribute(ldb, a);
@@ -449,23 +449,23 @@ function walk_dn(ldb, dn) {
function walk_naming_context(ldb, namingContext) {
var attrs = new Array("objectClass");
var res = ldb.search("objectClass=*", namingContext, ldb.SCOPE_DEFAULT, attrs);
- if (res == undefined) {
+ if (res.error != 0) {
dprintf("Unable to fetch objectClasses for '%s' - %s\n",
- namingContext, ldb.errstring());
+ namingContext, res.errstr);
return;
}
var r;
- for (r=0;r<res.length;r++) {
- var msg = res[r].objectClass;
+ for (r=0;r<res.msgs.length;r++) {
+ var msg = res.msgs[r].objectClass;
var c;
for (c=0;c<msg.length;c++) {
var objectClass = msg[c];
if (objectclasses[objectClass] == undefined) {
objectclasses[objectClass] = obj_objectClass(ldb, objectClass);
- objectclasses[objectClass].exampleDN = res[r].dn;
+ objectclasses[objectClass].exampleDN = res.msgs[r].dn;
}
}
- walk_dn(ldb, res[r].dn);
+ walk_dn(ldb, res.msgs[r].dn);
}
}
@@ -557,11 +557,11 @@ function build_objectclass(ldb, name) {
var res = ldb.search(
sprintf("(&(objectClass=classSchema)(ldapDisplayName=%s))", name),
rootDse.schemaNamingContext, ldb.SCOPE_SUBTREE, attrs);
- if (res == undefined) {
+ if (res.error != 0) {
dprintf("unknown class '%s'\n", name);
return undefined;
}
- if (res.length == 0) {
+ if (res.msgs.length == 0) {
dprintf("unknown class '%s'\n", name);
return undefined;
}
@@ -734,7 +734,7 @@ function load_list(file) {
/* get the rootDSE */
var res = ldb.search("", "", ldb.SCOPE_BASE);
-rootDse = res[0];
+rootDse = res.msgs[0];
/* load the list of classes we are interested in */
var classes = load_list(classfile);
diff --git a/testprogs/ejs/samba3sam.js b/testprogs/ejs/samba3sam.js
index 4c6f14b7b1..d69a1c1053 100755
--- a/testprogs/ejs/samba3sam.js
+++ b/testprogs/ejs/samba3sam.js
@@ -29,7 +29,7 @@ function setup_data(obj, ldif)
ldif = substitute_var(ldif, obj);
assert(ldif != undefined);
var ok = obj.db.add(ldif);
- assert(ok);
+ assert(ok.error == 0);
}
function setup_modules(ldb, s3, s4, ldif)
@@ -38,7 +38,7 @@ function setup_modules(ldb, s3, s4, ldif)
ldif = substitute_var(ldif, s4);
assert(ldif != undefined);
var ok = ldb.add(ldif);
- assert(ok);
+ assert(ok.error == 0);
var ldif = "
dn: @MAP=samba3sam
@@ -56,34 +56,37 @@ replicateEntries: @ATTRIBUTES
replicateEntries: @INDEXLIST
";
var ok = ldb.add(ldif);
- assert(ok);
+ assert(ok.error == 0);
}
function test_s3sam_search(ldb)
{
println("Looking up by non-mapped attribute");
var msg = ldb.search("(cn=Administrator)");
- assert(msg.length == 1);
- assert(msg[0].cn == "Administrator");
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 1);
+ assert(msg.msgs[0].cn == "Administrator");
println("Looking up by mapped attribute");
var msg = ldb.search("(name=Backup Operators)");
- assert(msg.length == 1);
- assert(msg[0].name == "Backup Operators");
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 1);
+ assert(msg.msgs[0].name == "Backup Operators");
println("Looking up by old name of renamed attribute");
var msg = ldb.search("(displayName=Backup Operators)");
- assert(msg.length == 0);
+ assert(msg.msgs.length == 0);
println("Looking up mapped entry containing SID");
var msg = ldb.search("(cn=Replicator)");
- assert(msg.length == 1);
- println(msg[0].dn);
- assert(msg[0].dn == "cn=Replicator,ou=Groups,dc=vernstok,dc=nl");
- assert(msg[0].objectSid == "S-1-5-21-4231626423-2410014848-2360679739-552");
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 1);
+ println(msg.msgs[0].dn);
+ assert(msg.msgs[0].dn == "cn=Replicator,ou=Groups,dc=vernstok,dc=nl");
+ assert(msg.msgs[0].objectSid == "S-1-5-21-4231626423-2410014848-2360679739-552");
println("Checking mapping of objectClass");
- var oc = msg[0].objectClass;
+ var oc = msg.msgs[0].objectClass;
assert(oc != undefined);
for (var i in oc) {
assert(oc[i] == "posixGroup" || oc[i] == "group");
@@ -91,11 +94,11 @@ function test_s3sam_search(ldb)
println("Looking up by objectClass");
var msg = ldb.search("(|(objectClass=user)(cn=Administrator))");
- assert(msg != undefined);
- assert(msg.length == 2);
- for (var i = 0; i < msg.length; i++) {
- assert((msg[i].dn == "unixName=Administrator,ou=Users,dc=vernstok,dc=nl") ||
- (msg[i].dn == "unixName=nobody,ou=Users,dc=vernstok,dc=nl"));
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 2);
+ for (var i = 0; i < msg.msgs.length; i++) {
+ assert((msg.msgs[i].dn == "unixName=Administrator,ou=Users,dc=vernstok,dc=nl") ||
+ (msg.msgs[i].dn == "unixName=nobody,ou=Users,dc=vernstok,dc=nl"));
}
}
@@ -110,9 +113,9 @@ blah: Blie
cn: Foo
showInAdvancedViewOnly: TRUE
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
println("Checking for existence of record (local)");
@@ -123,10 +126,11 @@ showInAdvancedViewOnly: TRUE
*/
var attrs = new Array('foo','blah','cn','showInAdvancedViewOnly');
msg = ldb.search("(cn=Foo)", "cn=Foo", ldb.LDB_SCOPE_BASE, attrs);
- assert(msg.length == 1);
- assert(msg[0].showInAdvancedViewOnly == "TRUE");
- assert(msg[0].foo == "bar");
- assert(msg[0].blah == "Blie");
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 1);
+ assert(msg.msgs[0].showInAdvancedViewOnly == "TRUE");
+ assert(msg.msgs[0].foo == "bar");
+ assert(msg.msgs[0].blah == "Blie");
println("Adding record that will be mapped");
ok = ldb.add("
@@ -136,37 +140,41 @@ unixName: bin
unicodePwd: geheim
cn: Niemand
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
- assert(ok);
+ assert(ok.error == 0);
println("Checking for existence of record (remote)");
msg = ldb.search("(unixName=bin)", new Array('unixName','cn','dn', 'unicodePwd'));
- assert(msg.length == 1);
- assert(msg[0].cn == "Niemand");
- assert(msg[0].unicodePwd == "geheim");
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 1);
+ assert(msg.msgs[0].cn == "Niemand");
+ assert(msg.msgs[0].unicodePwd == "geheim");
println("Checking for existence of record (local && remote)");
msg = ldb.search("(&(unixName=bin)(unicodePwd=geheim))", new Array('unixName','cn','dn', 'unicodePwd'));
- assert(msg.length == 1); // TODO: should check with more records
- assert(msg[0].cn == "Niemand");
- assert(msg[0].unixName == "bin");
- assert(msg[0].unicodePwd == "geheim");
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 1); // TODO: should check with more records
+ assert(msg.msgs[0].cn == "Niemand");
+ assert(msg.msgs[0].unixName == "bin");
+ assert(msg.msgs[0].unicodePwd == "geheim");
println("Checking for existence of record (local || remote)");
msg = ldb.search("(|(unixName=bin)(unicodePwd=geheim))", new Array('unixName','cn','dn', 'unicodePwd'));
- println("got " + msg.length + " replies");
- assert(msg.length == 1); // TODO: should check with more records
- assert(msg[0].cn == "Niemand");
- assert(msg[0].unixName == "bin" || msg[0].unicodePwd == "geheim");
+ println("got " + msg.msgs.length + " replies");
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 1); // TODO: should check with more records
+ assert(msg.msgs[0].cn == "Niemand");
+ assert(msg.msgs[0].unixName == "bin" || msg.msgs[0].unicodePwd == "geheim");
println("Checking for data in destination database");
msg = s3.db.search("(cn=Niemand)");
- assert(msg.length >= 1);
- assert(msg[0].sambaSID == "S-1-5-21-4231626423-2410014848-2360679739-2001");
- assert(msg[0].displayName == "Niemand");
+ assert(msg.error == 0);
+ assert(msg.msgs.length >= 1);
+ assert(msg.msgs[0].sambaSID == "S-1-5-21-4231626423-2410014848-2360679739-2001");
+ assert(msg.msgs[0].displayName == "Niemand");
println("Adding attribute...");
ok = ldb.modify("
@@ -175,17 +183,18 @@ changetype: modify
add: description
description: Blah
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
- assert(ok);
+ assert(ok.error == 0);
println("Checking whether changes are still there...");
msg = ldb.search("(cn=Niemand)");
- assert(msg.length >= 1);
- assert(msg[0].cn == "Niemand");
- assert(msg[0].description == "Blah");
+ assert(msg.error == 0);
+ assert(msg.msgs.length >= 1);
+ assert(msg.msgs[0].cn == "Niemand");
+ assert(msg.msgs[0].description == "Blah");
println("Modifying attribute...");
ok = ldb.modify("
@@ -194,16 +203,17 @@ changetype: modify
replace: description
description: Blie
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
- assert(ok);
+ assert(ok.error == 0);
println("Checking whether changes are still there...");
msg = ldb.search("(cn=Niemand)");
- assert(msg.length >= 1);
- assert(msg[0].description == "Blie");
+ assert(msg.error == 0);
+ assert(msg.msgs.length >= 1);
+ assert(msg.msgs[0].description == "Blie");
println("Deleting attribute...");
ok = ldb.modify("
@@ -211,36 +221,39 @@ dn: cn=Niemand,cn=Users,dc=vernstok,dc=nl
changetype: modify
delete: description
");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
- assert(ok);
+ assert(ok.error == 0);
println("Checking whether changes are no longer there...");
msg = ldb.search("(cn=Niemand)");
- assert(msg.length >= 1);
- assert(msg[0].description == undefined);
+ assert(msg.error == 0);
+ assert(msg.msgs.length >= 1);
+ assert(msg.msgs[0].description == undefined);
println("Renaming record...");
ok = ldb.rename("cn=Niemand,cn=Users,dc=vernstok,dc=nl", "cn=Niemand2,cn=Users,dc=vernstok,dc=nl");
- assert(ok);
+ assert(ok.error == 0);
println("Checking whether DN has changed...");
msg = ldb.search("(cn=Niemand2)");
- assert(msg.length == 1);
- assert(msg[0].dn == "cn=Niemand2,cn=Users,dc=vernstok,dc=nl");
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 1);
+ assert(msg.msgs[0].dn == "cn=Niemand2,cn=Users,dc=vernstok,dc=nl");
println("Deleting record...");
ok = ldb.del("cn=Niemand2,cn=Users,dc=vernstok,dc=nl");
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
println("Checking whether record is gone...");
msg = ldb.search("(cn=Niemand2)");
- assert(msg.length == 0);
+ assert(msg.error == 0);
+ assert(msg.msgs.length == 0);
}
function test_map_search(ldb, s3, s4)
@@ -287,9 +300,9 @@ description: y
ldif = substitute_var(ldif, s4);
assert(ldif != undefined);
var ok = ldb.add(ldif);
- if (!ok) {
- println(ldb.errstring());
- assert(ok);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
}
/* Add a set of remote records */
@@ -323,7 +336,7 @@ description: y
ldif = substitute_var(ldif, s3);
assert(ldif != undefined);
var ok = s3.db.add(ldif);
- assert(ok);
+ assert(ok.error == 0);
println("Testing search by DN");
@@ -331,81 +344,81 @@ description: y
dn = s4.dn("cn=A");
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "x");
/* Search remote record by remote DN */
dn = s3.dn("cn=A");
attrs = new Array("objectCategory", "lastLogon", "sambaLogonTime");
res = s3.db.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == undefined);
- assert(res[0].sambaLogonTime == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == undefined);
+ assert(res.msgs[0].sambaLogonTime == "x");
/* Search split record by local DN */
dn = s4.dn("cn=X");
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].objectCategory == "x");
- assert(res[0].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].objectCategory == "x");
+ assert(res.msgs[0].lastLogon == "x");
/* Search split record by remote DN */
dn = s3.dn("cn=X");
attrs = new Array("objectCategory", "lastLogon", "sambaLogonTime");
res = s3.db.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == undefined);
- assert(res[0].sambaLogonTime == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == undefined);
+ assert(res.msgs[0].sambaLogonTime == "x");
println("Testing search by attribute");
/* Search by ignored attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(revision=x)", NULL, ldb. SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=Y"));
- assert(res[0].objectCategory == "y");
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=X"));
- assert(res[1].objectCategory == "x");
- assert(res[1].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=Y"));
+ assert(res.msgs[0].objectCategory == "y");
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=X"));
+ assert(res.msgs[1].objectCategory == "x");
+ assert(res.msgs[1].lastLogon == "x");
/* Search by kept attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(description=y)", NULL, ldb. SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=Z"));
- assert(res[0].objectCategory == "z");
- assert(res[0].lastLogon == "z");
- assert(res[1].dn == s4.dn("cn=C"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=Z"));
+ assert(res.msgs[0].objectCategory == "z");
+ assert(res.msgs[0].lastLogon == "z");
+ assert(res.msgs[1].dn == s4.dn("cn=C"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "z");
/* Search by renamed attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(badPwdCount=x)", NULL, ldb. SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=B"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=A"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=B"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=A"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "x");
/* Search by converted attribute */
attrs = new Array("objectCategory", "lastLogon", "objectSid");
@@ -415,28 +428,28 @@ description: y
res = ldb.search("(objectSid=S-1-5-21-4231626423-2410014848-2360679739-552)", NULL, ldb. SCOPE_DEFAULT, attrs);
*/
res = ldb.search("(objectSid=*)", NULL, ldb. SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=X"));
- assert(res[0].objectCategory == "x");
- assert(res[0].lastLogon == "x");
- assert(res[0].objectSid == "S-1-5-21-4231626423-2410014848-2360679739-552");
- assert(res[1].dn == s4.dn("cn=A"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "x");
- assert(res[1].objectSid == "S-1-5-21-4231626423-2410014848-2360679739-552");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=X"));
+ assert(res.msgs[0].objectCategory == "x");
+ assert(res.msgs[0].lastLogon == "x");
+ assert(res.msgs[0].objectSid == "S-1-5-21-4231626423-2410014848-2360679739-552");
+ assert(res.msgs[1].dn == s4.dn("cn=A"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "x");
+ assert(res.msgs[1].objectSid == "S-1-5-21-4231626423-2410014848-2360679739-552");
/* Search by generated attribute */
/* In most cases, this even works when the mapping is missing
* a `convert_operator' by enumerating the remote db. */
attrs = new Array("objectCategory", "lastLogon", "primaryGroupID");
res = ldb.search("(primaryGroupID=512)", NULL, ldb. SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == s4.dn("cn=A"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "x");
- assert(res[0].primaryGroupID == "512");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == s4.dn("cn=A"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "x");
+ assert(res.msgs[0].primaryGroupID == "512");
/* TODO: There should actually be two results, A and X. The
* primaryGroupID of X seems to get corrupted somewhere, and the
@@ -445,10 +458,10 @@ description: y
* objectSid seems to be fine in the previous search for objectSid... */
/*
res = ldb.search("(primaryGroupID=*)", NULL, ldb. SCOPE_DEFAULT, attrs);
- println(res.length + " results found");
- for (i=0;i<res.length;i++) {
- for (obj in res[i]) {
- println(obj + ": " + res[i][obj]);
+ println(res.msgs.length + " results found");
+ for (i=0;i<res.msgs.length;i++) {
+ for (obj in res.msgs[i]) {
+ println(obj + ": " + res.msgs[i][obj]);
}
println("---");
}
@@ -457,293 +470,293 @@ description: y
/* Search by remote name of renamed attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(sambaBadPasswordCount=*)", "", ldb. SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Search by objectClass */
attrs = new Array("objectCategory", "lastLogon", "objectClass");
res = ldb.search("(objectClass=user)", NULL, ldb. SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=X"));
- assert(res[0].objectCategory == "x");
- assert(res[0].lastLogon == "x");
- assert(res[0].objectClass != undefined);
- assert(res[0].objectClass[3] == "user");
- assert(res[1].dn == s4.dn("cn=A"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "x");
- assert(res[1].objectClass != undefined);
- assert(res[1].objectClass[0] == "user");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=X"));
+ assert(res.msgs[0].objectCategory == "x");
+ assert(res.msgs[0].lastLogon == "x");
+ assert(res.msgs[0].objectClass != undefined);
+ assert(res.msgs[0].objectClass[3] == "user");
+ assert(res.msgs[1].dn == s4.dn("cn=A"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "x");
+ assert(res.msgs[1].objectClass != undefined);
+ assert(res.msgs[1].objectClass[0] == "user");
/* Prove that the objectClass is actually used for the search */
res = ldb.search("(|(objectClass=user)(badPwdCount=x))", NULL, ldb. SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 3);
- assert(res[0].dn == s4.dn("cn=B"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "y");
- assert(res[0].objectClass != undefined);
- for (i=0;i<res[0].objectClass.length;i++) {
- assert(res[0].objectClass[i] != "user");
+ assert(res.error == 0);
+ assert(res.msgs.length == 3);
+ assert(res.msgs[0].dn == s4.dn("cn=B"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[0].objectClass != undefined);
+ for (i=0;i<res.msgs[0].objectClass.length;i++) {
+ assert(res.msgs[0].objectClass[i] != "user");
}
- assert(res[1].dn == s4.dn("cn=X"));
- assert(res[1].objectCategory == "x");
- assert(res[1].lastLogon == "x");
- assert(res[1].objectClass != undefined);
- assert(res[1].objectClass[3] == "user");
- assert(res[2].dn == s4.dn("cn=A"));
- assert(res[2].objectCategory == undefined);
- assert(res[2].lastLogon == "x");
- assert(res[2].objectClass != undefined);
- assert(res[2].objectClass[0] == "user");
+ assert(res.msgs[1].dn == s4.dn("cn=X"));
+ assert(res.msgs[1].objectCategory == "x");
+ assert(res.msgs[1].lastLogon == "x");
+ assert(res.msgs[1].objectClass != undefined);
+ assert(res.msgs[1].objectClass[3] == "user");
+ assert(res.msgs[2].dn == s4.dn("cn=A"));
+ assert(res.msgs[2].objectCategory == undefined);
+ assert(res.msgs[2].lastLogon == "x");
+ assert(res.msgs[2].objectClass != undefined);
+ assert(res.msgs[2].objectClass[0] == "user");
println("Testing search by parse tree");
/* Search by conjunction of local attributes */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(&(codePage=x)(revision=x))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=Y"));
- assert(res[0].objectCategory == "y");
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=X"));
- assert(res[1].objectCategory == "x");
- assert(res[1].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=Y"));
+ assert(res.msgs[0].objectCategory == "y");
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=X"));
+ assert(res.msgs[1].objectCategory == "x");
+ assert(res.msgs[1].lastLogon == "x");
/* Search by conjunction of remote attributes */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(&(lastLogon=x)(description=x))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=X"));
- assert(res[0].objectCategory == "x");
- assert(res[0].lastLogon == "x");
- assert(res[1].dn == s4.dn("cn=A"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=X"));
+ assert(res.msgs[0].objectCategory == "x");
+ assert(res.msgs[0].lastLogon == "x");
+ assert(res.msgs[1].dn == s4.dn("cn=A"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "x");
/* Search by conjunction of local and remote attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(&(codePage=x)(description=x))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=Y"));
- assert(res[0].objectCategory == "y");
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=X"));
- assert(res[1].objectCategory == "x");
- assert(res[1].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=Y"));
+ assert(res.msgs[0].objectCategory == "y");
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=X"));
+ assert(res.msgs[1].objectCategory == "x");
+ assert(res.msgs[1].lastLogon == "x");
/* Search by conjunction of local and remote attribute w/o match */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(&(codePage=x)(nextRid=x))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
res = ldb.search("(&(revision=x)(lastLogon=z))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Search by disjunction of local attributes */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(|(revision=x)(objectCategory=x))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=Y"));
- assert(res[0].objectCategory == "y");
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=X"));
- assert(res[1].objectCategory == "x");
- assert(res[1].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=Y"));
+ assert(res.msgs[0].objectCategory == "y");
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=X"));
+ assert(res.msgs[1].objectCategory == "x");
+ assert(res.msgs[1].lastLogon == "x");
/* Search by disjunction of remote attributes */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(|(badPwdCount=x)(lastLogon=x))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 3);
- assert(res[0].dn == s4.dn("cn=B"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=X"));
- assert(res[1].objectCategory == "x");
- assert(res[1].lastLogon == "x");
- assert(res[2].dn == s4.dn("cn=A"));
- assert(res[2].objectCategory == undefined);
- assert(res[2].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 3);
+ assert(res.msgs[0].dn == s4.dn("cn=B"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=X"));
+ assert(res.msgs[1].objectCategory == "x");
+ assert(res.msgs[1].lastLogon == "x");
+ assert(res.msgs[2].dn == s4.dn("cn=A"));
+ assert(res.msgs[2].objectCategory == undefined);
+ assert(res.msgs[2].lastLogon == "x");
/* Search by disjunction of local and remote attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(|(revision=x)(lastLogon=y))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 3);
- assert(res[0].dn == s4.dn("cn=Y"));
- assert(res[0].objectCategory == "y");
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=B"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "y");
- assert(res[2].dn == s4.dn("cn=X"));
- assert(res[2].objectCategory == "x");
- assert(res[2].lastLogon == "x");
+ assert(res.error == 0);
+ assert(res.msgs.length == 3);
+ assert(res.msgs[0].dn == s4.dn("cn=Y"));
+ assert(res.msgs[0].objectCategory == "y");
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=B"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "y");
+ assert(res.msgs[2].dn == s4.dn("cn=X"));
+ assert(res.msgs[2].objectCategory == "x");
+ assert(res.msgs[2].lastLogon == "x");
/* Search by disjunction of local and remote attribute w/o match */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(|(codePage=y)(nextRid=z))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Search by negated local attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(!(revision=x))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 4);
- assert(res[0].dn == s4.dn("cn=B"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=A"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "x");
- assert(res[2].dn == s4.dn("cn=Z"));
- assert(res[2].objectCategory == "z");
- assert(res[2].lastLogon == "z");
- assert(res[3].dn == s4.dn("cn=C"));
- assert(res[3].objectCategory == undefined);
- assert(res[3].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs.length == 4);
+ assert(res.msgs[0].dn == s4.dn("cn=B"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=A"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "x");
+ assert(res.msgs[2].dn == s4.dn("cn=Z"));
+ assert(res.msgs[2].objectCategory == "z");
+ assert(res.msgs[2].lastLogon == "z");
+ assert(res.msgs[3].dn == s4.dn("cn=C"));
+ assert(res.msgs[3].objectCategory == undefined);
+ assert(res.msgs[3].lastLogon == "z");
/* Search by negated remote attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(!(description=x))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 2);
- assert(res[0].dn == s4.dn("cn=Z"));
- assert(res[0].objectCategory == "z");
- assert(res[0].lastLogon == "z");
- assert(res[1].dn == s4.dn("cn=C"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs.length == 2);
+ assert(res.msgs[0].dn == s4.dn("cn=Z"));
+ assert(res.msgs[0].objectCategory == "z");
+ assert(res.msgs[0].lastLogon == "z");
+ assert(res.msgs[1].dn == s4.dn("cn=C"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "z");
/* Search by negated conjunction of local attributes */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(!(&(codePage=x)(revision=x)))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 4);
- assert(res[0].dn == s4.dn("cn=B"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=A"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "x");
- assert(res[2].dn == s4.dn("cn=Z"));
- assert(res[2].objectCategory == "z");
- assert(res[2].lastLogon == "z");
- assert(res[3].dn == s4.dn("cn=C"));
- assert(res[3].objectCategory == undefined);
- assert(res[3].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs.length == 4);
+ assert(res.msgs[0].dn == s4.dn("cn=B"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=A"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "x");
+ assert(res.msgs[2].dn == s4.dn("cn=Z"));
+ assert(res.msgs[2].objectCategory == "z");
+ assert(res.msgs[2].lastLogon == "z");
+ assert(res.msgs[3].dn == s4.dn("cn=C"));
+ assert(res.msgs[3].objectCategory == undefined);
+ assert(res.msgs[3].lastLogon == "z");
/* Search by negated conjunction of remote attributes */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(!(&(lastLogon=x)(description=x)))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 4);
- assert(res[0].dn == s4.dn("cn=Y"));
- assert(res[0].objectCategory == "y");
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=B"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "y");
- assert(res[2].dn == s4.dn("cn=Z"));
- assert(res[2].objectCategory == "z");
- assert(res[2].lastLogon == "z");
- assert(res[3].dn == s4.dn("cn=C"));
- assert(res[3].objectCategory == undefined);
- assert(res[3].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs.length == 4);
+ assert(res.msgs[0].dn == s4.dn("cn=Y"));
+ assert(res.msgs[0].objectCategory == "y");
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=B"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "y");
+ assert(res.msgs[2].dn == s4.dn("cn=Z"));
+ assert(res.msgs[2].objectCategory == "z");
+ assert(res.msgs[2].lastLogon == "z");
+ assert(res.msgs[3].dn == s4.dn("cn=C"));
+ assert(res.msgs[3].objectCategory == undefined);
+ assert(res.msgs[3].lastLogon == "z");
/* Search by negated conjunction of local and remote attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(!(&(codePage=x)(description=x)))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 4);
- assert(res[0].dn == s4.dn("cn=B"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=A"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "x");
- assert(res[2].dn == s4.dn("cn=Z"));
- assert(res[2].objectCategory == "z");
- assert(res[2].lastLogon == "z");
- assert(res[3].dn == s4.dn("cn=C"));
- assert(res[3].objectCategory == undefined);
- assert(res[3].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs.length == 4);
+ assert(res.msgs[0].dn == s4.dn("cn=B"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=A"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "x");
+ assert(res.msgs[2].dn == s4.dn("cn=Z"));
+ assert(res.msgs[2].objectCategory == "z");
+ assert(res.msgs[2].lastLogon == "z");
+ assert(res.msgs[3].dn == s4.dn("cn=C"));
+ assert(res.msgs[3].objectCategory == undefined);
+ assert(res.msgs[3].lastLogon == "z");
/* Search by negated disjunction of local attributes */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(!(|(revision=x)(objectCategory=x)))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res[0].dn == s4.dn("cn=B"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=A"));
- assert(res[1].objectCategory == undefined);
- assert(res[1].lastLogon == "x");
- assert(res[2].dn == s4.dn("cn=Z"));
- assert(res[2].objectCategory == "z");
- assert(res[2].lastLogon == "z");
- assert(res[3].dn == s4.dn("cn=C"));
- assert(res[3].objectCategory == undefined);
- assert(res[3].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs[0].dn == s4.dn("cn=B"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=A"));
+ assert(res.msgs[1].objectCategory == undefined);
+ assert(res.msgs[1].lastLogon == "x");
+ assert(res.msgs[2].dn == s4.dn("cn=Z"));
+ assert(res.msgs[2].objectCategory == "z");
+ assert(res.msgs[2].lastLogon == "z");
+ assert(res.msgs[3].dn == s4.dn("cn=C"));
+ assert(res.msgs[3].objectCategory == undefined);
+ assert(res.msgs[3].lastLogon == "z");
/* Search by negated disjunction of remote attributes */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(!(|(badPwdCount=x)(lastLogon=x)))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 3);
- assert(res[0].dn == s4.dn("cn=Y"));
- assert(res[0].objectCategory == "y");
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=Z"));
- assert(res[1].objectCategory == "z");
- assert(res[1].lastLogon == "z");
- assert(res[2].dn == s4.dn("cn=C"));
- assert(res[2].objectCategory == undefined);
- assert(res[2].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs.length == 3);
+ assert(res.msgs[0].dn == s4.dn("cn=Y"));
+ assert(res.msgs[0].objectCategory == "y");
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=Z"));
+ assert(res.msgs[1].objectCategory == "z");
+ assert(res.msgs[1].lastLogon == "z");
+ assert(res.msgs[2].dn == s4.dn("cn=C"));
+ assert(res.msgs[2].objectCategory == undefined);
+ assert(res.msgs[2].lastLogon == "z");
/* Search by negated disjunction of local and remote attribute */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(!(|(revision=x)(lastLogon=y)))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 3);
- assert(res[0].dn == s4.dn("cn=A"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "x");
- assert(res[1].dn == s4.dn("cn=Z"));
- assert(res[1].objectCategory == "z");
- assert(res[1].lastLogon == "z");
- assert(res[2].dn == s4.dn("cn=C"));
- assert(res[2].objectCategory == undefined);
- assert(res[2].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs.length == 3);
+ assert(res.msgs[0].dn == s4.dn("cn=A"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "x");
+ assert(res.msgs[1].dn == s4.dn("cn=Z"));
+ assert(res.msgs[1].objectCategory == "z");
+ assert(res.msgs[1].lastLogon == "z");
+ assert(res.msgs[2].dn == s4.dn("cn=C"));
+ assert(res.msgs[2].objectCategory == undefined);
+ assert(res.msgs[2].lastLogon == "z");
/* Search by complex parse tree */
attrs = new Array("objectCategory", "lastLogon");
res = ldb.search("(|(&(revision=x)(objectCategory=x))(!(&(description=x)(nextRid=y)))(badPwdCount=y))", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 5);
- assert(res[0].dn == s4.dn("cn=B"));
- assert(res[0].objectCategory == undefined);
- assert(res[0].lastLogon == "y");
- assert(res[1].dn == s4.dn("cn=X"));
- assert(res[1].objectCategory == "x");
- assert(res[1].lastLogon == "x");
- assert(res[2].dn == s4.dn("cn=A"));
- assert(res[2].objectCategory == undefined);
- assert(res[2].lastLogon == "x");
- assert(res[3].dn == s4.dn("cn=Z"));
- assert(res[3].objectCategory == "z");
- assert(res[3].lastLogon == "z");
- assert(res[4].dn == s4.dn("cn=C"));
- assert(res[4].objectCategory == undefined);
- assert(res[4].lastLogon == "z");
+ assert(res.error == 0);
+ assert(res.msgs.length == 5);
+ assert(res.msgs[0].dn == s4.dn("cn=B"));
+ assert(res.msgs[0].objectCategory == undefined);
+ assert(res.msgs[0].lastLogon == "y");
+ assert(res.msgs[1].dn == s4.dn("cn=X"));
+ assert(res.msgs[1].objectCategory == "x");
+ assert(res.msgs[1].lastLogon == "x");
+ assert(res.msgs[2].dn == s4.dn("cn=A"));
+ assert(res.msgs[2].objectCategory == undefined);
+ assert(res.msgs[2].lastLogon == "x");
+ assert(res.msgs[3].dn == s4.dn("cn=Z"));
+ assert(res.msgs[3].objectCategory == "z");
+ assert(res.msgs[3].lastLogon == "z");
+ assert(res.msgs[4].dn == s4.dn("cn=C"));
+ assert(res.msgs[4].objectCategory == undefined);
+ assert(res.msgs[4].lastLogon == "z");
/* Clean up */
var dns = new Array();
@@ -755,7 +768,7 @@ description: y
dns[5] = s4.dn("cn=Z");
for (i=0;i<dns.length;i++) {
var ok = ldb.del(dns[i]);
- assert(ok);
+ assert(ok.error == 0);
}
}
@@ -781,24 +794,24 @@ revision: 1
description: test
";
ok = ldb.add(ldif);
- assert(ok);
+ assert(ok.error == 0);
/* Check it's there */
attrs = new Array("foo", "revision", "description");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].foo == "bar");
- assert(res[0].revision == "1");
- assert(res[0].description == "test");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].foo == "bar");
+ assert(res.msgs[0].revision == "1");
+ assert(res.msgs[0].description == "test");
/* Check it's not in the local db */
res = s4.db.search("(cn=test)", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Check it's not in the remote db */
res = s3.db.search("(cn=test)", NULL, ldb.SCOPE_DEFAULT, attrs);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Modify local record */
ldif = "
@@ -809,36 +822,36 @@ replace: description
description: foo
";
ok = ldb.modify(ldif);
- assert(ok);
+ assert(ok.error == 0);
/* Check in local db */
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].foo == "baz");
- assert(res[0].revision == "1");
- assert(res[0].description == "foo");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].foo == "baz");
+ assert(res.msgs[0].revision == "1");
+ assert(res.msgs[0].description == "foo");
/* Rename local record */
dn2 = "cn=toast,dc=idealx,dc=org";
ok = ldb.rename(dn, dn2);
- assert(ok);
+ assert(ok.error == 0);
/* Check in local db */
res = ldb.search("", dn2, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn2);
- assert(res[0].foo == "baz");
- assert(res[0].revision == "1");
- assert(res[0].description == "foo");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn2);
+ assert(res.msgs[0].foo == "baz");
+ assert(res.msgs[0].revision == "1");
+ assert(res.msgs[0].description == "foo");
/* Delete local record */
ok = ldb.del(dn2);
- assert(ok);
+ assert(ok.error == 0);
/* Check it's gone */
res = ldb.search("", dn2, ldb.SCOPE_BASE);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
println("Testing modification of remote records");
@@ -853,29 +866,29 @@ sambaBadPasswordCount: 3
sambaNextRid: 1001
";
ok = s3.db.add(ldif);
- assert(ok);
+ assert(ok.error == 0);
/* Check it's there */
attrs = new Array("description", "sambaBadPasswordCount", "sambaNextRid");
res = s3.db.search("", dn2, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn2);
- assert(res[0].description == "foo");
- assert(res[0].sambaBadPasswordCount == "3");
- assert(res[0].sambaNextRid == "1001");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn2);
+ assert(res.msgs[0].description == "foo");
+ assert(res.msgs[0].sambaBadPasswordCount == "3");
+ assert(res.msgs[0].sambaNextRid == "1001");
/* Check in mapped db */
attrs = new Array("description", "badPwdCount", "nextRid");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == "foo");
- assert(res[0].badPwdCount == "3");
- assert(res[0].nextRid == "1001");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == "foo");
+ assert(res.msgs[0].badPwdCount == "3");
+ assert(res.msgs[0].nextRid == "1001");
/* Check in local db */
res = s4.db.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Modify remote data of remote record */
ldif = "
@@ -889,58 +902,58 @@ badPwdCount: 4
/* Check in mapped db */
attrs = new Array("description", "badPwdCount", "nextRid");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == "test");
- assert(res[0].badPwdCount == "4");
- assert(res[0].nextRid == "1001");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].badPwdCount == "4");
+ assert(res.msgs[0].nextRid == "1001");
/* Check in remote db */
attrs = new Array("description", "sambaBadPasswordCount", "sambaNextRid");
res = s3.db.search("", dn2, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn2);
- assert(res[0].description == "test");
- assert(res[0].sambaBadPasswordCount == "4");
- assert(res[0].sambaNextRid == "1001");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn2);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].sambaBadPasswordCount == "4");
+ assert(res.msgs[0].sambaNextRid == "1001");
/* Rename remote record */
dn2 = s4.dn("cn=toast");
ok = ldb.rename(dn, dn2);
- assert(ok);
+ assert(ok.error == 0);
/* Check in mapped db */
dn = dn2;
attrs = new Array("description", "badPwdCount", "nextRid");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == "test");
- assert(res[0].badPwdCount == "4");
- assert(res[0].nextRid == "1001");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].badPwdCount == "4");
+ assert(res.msgs[0].nextRid == "1001");
/* Check in remote db */
dn2 = s3.dn("cn=toast");
attrs = new Array("description", "sambaBadPasswordCount", "sambaNextRid");
res = s3.db.search("", dn2, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn2);
- assert(res[0].description == "test");
- assert(res[0].sambaBadPasswordCount == "4");
- assert(res[0].sambaNextRid == "1001");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn2);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].sambaBadPasswordCount == "4");
+ assert(res.msgs[0].sambaNextRid == "1001");
/* Delete remote record */
ok = ldb.del(dn);
- assert(ok);
+ assert(ok.error == 0);
/* Check in mapped db */
res = ldb.search("", dn, ldb.SCOPE_BASE);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Check in remote db */
res = s3.db.search("", dn2, ldb.SCOPE_BASE);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Add remote record (same as before) */
dn = s4.dn("cn=test");
@@ -953,7 +966,7 @@ sambaBadPasswordCount: 3
sambaNextRid: 1001
";
ok = s3.db.add(ldif);
- assert(ok);
+ assert(ok.error == 0);
/* Modify local data of remote record */
ldif = "
@@ -967,29 +980,29 @@ description: test
/* Check in mapped db */
attrs = new Array("revision", "description");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == "test");
- assert(res[0].revision == "1");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].revision == "1");
/* Check in remote db */
res = s3.db.search("", dn2, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn2);
- assert(res[0].description == "test");
- assert(res[0].revision == undefined);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn2);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].revision == undefined);
/* Check in local db */
res = s4.db.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == undefined);
- assert(res[0].revision == "1");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == undefined);
+ assert(res.msgs[0].revision == "1");
/* Delete (newly) split record */
ok = ldb.del(dn);
- assert(ok);
+ assert(ok.error == 0);
println("Testing modification of split records");
@@ -1005,36 +1018,36 @@ nextRid: 1001
revision: 1
";
ok = ldb.add(ldif);
- assert(ok);
+ assert(ok.error == 0);
/* Check it's there */
attrs = new Array("description", "badPwdCount", "nextRid", "revision");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == "foo");
- assert(res[0].badPwdCount == "3");
- assert(res[0].nextRid == "1001");
- assert(res[0].revision == "1");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == "foo");
+ assert(res.msgs[0].badPwdCount == "3");
+ assert(res.msgs[0].nextRid == "1001");
+ assert(res.msgs[0].revision == "1");
/* Check in local db */
res = s4.db.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == undefined);
- assert(res[0].badPwdCount == undefined);
- assert(res[0].nextRid == undefined);
- assert(res[0].revision == "1");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == undefined);
+ assert(res.msgs[0].badPwdCount == undefined);
+ assert(res.msgs[0].nextRid == undefined);
+ assert(res.msgs[0].revision == "1");
/* Check in remote db */
attrs = new Array("description", "sambaBadPasswordCount", "sambaNextRid", "revision");
res = s3.db.search("", dn2, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn2);
- assert(res[0].description == "foo");
- assert(res[0].sambaBadPasswordCount == "3");
- assert(res[0].sambaNextRid == "1001");
- assert(res[0].revision == undefined);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn2);
+ assert(res.msgs[0].description == "foo");
+ assert(res.msgs[0].sambaBadPasswordCount == "3");
+ assert(res.msgs[0].sambaNextRid == "1001");
+ assert(res.msgs[0].revision == undefined);
/* Modify of split record */
ldif = "
@@ -1047,88 +1060,88 @@ replace: revision
revision: 2
";
ok = ldb.modify(ldif);
- assert(ok);
+ assert(ok.error == 0);
/* Check in mapped db */
attrs = new Array("description", "badPwdCount", "nextRid", "revision");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == "test");
- assert(res[0].badPwdCount == "4");
- assert(res[0].nextRid == "1001");
- assert(res[0].revision == "2");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].badPwdCount == "4");
+ assert(res.msgs[0].nextRid == "1001");
+ assert(res.msgs[0].revision == "2");
/* Check in local db */
res = s4.db.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == undefined);
- assert(res[0].badPwdCount == undefined);
- assert(res[0].nextRid == undefined);
- assert(res[0].revision == "2");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == undefined);
+ assert(res.msgs[0].badPwdCount == undefined);
+ assert(res.msgs[0].nextRid == undefined);
+ assert(res.msgs[0].revision == "2");
/* Check in remote db */
attrs = new Array("description", "sambaBadPasswordCount", "sambaNextRid", "revision");
res = s3.db.search("", dn2, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn2);
- assert(res[0].description == "test");
- assert(res[0].sambaBadPasswordCount == "4");
- assert(res[0].sambaNextRid == "1001");
- assert(res[0].revision == undefined);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn2);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].sambaBadPasswordCount == "4");
+ assert(res.msgs[0].sambaNextRid == "1001");
+ assert(res.msgs[0].revision == undefined);
/* Rename split record */
dn2 = s4.dn("cn=toast");
ok = ldb.rename(dn, dn2);
- assert(ok);
+ assert(ok.error == 0);
/* Check in mapped db */
dn = dn2;
attrs = new Array("description", "badPwdCount", "nextRid", "revision");
res = ldb.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == "test");
- assert(res[0].badPwdCount == "4");
- assert(res[0].nextRid == "1001");
- assert(res[0].revision == "2");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].badPwdCount == "4");
+ assert(res.msgs[0].nextRid == "1001");
+ assert(res.msgs[0].revision == "2");
/* Check in local db */
res = s4.db.search("", dn, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn);
- assert(res[0].description == undefined);
- assert(res[0].badPwdCount == undefined);
- assert(res[0].nextRid == undefined);
- assert(res[0].revision == "2");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn);
+ assert(res.msgs[0].description == undefined);
+ assert(res.msgs[0].badPwdCount == undefined);
+ assert(res.msgs[0].nextRid == undefined);
+ assert(res.msgs[0].revision == "2");
/* Check in remote db */
dn2 = s3.dn("cn=toast");
attrs = new Array("description", "sambaBadPasswordCount", "sambaNextRid", "revision");
res = s3.db.search("", dn2, ldb.SCOPE_BASE, attrs);
- assert(res != undefined);
- assert(res.length == 1);
- assert(res[0].dn == dn2);
- assert(res[0].description == "test");
- assert(res[0].sambaBadPasswordCount == "4");
- assert(res[0].sambaNextRid == "1001");
- assert(res[0].revision == undefined);
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ assert(res.msgs[0].dn == dn2);
+ assert(res.msgs[0].description == "test");
+ assert(res.msgs[0].sambaBadPasswordCount == "4");
+ assert(res.msgs[0].sambaNextRid == "1001");
+ assert(res.msgs[0].revision == undefined);
/* Delete split record */
ok = ldb.del(dn);
- assert(ok);
+ assert(ok.error == 0);
/* Check in mapped db */
res = ldb.search("", dn, ldb.SCOPE_BASE);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Check in local db */
res = s4.db.search("", dn, ldb.SCOPE_BASE);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
/* Check in remote db */
res = s3.db.search("", dn2, ldb.SCOPE_BASE);
- assert(res != undefined);
- assert(res.length == 0);
+ assert(res.error == 0);
+ assert(res.msgs.length == 0);
}
function make_dn(rdn)