summaryrefslogtreecommitdiff
path: root/testprogs/ejs
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-07-09 12:31:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:59:11 -0500
commit2d2cde7d95e0871ea66ce8186a54c3b28834051b (patch)
treef0cc4a6e2af5bf04d5891d923637e1603d8c307f /testprogs/ejs
parentb7b17c654da08e2abcad0e127ed30bb6991e64ab (diff)
downloadsamba-2d2cde7d95e0871ea66ce8186a54c3b28834051b.tar.gz
samba-2d2cde7d95e0871ea66ce8186a54c3b28834051b.tar.bz2
samba-2d2cde7d95e0871ea66ce8186a54c3b28834051b.zip
r23762: Fix DN renames over LDAP, and instrument the partition module. Add a
test to prove the behaviour of LDAP renames etc. Fix LDB to return correct error code when failing to rename one DN onto another. Andrew Bartlett (This used to be commit 3f3da9c4710b7752ed97f55c2fc3d32a63d352af)
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-xtestprogs/ejs/ldap.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
index 72d8c9acf8..a91285c3af 100755
--- a/testprogs/ejs/ldap.js
+++ b/testprogs/ejs/ldap.js
@@ -140,6 +140,60 @@ cn: LDAPtestUSER2
}
}
+ ok = ldb.del("cn=ldaptestuser3,cn=users," + base_dn);
+
+ ok = ldb.rename("cn=ldaptestuser2,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn);
+ if (ok.error != 0) {
+ println("Could not rename cn=ldaptestuser2,cn=users," + base_dn + " into cn=ldaptestuser3,cn=users," + base_dn + ": " + ok.errstr);
+ assert(ok.error == 0);
+ }
+
+ // ensure we cannot add it again
+ ok = ldb.add("
+dn: cn=ldaptestuser3,cn=users," + base_dn + "
+objectClass: person
+objectClass: user
+cn: LDAPtestUSER3
+");
+//LDB_ERR_ENTRY_ALREADY_EXISTS
+ if (ok.error != 68) {
+ println("expected error LDB_ERR_ENTRY_ALREADY_EXISTS, got: " + ok.errstr);
+ assert(ok.error == 68);
+ }
+
+ // rename back
+ ok = ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser2,cn=users," + base_dn);
+ if (ok.error != 0) {
+ println(ok.errstr);
+ assert(ok.error == 0);
+ }
+
+ // ensure we cannnot rename it twice
+ ok = ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser2,cn=users," + base_dn);
+//LDB_ERR_NO_SUCH_OBJECT
+ assert(ok.error == 32);
+
+ // ensure can now use that name
+ ok = ldb.add("
+dn: cn=ldaptestuser3,cn=users," + base_dn + "
+objectClass: person
+objectClass: user
+cn: LDAPtestUSER3
+");
+
+ // ensure we now cannnot rename
+ ok = ldb.rename("cn=ldaptestuser2,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn);
+//LDB_ERR_ENTRY_ALREADY_EXISTS
+ if (ok.error != 68) {
+ println("expected error LDB_ERR_ENTRY_ALREADY_EXISTS, got: " + ok.errstr);
+ assert(ok.error == 68);
+ }
+ assert(ok.error == 68);
+ ok = ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser3,cn=configuration," + base_dn);
+ assert(ok.error == 71);
+
+ ok = ldb.del("cn=ldaptestuser3,cn=users," + base_dn);
+
ok = ldb.add("
dn: cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn + "
objectClass: user