summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-10-13 09:51:18 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2011-10-27 18:52:29 +0200
commitd95b4c94978fad40b6cb052522aa191fe77c6663 (patch)
treea9412d0ecb8b8bce5d293f2390334af690cb946a /source4
parent6287d0d61c1b63f399edc901133a6f61069224a6 (diff)
downloadsamba-d95b4c94978fad40b6cb052522aa191fe77c6663.tar.gz
samba-d95b4c94978fad40b6cb052522aa191fe77c6663.tar.bz2
samba-d95b4c94978fad40b6cb052522aa191fe77c6663.zip
s4:ldap.py - fix up the dSHeuristics test to check for the right behaviour
Reviewed-by: abartlet
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/dsdb/tests/python/ldap.py42
1 files changed, 27 insertions, 15 deletions
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py
index 20e05faaf5..9009c74e52 100755
--- a/source4/dsdb/tests/python/ldap.py
+++ b/source4/dsdb/tests/python/ldap.py
@@ -2716,21 +2716,33 @@ nTSecurityDescriptor:: """ + desc_base64
# Get the current value to restore it later
dsheuristics = self.ldb.get_dsheuristics()
- # Should not be longer than 18 chars?
- try:
- self.ldb.set_dsheuristics("123ABC-+!1asdfg@#^12")
- except LdbError, (num, _):
- self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
- # If it is >= 10 chars, tenthChar should be 1
- try:
- self.ldb.set_dsheuristics("00020000000002")
- except LdbError, (num, _):
- self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
- # apart from the above, all char values are accepted
- self.ldb.set_dsheuristics("123ABC-+!1asdfg@#^")
- self.assertEquals(self.ldb.get_dsheuristics(), "123ABC-+!1asdfg@#^")
- # restore old value
- self.ldb.set_dsheuristics(dsheuristics)
+ # Perform the length checks: for each decade (except the 0th) we need
+ # the first index to be the number. This goes till the 9th one, beyond
+ # there does not seem to be another limitation.
+ try:
+ dshstr = ""
+ for i in range(1,11):
+ # This is in the range
+ self.ldb.set_dsheuristics(dshstr + "x")
+ self.ldb.set_dsheuristics(dshstr + "xxxxx")
+ dshstr = dshstr + "xxxxxxxxx"
+ if i < 10:
+ # Not anymore in the range, new decade specifier needed
+ try:
+ self.ldb.set_dsheuristics(dshstr + "x")
+ self.fail()
+ except LdbError, (num, _):
+ self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
+ dshstr = dshstr + str(i)
+ else:
+ # There does not seem to be an upper limit
+ self.ldb.set_dsheuristics(dshstr + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
+ # apart from the above, all char values are accepted
+ self.ldb.set_dsheuristics("123ABC-+!1asdfg@#^")
+ self.assertEquals(self.ldb.get_dsheuristics(), "123ABC-+!1asdfg@#^")
+ finally:
+ # restore old value
+ self.ldb.set_dsheuristics(dsheuristics)
def test_ldapControlReturn(self):
"""Testing that if we request a control that return a control it