1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

CVE-2020-25722 selftest: Adapt sam.py test_isCriticalSystemObject to new UF_WORKSTATION_TRUST_ACCOUNT default

Objects with objectclass computer now have UF_WORKSTATION_TRUST_ACCOUNT
by default and so this test must adapt.

The changes to this test passes against Windows 2019 except for
the new behaviour around the UF_WORKSTATION_TRUST_ACCOUNT default.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14753

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2021-10-21 11:57:22 +13:00 committed by Jule Anger
parent 53d0e5d31e
commit 55cc9324b4
3 changed files with 36 additions and 3 deletions

View File

@ -0,0 +1 @@
^samba4.sam.python\(.*\).__main__.SamTests.test_isCriticalSystemObject_user

View File

@ -3,11 +3,9 @@
#
# All these tests need to be fixed and the entries here removed
^samba4.sam.python\(fl2008r2dc\).__main__.SamTests.test_isCriticalSystemObject\(fl2008r2dc\)
^samba4.sam.python\(fl2008r2dc\).__main__.SamTests.test_userAccountControl\(fl2008r2dc\)
^samba4.sam.python\(fl2008r2dc\).__main__.SamTests.test_users_groups\(fl2008r2dc\)
^samba4.ldap.python\(ad_dc_default\).__main__.BasicTests.test_all\(ad_dc_default\)
^samba4.sam.python\(ad_dc_default\).__main__.SamTests.test_isCriticalSystemObject\(ad_dc_default\)
^samba4.sam.python\(ad_dc_default\).__main__.SamTests.test_userAccountControl\(ad_dc_default\)
^samba4.sam.python\(ad_dc_default\).__main__.SamTests.test_users_groups\(ad_dc_default\)
^samba4.priv_attrs.strict.python\(ad_dc_default\).__main__.PrivAttrsTests.test_priv_attr_userAccountControl-DC_add_CC_WP_user\(ad_dc_default\)

View File

@ -2925,6 +2925,39 @@ class SamTests(samba.tests.TestCase):
delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
def test_isCriticalSystemObject_user(self):
"""Test the isCriticalSystemObject behaviour"""
print("Testing isCriticalSystemObject behaviour\n")
# Add tests (of a user)
ldb.add({
"dn": "cn=ldaptestuser,cn=users," + self.base_dn,
"objectclass": "user"})
res1 = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn,
scope=SCOPE_BASE,
attrs=["isCriticalSystemObject"])
self.assertTrue(len(res1) == 1)
self.assertTrue("isCriticalSystemObject" not in res1[0])
# Modification tests
m = Message()
m.dn = Dn(ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
m["userAccountControl"] = MessageElement(str(UF_WORKSTATION_TRUST_ACCOUNT),
FLAG_MOD_REPLACE, "userAccountControl")
ldb.modify(m)
res1 = ldb.search("cn=ldaptestuser,cn=users," + self.base_dn,
scope=SCOPE_BASE,
attrs=["isCriticalSystemObject"])
self.assertTrue(len(res1) == 1)
self.assertTrue("isCriticalSystemObject" in res1[0])
self.assertEqual(str(res1[0]["isCriticalSystemObject"][0]), "FALSE")
delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
def test_isCriticalSystemObject(self):
"""Test the isCriticalSystemObject behaviour"""
print("Testing isCriticalSystemObject behaviour\n")
@ -2939,7 +2972,8 @@ class SamTests(samba.tests.TestCase):
scope=SCOPE_BASE,
attrs=["isCriticalSystemObject"])
self.assertTrue(len(res1) == 1)
self.assertTrue("isCriticalSystemObject" not in res1[0])
self.assertTrue("isCriticalSystemObject" in res1[0])
self.assertEqual(str(res1[0]["isCriticalSystemObject"][0]), "FALSE")
delete_force(self.ldb, "cn=ldaptestcomputer,cn=computers," + self.base_dn)