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

linked attribute tests: test against duplicates in replace

We should not be able to introduce duplicate links using MOD_REPLACE.
It turns out we could and weren't testing.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall
2017-10-25 10:54:42 +13:00
committed by Andrew Bartlett
parent 2d260b28f5
commit 046fc1f7de
2 changed files with 13 additions and 0 deletions

View File

@ -464,6 +464,16 @@ class LATests(samba.tests.TestCase):
self.assert_back_links(u3, [g1])
self.assert_back_links(u4, [])
try:
# adding u2 twice should be an error
self.replace_linked_attribute(g2, [u1, u2, u3, u2])
except ldb.LdbError as (num, msg):
if num != ldb.ERR_ENTRY_ALREADY_EXISTS:
self.fail("adding duplicate values, expected "
"ERR_ENTRY_ALREADY_EXISTS, (%d) "
"got %d" % (ldb.ERR_ENTRY_ALREADY_EXISTS, num))
else:
self.fail("replacing duplicate values succeeded when it shouldn't")
def test_la_links_replace2(self):
users = self.add_objects(12, 'user', 'u_replace2')