summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-08-15 13:14:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:53 -0500
commit0eb3ee32049eb5b76308e8ef4dc6af3db544afbb (patch)
treeffda8637719a563b96d74d14e1296ae378b1c79f /testprogs
parent449c9f1f1c03fdc026c56a900dd23b9506dbabf1 (diff)
downloadsamba-0eb3ee32049eb5b76308e8ef4dc6af3db544afbb.tar.gz
samba-0eb3ee32049eb5b76308e8ef4dc6af3db544afbb.tar.bz2
samba-0eb3ee32049eb5b76308e8ef4dc6af3db544afbb.zip
r24459: Fix up ldap.js and test_ldb.sh to test the domain_scope control, and
to test the behaviour of objectCategory=user searches. It turns out (thanks to a hint on http://blog.joeware.net/2005/12/08/147/) that objectCategory=user maps into objectCategory=CN=Person,... (by the defaultObjectCategory of that objectclass). Simplify the entryUUID module by using the fact that we now set the DN as the canoncical form of objectCategory. Andrew Bartlett (This used to be commit b474be9507df51982a604289215bb1868124fc24)
Diffstat (limited to 'testprogs')
-rwxr-xr-xtestprogs/blackbox/test_ldb.sh7
-rwxr-xr-xtestprogs/ejs/ldap.js46
2 files changed, 51 insertions, 2 deletions
diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh
index 6ebb6c143b..8a019e18b7 100755
--- a/testprogs/blackbox/test_ldb.sh
+++ b/testprogs/blackbox/test_ldb.sh
@@ -77,6 +77,13 @@ echo "Extended DN Control test returned 0 items"
failed=`expr $failed + 1`
fi
+echo "Test Domain scope Control"
+nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=domain_scope:1 '(objectclass=user)' | grep sAMAccountName | wc -l`
+if [ $nentries -lt 1 ]; then
+echo "Extended Domain scope Control test returned 0 items"
+failed=`expr $failed + 1`
+fi
+
echo "Test Attribute Scope Query Control"
nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=asq:1:member -s base -b "CN=Administrators,CN=Builtin,$BASEDN" | grep sAMAccountName | wc -l`
if [ $nentries -lt 1 ]; then
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
index 5735b8b391..6515c7abfe 100755
--- a/testprogs/ejs/ldap.js
+++ b/testprogs/ejs/ldap.js
@@ -439,7 +439,7 @@ objectClass: user
// assert(res.msgs[0].userAccountControl == 4098);
- var attrs = new Array("cn", "name", "objectClass", "objectGUID", "whenCreated", "ntSecurityDescriptor");
+ var attrs = new Array("cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor");
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) {
@@ -457,7 +457,8 @@ objectClass: user
assert(res.msgs[0].objectClass[3] == "user");
assert(res.msgs[0].objectGUID != undefined);
assert(res.msgs[0].whenCreated != undefined);
- assert(res.msgs[0].ntSecurityDescriptor != undefined);
+ assert(res.msgs[0].nTSecurityDescriptor != undefined);
+
ok = ldb.del(res.msgs[0].dn);
if (ok.error != 0) {
@@ -575,6 +576,47 @@ objectClass: user
assert(res.msgs[0].objectClass[0] == "top");
assert(res.msgs[0].objectClass[1] == "domain");
assert(res.msgs[0].objectClass[2] == "domainDNS");
+
+// check enumeration
+
+ var attrs = new Array("cn");
+ println("Testing ldb.search for objectCategory=person");
+ var res = ldb.search("objectCategory=person", base_dn, ldb.SCOPE_SUBTREE, attrs);
+ assert(res.error == 0);
+ assert(res.msgs.length > 0);
+
+ var attrs = new Array("cn");
+ var controls = new Array("domain_scope:1");
+ println("Testing ldb.search for objectCategory=person with domain scope control");
+ var res = ldb.search("objectCategory=person", base_dn, ldb.SCOPE_SUBTREE, attrs, controls);
+ assert(res.error == 0);
+ assert(res.msgs.length > 0);
+
+ var attrs = new Array("cn");
+ println("Testing ldb.search for objectCategory=user");
+ var res = ldb.search("objectCategory=user", base_dn, ldb.SCOPE_SUBTREE, attrs);
+ assert(res.error == 0);
+ assert(res.msgs.length > 0);
+
+ var attrs = new Array("cn");
+ var controls = new Array("domain_scope:1");
+ println("Testing ldb.search for objectCategory=user with domain scope control");
+ var res = ldb.search("objectCategory=user", base_dn, ldb.SCOPE_SUBTREE, attrs, controls);
+ assert(res.error == 0);
+ assert(res.msgs.length > 0);
+
+ var attrs = new Array("cn");
+ println("Testing ldb.search for objectCategory=group");
+ var res = ldb.search("objectCategory=group", base_dn, ldb.SCOPE_SUBTREE, attrs);
+ assert(res.error == 0);
+ assert(res.msgs.length > 0);
+
+ var attrs = new Array("cn");
+ var controls = new Array("domain_scope:1");
+ println("Testing ldb.search for objectCategory=group with domain scope control");
+ var res = ldb.search("objectCategory=group", base_dn, ldb.SCOPE_SUBTREE, attrs, controls);
+ assert(res.error == 0);
+ assert(res.msgs.length > 0);
}