summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-08-03 09:18:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:20 -0500
commit1057b4bea2351a898eb1b890612cefdfab98b743 (patch)
treee49553d4330df613de0597bdf9de99704dc5c086
parentadefa4404cb612d8066b3a19f6fd545428e6441b (diff)
downloadsamba-1057b4bea2351a898eb1b890612cefdfab98b743.tar.gz
samba-1057b4bea2351a898eb1b890612cefdfab98b743.tar.bz2
samba-1057b4bea2351a898eb1b890612cefdfab98b743.zip
r17380: An expanded test, cross-referencing the global catalog to the main port.
Andrew Bartlett (This used to be commit eadc24ed291dcdb456139a206c6c8acf92bab6da)
-rwxr-xr-xtestprogs/ejs/ldap.js73
1 files changed, 69 insertions, 4 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
index 0e7632aea1..37c109bbf4 100755
--- a/testprogs/ejs/ldap.js
+++ b/testprogs/ejs/ldap.js
@@ -5,6 +5,7 @@ exec smbscript "$0" ${1+"$@"}
*/
var ldb = ldb_init();
+var gc_ldb = ldb_init();
var options = GetOptions(ARGV,
"POPT_AUTOHELP",
@@ -24,7 +25,7 @@ if (options.ARGV.length != 1) {
var host = options.ARGV[0];
-function basic_tests(ldb, base_dn)
+function basic_tests(ldb, gc_ldb, base_dn, configuration_dn)
{
println("Running basic tests");
@@ -195,13 +196,22 @@ objectClass: user
println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon))");
var res3 = ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))");
- if (res.length != 1) {
+ if (res3.length != 1) {
println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon))");
- assert(res.length == 1);
+ assert(res3.length == 1);
}
assert(res[0].dn == res3[0].dn);
+ 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) {
+ println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog");
+ assert(res3gc.length == 1);
+ }
+
+ assert(res[0].dn == res3gc[0].dn);
+
ok = ldb.del(res[0].dn);
if (!ok) {
println(ldb.errstring());
@@ -238,6 +248,15 @@ objectClass: user
assert(res[0].dn == res2[0].dn);
+ 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) {
+ println("Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog");
+ assert(res2gc.length == 1);
+ }
+
+ assert(res[0].dn == res2[0].dn);
+
println("Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER))");
var res3 = ldb.search("(&(cn=ldaptestcomputer)(objectCategory=compuTER))");
if (res3.length != 1) {
@@ -247,6 +266,15 @@ objectClass: user
assert(res[0].dn == res3[0].dn);
+ 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) {
+ println("Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog");
+ assert(res3gc.length == 1);
+ }
+
+ assert(res[0].dn == res3gc[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) {
@@ -366,6 +394,31 @@ objectClass: user
assert(res[0].highestCommittedUSN != undefined);
assert(res[0].highestCommittedUSN != 0);
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
}
function find_basedn(ldb)
@@ -376,14 +429,26 @@ function find_basedn(ldb)
return res[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;
+}
+
/* use command line creds if available */
ldb.credentials = options.get_credentials();
+gc_ldb.credentials = options.get_credentials();
var ok = ldb.connect("ldap://" + host);
var base_dn = find_basedn(ldb);
+var configuration_dn = find_configurationdn(ldb);
printf("baseDN: %s\n", base_dn);
-basic_tests(ldb, base_dn)
+var ok = gc_ldb.connect("ldap://" + host + ":3268");
+
+basic_tests(ldb, gc_ldb, base_dn, configuration_dn)
return 0;