summaryrefslogtreecommitdiff
path: root/testprogs/ejs
diff options
context:
space:
mode:
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-xtestprogs/ejs/ldap.js67
1 files changed, 65 insertions, 2 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
index b5c73e4f65..c18e293780 100755
--- a/testprogs/ejs/ldap.js
+++ b/testprogs/ejs/ldap.js
@@ -55,6 +55,30 @@ cN: LDAPtestUSER
}
}
+ ldb.del("cn=ldaptestgroup,cn=users," + base_dn);
+
+ var ok = ldb.add("
+dn: cn=ldaptestgroup,cn=uSers," + base_dn + "
+objectclass: group
+member: cn=ldaptestuser,cn=useRs," + base_dn + "
+");
+ if (ok.error != 0) {
+ ok = ldb.del("cn=ldaptestgroup,cn=users," + base_dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+ ok = ldb.add("
+dn: cn=ldaptestgroup,cn=uSers," + base_dn + "
+objectclass: group
+member: cn=ldaptestuser,cn=useRs," + base_dn + "
+");
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+ }
+
var ok = ldb.add("
dn: cn=ldaptestcomputer,cn=computers," + base_dn + "
objectclass: computer
@@ -77,6 +101,11 @@ cn: LDAPtestCOMPUTER
}
}
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+
var ok = ldb.add("
dn: cn=ldaptest2computer,cn=computers," + base_dn + "
objectClass: computer
@@ -140,6 +169,20 @@ cn: LDAPtestUSER2
}
}
+ println("Testing Group Modifies");
+ ok = ldb.modify("
+dn: cn=ldaptestgroup,cn=users," + base_dn + "
+changetype: modify
+add: member
+member: cn=ldaptestuser2,cn=users," + base_dn + "
+member: cn=ldaptestcomputer,cn=computers," + base_dn + "
+");
+
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+
ok = ldb.del("cn=ldaptestuser3,cn=users," + base_dn);
println("Testing Renames");
@@ -230,6 +273,14 @@ cn: LDAPtestUSER3
ok = ldb.del("cn=ldaptestuser5,cn=users," + base_dn);
+ ok = ldb.del("cn=ldaptestgroup2,cn=users," + base_dn);
+
+ ok = ldb.rename("cn=ldaptestgroup,cn=users," + base_dn, "cn=ldaptestgroup2,cn=users," + base_dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+
println("Testing subtree Renames");
ok = ldb.add("
@@ -562,7 +613,13 @@ objectClass: user
// assert(res.msgs[0].userAccountControl == 4098);
- var attrs = new Array("cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor");
+ ok = ldb.del(res.msgs[0].dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+
+ var attrs = new Array("cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "memberOf");
println("Testing ldb.search for (&(cn=ldaptestUSer2)(objectClass=user))");
var res = ldb.search("(&(cn=ldaptestUSer2)(objectClass=user))", base_dn, ldb.SCOPE_SUBTREE, attrs);
if (res.error != 0 || res.msgs.length != 1) {
@@ -581,7 +638,7 @@ objectClass: user
assert(res.msgs[0].objectGUID != undefined);
assert(res.msgs[0].whenCreated != undefined);
assert(res.msgs[0].nTSecurityDescriptor != undefined);
-
+ assert(res.msgs[0].memberOf[0] == ("CN=ldaptestgroup2,CN=Users," + base_dn));
ok = ldb.del(res.msgs[0].dn);
if (ok.error != 0) {
@@ -614,6 +671,12 @@ objectClass: user
assert(ok.error == 0);
}
+ ok = ldb.del(("CN=ldaptestgroup2,CN=Users," + base_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))");