summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-08-29 01:40:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:03:05 -0500
commit4e1d0cc8e3b7bfb51845fbe836812f7558c30c10 (patch)
tree02cf38fc0237937708fa179b29be9ddfe60ebba8 /testprogs
parentf681306335eaf6b33d6fcaa70ac29a8cf1f5889f (diff)
downloadsamba-4e1d0cc8e3b7bfb51845fbe836812f7558c30c10.tar.gz
samba-4e1d0cc8e3b7bfb51845fbe836812f7558c30c10.tar.bz2
samba-4e1d0cc8e3b7bfb51845fbe836812f7558c30c10.zip
r24761: Permit subtree renames in Samba4.
The module is scary: On a rename, it does a search for all entries under that entry (including itself), and fires off a seperate rename call for each result. This will fail miserably on an LDAP backend, but I'll need to work on using hdb for OpenLDAP, and hope Fedora DS can implement subtree renames at some point. Andrew Bartlett (This used to be commit 13908a8cb4dd810503213203efb8d51f77f1f379)
Diffstat (limited to 'testprogs')
-rwxr-xr-xtestprogs/ejs/ldap.js67
1 files changed, 66 insertions, 1 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
index 6515c7abfe..83df3b1cec 100755
--- a/testprogs/ejs/ldap.js
+++ b/testprogs/ejs/ldap.js
@@ -196,9 +196,74 @@ cn: LDAPtestUSER3
}
assert(ok.error == 71 || ok.error == 64);
- ok = ldb.del("cn=ldaptestuser3,cn=users," + base_dn);
+ ok = ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser5,cn=users," + base_dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+
+ ok = ldb.del("cn=ldaptestuser5,cn=users," + base_dn);
ok = ldb.add("
+dn: cn=ldaptestcontainer," + base_dn + "
+objectClass: container
+");
+
+ ok = ldb.add("
+dn: cn=ldaptestuser4,cn=ldaptestcontainer," + base_dn + "
+objectClass: person
+objectClass: user
+cn: LDAPtestUSER4
+");
+ if (ok.error != 0) {
+ ok = ldb.del("cn=ldaptestuser4,cn=ldaptestcontainer," + base_dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+ ok = ldb.add("
+dn: cn=ldaptestuser4,cn=ldaptestcontainer," + base_dn + "
+objectClass: person
+objectClass: user
+cn: LDAPtestUSER4
+");
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+ }
+
+ println("Testing ldb.rename of cn=ldaptestcontainer," + base_dn + "to cn=ldaptestcontainer2," + base_dn);
+ ok = ldb.rename("cn=ldaptestcontainer," + base_dn, "cn=ldaptestcontainer2," + base_dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+
+ println("Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in renamed container");
+ var res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))");
+ if (res.error != 0 || res.msgs.length != 1) {
+ println("Could not find (&(cn=ldaptestuser4)(objectClass=user))");
+ assert(res.error == 0);
+ assert(res.msgs.length == 1);
+ }
+
+ assert(res.msgs[0].dn == "cn=ldaptestuser4,cn=ldaptestcontainer2," + base_dn);
+
+ println("Testing delete of subtree renamed "+res.msgs[0].dn);
+ ok = ldb.del(res.msgs[0].dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+ println("Testing delete of renamed cn=ldaptestcontainer2," + base_dn);
+ ok = ldb.del("cn=ldaptestcontainer2," + base_dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+
+ ok = ldb.add("
dn: cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn + "
objectClass: user
");