summaryrefslogtreecommitdiff
path: root/testprogs/ejs/ldap.js
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-07-25 01:17:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:30:00 -0500
commita7f9d9c5b8e77e0530ace68bd2ed4a7c374bf0fa (patch)
tree96bb2ff20365611d7587d79aaaa41791c135c59e /testprogs/ejs/ldap.js
parent77e52a4e2c4587785930491695486b2d8b26b509 (diff)
downloadsamba-a7f9d9c5b8e77e0530ace68bd2ed4a7c374bf0fa.tar.gz
samba-a7f9d9c5b8e77e0530ace68bd2ed4a7c374bf0fa.tar.bz2
samba-a7f9d9c5b8e77e0530ace68bd2ed4a7c374bf0fa.zip
r8740: Extend the rdn_name module to handle adding the rdn as an attribute. ie:
dn: cn=foo,ou=bar objectClass: person implies dn: cn=foo,ou=bar objectClass: person cn: foo (as well as a pile more default attributes) We also correct the case in the attirbute to match that in the DN (win2k3 behaviour) and I have a testsuite (in ejs) to prove it. This module also found a bug in our provision.ldif, so and reduces code complexity in the samdb module. Andrew Bartlett (This used to be commit 0cc58f5c3cce12341ad0f7a90cdd85a3fab786b3)
Diffstat (limited to 'testprogs/ejs/ldap.js')
-rwxr-xr-xtestprogs/ejs/ldap.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
new file mode 100755
index 0000000000..bba81f3971
--- /dev/null
+++ b/testprogs/ejs/ldap.js
@@ -0,0 +1,56 @@
+#!/bin/sh
+exec smbscript "$0" ${1+"$@"}
+/*
+ test certin LDAP behaviours
+*/
+
+var ldb = ldb_init();
+
+var options = new Object();
+
+ok = GetOptions(ARGV, options,
+ "POPT_AUTOHELP",
+ "POPT_COMMON_SAMBA",
+ "POPT_COMMON_CREDENTIALS");
+if (ok == false) {
+ println("Failed to parse options: " + options.ERROR);
+ return -1;
+}
+
+if (options.ARGV.length != 2) {
+ println("Usage: ldap.js <BASEDN> <HOST>");
+ return -1;
+}
+
+var base_dn = options.ARGV[0];
+var host = options.ARGV[1];
+
+function basic_tests(ldb, base_dn)
+{
+ println("Running basic tests");
+
+ ldb.del("cn=ldaptestuser,cn=users," + base_dn);
+
+ ok = ldb.add("
+dn: cn=ldaptestuser,cn=users," + base_dn + "
+objectClass: user
+objectClass: person
+cn: LDAPtestUSER
+");
+ assert(ok);
+
+ println("Testing ldb.search");
+ var res = ldb.search("(&(cn=ldaptestuser)(objectClass=user))");
+
+ assert(res[0].dn == "cn=ldaptestuser,cn=users," + base_dn);
+ assert(res[0].cn == "ldaptestuser");
+ assert(res[0].name == "ldaptestuser");
+ assert(res[0].objectGUID != undefined);
+ assert(res[0].whenCreated != undefined);
+
+}
+
+var ok = ldb.connect("ldap://" + host);
+basic_tests(ldb, base_dn)
+
+return 0;