summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-11-15 02:46:13 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:45:19 +0100
commit3b6ff04631e51cfae9844db7ec7f49d6cdd03f1f (patch)
tree4ea0619042bde5ae7af8fae4d01f5b43aac26238
parentbd6a651b38446512af4982a376ddead658b6ee74 (diff)
downloadsamba-3b6ff04631e51cfae9844db7ec7f49d6cdd03f1f.tar.gz
samba-3b6ff04631e51cfae9844db7ec7f49d6cdd03f1f.tar.bz2
samba-3b6ff04631e51cfae9844db7ec7f49d6cdd03f1f.zip
r25961: Add new tests to verify basedn validation in LDAP searches.
Andrew Bartlett (This used to be commit e178df4a180e7ce3eba1a14fb45b2fcc582f06c3)
-rwxr-xr-xtestprogs/ejs/ldap.js43
1 files changed, 40 insertions, 3 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
index c012f84bf0..ddf5d814f5 100755
--- a/testprogs/ejs/ldap.js
+++ b/testprogs/ejs/ldap.js
@@ -45,6 +45,7 @@ member: cn=ldaptestuser,cn=useRs," + base_dn + "
assert(ok.error == 32);
}
+ println("Testing user add");
var ok = ldb.add("
dn: cn=ldaptestuser,cn=uSers," + base_dn + "
objectclass: user
@@ -339,7 +340,19 @@ cn: LDAPtestUSER4
assert(res.msgs.length == 1);
}
- assert(res.msgs[0].dn == ("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn));
+ println("Testing subtree ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + base_dn);
+ var res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer," + base_dn, ldb.SCOPE_SUBTREE);
+ if (res.error != 32) {
+ println(res.errstr);
+ assert(res.error == 32);
+ }
+
+ println("Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + base_dn);
+ var res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer," + base_dn, ldb.SCOPE_ONELEVEL);
+ if (res.error != 32) {
+ println(res.errstr);
+ assert(res.error == 32);
+ }
println("Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in renamed container");
var res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer2," + base_dn, ldb.SCOPE_SUBTREE);
@@ -371,8 +384,31 @@ cn: LDAPtestUSER4
println(ok.errstr);
assert(ok.error == 66);
}
- println("Testing delete of subtree renamed "+res.msgs[0].dn);
- ok = ldb.del(res.msgs[0].dn);
+
+ println("Testing base ldb.search for CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn);
+ var res = ldb.search("(objectclass=*)", ("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), ldb.SCOPE_BASE);
+ if (res.error == 0 && res.count == 1) {
+ assert(res.error == 0 && res.count == 1);
+ }
+ var res = ldb.search("(cn=ldaptestuser40)", ("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), ldb.SCOPE_BASE);
+ if (res.error == 0 && res.count == 0) {
+ assert(res.error == 0 && res.count == 0);
+ }
+
+ println("Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + base_dn);
+ var res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer2," + base_dn, ldb.SCOPE_ONELEVEL);
+ if (res.error == 0 && res.count == 0) {
+ assert(res.error == 0 && res.count == 0);
+ }
+
+ println("Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + base_dn);
+ var res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer2," + base_dn, ldb.SCOPE_SUBTREE);
+ if (res.error == 0 && res.count == 0) {
+ assert(res.error == 0 && res.count == 0);
+ }
+
+ println("Testing delete of subtree renamed "+("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn));
+ ok = ldb.del(("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn));
if (ok.error != 0) {
println(ok.errstr);
assert(ok.error == 0);
@@ -904,6 +940,7 @@ gc_ldb.credentials = options.get_credentials();
var ok = ldb.connect("ldap://" + host);
var base_dn = find_basedn(ldb);
+
var configuration_dn = find_configurationdn(ldb);
var schema_dn = find_schemadn(ldb);