From: Andrew Bartlett Date: Thu, 21 Feb 2019 02:49:25 +0000 (+1300) Subject: selftest: Add test for samba-tool dsacl get, cross-checked with samba-tool dsacl set X-Git-Tag: ldb-1.6.1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e2015293e4798c8c1832633e07eec95a38de624;p=thirdparty%2Fsamba.git selftest: Add test for samba-tool dsacl get, cross-checked with samba-tool dsacl set Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/tests/samba_tool/dsacl.py b/python/samba/tests/samba_tool/dsacl.py index 61cd5c5d355..4b5f4c827fc 100644 --- a/python/samba/tests/samba_tool/dsacl.py +++ b/python/samba/tests/samba_tool/dsacl.py @@ -48,6 +48,36 @@ class DSaclSetSddlTestCase(SambaToolCmdTest): acl_list=re.findall('.*descriptor for.*:\n(.*?)\n',out) self.assertMatch(acl_list[1], self.sddl, "new SDDL string should be contained within second sddl output") + def test_sddl_set_get(self): + """Tests if a sddl string can be added 'the normal way' and the output of 'get' is the same""" + (result, out, err) = self.runsubcmd("dsacl", "get", + "--objectdn=%s" % self.dn) + self.assertCmdSuccess(result, out, err) + self.assertEquals(err, "", "Shouldn't be any error messages") + #extract only the two sddl strings from samba-tool output + acl_list_get=re.findall('^descriptor for.*:\n(.*?)\n', out) + + (result, out, err) = self.runsubcmd("dsacl", "set", + "--objectdn=%s" % self.dn, + "--sddl=%s" % self.sddl) + self.assertCmdSuccess(result, out, err) + self.assertEquals(err, "", "Shouldn't be any error messages") + #extract only the two sddl strings from samba-tool output + acl_list_old=re.findall('old descriptor for.*:\n(.*?)\n', out) + self.assertEqual(acl_list_old, acl_list_get, + "output of dsacl get should be the same as before set") + + acl_list=re.findall('new descriptor for.*:\n(.*?)\n', out) + + (result, out, err) = self.runsubcmd("dsacl", "get", + "--objectdn=%s" % self.dn) + self.assertCmdSuccess(result, out, err) + self.assertEquals(err, "", "Shouldn't be any error messages") + #extract only the two sddl strings from samba-tool output + acl_list_get2=re.findall('^descriptor for.*:\n(.*?)\n', out) + self.assertEqual(acl_list, acl_list_get2, + "output of dsacl get should be the same as after set") + def test_multisddl(self): """Tests if we can add multiple, different sddl strings at the same time""" (result, out, err) = self.runsubcmd("dsacl", "set","--objectdn=%s" % self.dn, "--sddl=%s" % self.sddl_multi)