Fix of a bug in the security.descriptor.as_sddl() method
authornadezhda ivanova <nivanova@ved.salsa.postpath.local>
Thu, 23 Apr 2009 14:18:23 +0000 (17:18 +0300)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 23 Apr 2009 16:21:25 +0000 (18:21 +0200)
security.descriptor.as_sddl() method did not work correctly when invoked without
supplying the domain sid. Returned the same value as when the sid was provided.
Test added for this case in  libcli/security/tests/bindings.py

Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
source4/libcli/security/tests/bindings.py
source4/librpc/ndr/py_security.c

index 5c153050be6acbe7c16f11e2039c6e91decaedb4..f0d55f12cae71ffa754c96698ddaa0bb3b7bb4a1 100644 (file)
@@ -77,6 +77,12 @@ class SecurityDescriptorTests(unittest.TestCase):
         self.assertEquals(desc1.sacl, desc2.sacl)
         self.assertEquals(desc1.type, desc2.type)
 
+    def test_domsid_nodomsid_as_sddl(self):
+        dom = security.dom_sid("S-2-0-0")
+        text = "O:AOG:DAD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)"
+        desc1 = security.descriptor.from_sddl(text, dom)
+        self.assertNotEqual(desc1.as_sddl(), desc1.as_sddl(dom))
+
 
 class DomSidTests(unittest.TestCase):
     def test_parse_sid(self):
index 43c1d50d666ac764db66cbf1b31123fb2f8841fd..1b54aab02af653aa30d717ec53204185d977343b 100644 (file)
@@ -198,7 +198,7 @@ static PyObject *py_descriptor_as_sddl(PyObject *self, PyObject *args)
        if (!PyArg_ParseTuple(args, "|O", &py_sid))
                return NULL;
 
-       if (py_sid == Py_None)
+       if (py_sid != Py_None)
                sid = py_talloc_get_ptr(py_sid);
        else
                sid = NULL;