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:
parent
262f59a71f
commit
ae47a73077
2
selftest/knownfail.d/spn_uniqueness
Normal file
2
selftest/knownfail.d/spn_uniqueness
Normal 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\)
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user