1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

CVE-2020-25722 selftest: Add test for duplicate servicePrincipalNames on an add operation

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:
Joseph Sutton 2021-11-02 21:21:17 +13:00 committed by Jule Anger
parent 262f59a71f
commit ae47a73077
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,2 @@
^samba4.sam.python\(ad_dc_default\).__main__.SamTests.test_service_principal_name_uniqueness\(ad_dc_default\)
^samba4.sam.python\(fl2008r2dc\).__main__.SamTests.test_service_principal_name_uniqueness\(fl2008r2dc\)

View File

@ -89,6 +89,7 @@ class SamTests(samba.tests.TestCase):
delete_force(self.ldb, "cn=ldaptestuser2,cn=users," + self.base_dn)
delete_force(self.ldb, "cn=ldaptest\,specialuser,cn=users," + self.base_dn)
delete_force(self.ldb, "cn=ldaptestcomputer,cn=computers," + self.base_dn)
delete_force(self.ldb, "cn=ldaptestcomputer2,cn=computers," + self.base_dn)
delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
delete_force(self.ldb, "cn=ldaptestgroup2,cn=users," + self.base_dn)
@ -3500,6 +3501,26 @@ class SamTests(samba.tests.TestCase):
delete_force(self.ldb, "cn=ldaptestcomputer,cn=computers," + self.base_dn)
def test_service_principal_name_uniqueness(self):
"""Test the servicePrincipalName uniqueness behaviour"""
print("Testing servicePrincipalName uniqueness behaviour")
ldb.add({
"dn": "cn=ldaptestcomputer,cn=computers," + self.base_dn,
"objectclass": "computer",
"servicePrincipalName": "HOST/testname.testdom"})
try:
ldb.add({
"dn": "cn=ldaptestcomputer2,cn=computers," + self.base_dn,
"objectclass": "computer",
"servicePrincipalName": "HOST/testname.testdom"})
except LdbError as e:
num, _ = e.args
self.assertEqual(num, ERR_CONSTRAINT_VIOLATION)
else:
self.fail()
def test_sam_description_attribute(self):
"""Test SAM description attribute"""
print("Test SAM description attribute")