summaryrefslogtreecommitdiff
path: root/source4/libcli/security/tests
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2009-09-17 19:56:02 +0400
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-09-17 19:36:32 +0200
commitaadf5e391063c502ac4f234503106ed784b2af15 (patch)
tree6d2266973b9fd63445539a82fa4c58bb0f2b8fd1 /source4/libcli/security/tests
parent78338d431c6e4ae8e3ff94b0ba9caaae2a5626a9 (diff)
downloadsamba-aadf5e391063c502ac4f234503106ed784b2af15.tar.gz
samba-aadf5e391063c502ac4f234503106ed784b2af15.tar.bz2
samba-aadf5e391063c502ac4f234503106ed784b2af15.zip
pyldb: Don't segfault when invalid type is specified to as_sddl and from_sddl.
Fix bug #6723
Diffstat (limited to 'source4/libcli/security/tests')
-rw-r--r--source4/libcli/security/tests/bindings.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/libcli/security/tests/bindings.py b/source4/libcli/security/tests/bindings.py
index f0d55f12ca..00fa05d070 100644
--- a/source4/libcli/security/tests/bindings.py
+++ b/source4/libcli/security/tests/bindings.py
@@ -57,6 +57,16 @@ class SecurityDescriptorTests(unittest.TestCase):
self.assertEquals(desc.sacl, None)
self.assertEquals(desc.type, 0x8004)
+ def test_from_sddl_invalidsddl(self):
+ self.assertRaises(TypeError,security.descriptor.from_sddl, "foo",security.dom_sid("S-2-0-0"))
+
+ def test_from_sddl_invalidtype1(self):
+ self.assertRaises(TypeError,security.descriptor.from_sddl, security.dom_sid('S-2-0-0-512'),security.dom_sid("S-2-0-0"))
+
+ def test_from_sddl_invalidtype1(self):
+ sddl = "O:AOG:DAD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)"
+ self.assertRaises(TypeError,security.descriptor.from_sddl, sddl,"S-2-0-0")
+
def test_as_sddl(self):
text = "O:AOG:DAD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)"
dom = security.dom_sid("S-2-0-0")
@@ -67,6 +77,13 @@ class SecurityDescriptorTests(unittest.TestCase):
self.assertEquals(desc1.sacl, desc2.sacl)
self.assertEquals(desc1.type, desc2.type)
+ def test_as_sddl_invalid(self):
+ text = "O:AOG:DAD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)"
+ dom = security.dom_sid("S-2-0-0")
+ desc1 = security.descriptor.from_sddl(text, dom)
+ self.assertRaises(TypeError, desc1.as_sddl,text)
+
+
def test_as_sddl_no_domainsid(self):
dom = security.dom_sid("S-2-0-0")
text = "O:AOG:DAD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)"