summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-11-11 09:12:17 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-11-20 00:06:35 +0100
commit8585de88815490ed3c41571030bf20bff02a67d4 (patch)
tree26493df10fd50df51b8936718c51fbb1e1a088e1 /source4/dsdb
parentbb679a4da3a32c61529fb56a0cbc9f6d6668146e (diff)
downloadsamba-8585de88815490ed3c41571030bf20bff02a67d4.tar.gz
samba-8585de88815490ed3c41571030bf20bff02a67d4.tar.bz2
samba-8585de88815490ed3c41571030bf20bff02a67d4.zip
ldb:rdn_name LDB module - add more RDN name constraints
And some small cleanups Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date: Sat Nov 20 00:06:35 CET 2010 on sn-devel-104
Diffstat (limited to 'source4/dsdb')
-rwxr-xr-xsource4/dsdb/tests/python/ldap.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py
index d9a4f2a6b1..e148e99de6 100755
--- a/source4/dsdb/tests/python/ldap.py
+++ b/source4/dsdb/tests/python/ldap.py
@@ -887,6 +887,34 @@ objectClass: bootableDevice
"""Tests the RDN"""
print "Tests the RDN"""
+ # empty RDN
+ try:
+ self.ldb.add({
+ "dn": "=,cn=users," + self.base_dn,
+ "objectclass": "group"})
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_INVALID_DN_SYNTAX)
+
+ # empty RDN name
+ try:
+ self.ldb.add({
+ "dn": "=ldaptestgroup,cn=users," + self.base_dn,
+ "objectclass": "group"})
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_INVALID_DN_SYNTAX)
+
+ # empty RDN value
+ try:
+ self.ldb.add({
+ "dn": "cn=,cn=users," + self.base_dn,
+ "objectclass": "group"})
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_INVALID_DN_SYNTAX)
+
+ # a wrong RDN candidate
try:
self.ldb.add({
"dn": "description=xyz,cn=users," + self.base_dn,
@@ -910,6 +938,30 @@ objectClass: bootableDevice
self.assertTrue("name" in res[0])
self.assertTrue(res[0]["name"][0] == "ldaptestgroup")
+ # new empty RDN
+ try:
+ self.ldb.rename("cn=ldaptestgroup,cn=users," + self.base_dn,
+ "=,cn=users," + self.base_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_INVALID_DN_SYNTAX)
+
+ # new empty RDN name
+ try:
+ self.ldb.rename("cn=ldaptestgroup,cn=users," + self.base_dn,
+ "=ldaptestgroup,cn=users," + self.base_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_INVALID_DN_SYNTAX)
+
+ # new empty RDN value
+ try:
+ self.ldb.rename("cn=ldaptestgroup,cn=users," + self.base_dn,
+ "cn=,cn=users," + self.base_dn)
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_NAMING_VIOLATION)
+
m = Message()
m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
m["name"] = MessageElement("cn=ldaptestuser", FLAG_MOD_REPLACE,