summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-25 02:23:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:30:01 -0500
commit52371753bd93a598bf27ed1b47860bd82c826d05 (patch)
tree015262baf85e74983bda9cbb85b1bf839dd76fc3 /testprogs
parent8fbcde9450037115aeab087395575dc027b213a6 (diff)
downloadsamba-52371753bd93a598bf27ed1b47860bd82c826d05.tar.gz
samba-52371753bd93a598bf27ed1b47860bd82c826d05.tar.bz2
samba-52371753bd93a598bf27ed1b47860bd82c826d05.zip
r8743: automatically find the basedn in ldap.js
(This used to be commit bdca9537a260369a53cbb286642db86bc3ea0828)
Diffstat (limited to 'testprogs')
-rwxr-xr-xtestprogs/ejs/ldap.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
index bba81f3971..bf9b4ac105 100755
--- a/testprogs/ejs/ldap.js
+++ b/testprogs/ejs/ldap.js
@@ -17,13 +17,12 @@ if (ok == false) {
return -1;
}
-if (options.ARGV.length != 2) {
- println("Usage: ldap.js <BASEDN> <HOST>");
+if (options.ARGV.length != 1) {
+ println("Usage: ldap.js <HOST>");
return -1;
}
-var base_dn = options.ARGV[0];
-var host = options.ARGV[1];
+var host = options.ARGV[0];
function basic_tests(ldb, base_dn)
{
@@ -50,7 +49,17 @@ cn: LDAPtestUSER
}
+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;
+}
+
var ok = ldb.connect("ldap://" + host);
+var base_dn = find_basedn(ldb);
+
basic_tests(ldb, base_dn)
return 0;