From 046fc1f7de685afcbb7f0b92f0280ff0109ed4b7 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 25 Oct 2017 10:54:42 +1300 Subject: 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 Reviewed-by: Andrew Bartlett --- source4/dsdb/tests/python/linked_attributes.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source4/dsdb') diff --git a/source4/dsdb/tests/python/linked_attributes.py b/source4/dsdb/tests/python/linked_attributes.py index 6235bf77a89..705c9d5c0db 100644 --- a/source4/dsdb/tests/python/linked_attributes.py +++ b/source4/dsdb/tests/python/linked_attributes.py @@ -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') -- cgit v1.2.1