CVE-2023-0614 dsdb: Add pre-cleanup and self.addCleanup() of OU created in match_rule...
authorAndrew Bartlett <abartlet@samba.org>
Fri, 3 Mar 2023 03:49:00 +0000 (16:49 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 5 Apr 2023 02:10:35 +0000 (02:10 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
lib/ldb-samba/tests/match_rules.py

index abf485c9eab538dc9f2e13a79bb91f06c9ad0cf4..2af1dd6a0709f55fd2cbcc22299a547a3094e1d5 100755 (executable)
@@ -31,11 +31,19 @@ class MatchRulesTests(samba.tests.TestCase):
         self.ou_groups = "OU=groups,%s" % self.ou
         self.ou_computers = "OU=computers,%s" % self.ou
 
+        try:
+            self.ldb.delete(self.ou, ["tree_delete:1"])
+        except LdbError as e:
+            pass
+
         # Add a organizational unit to create objects
         self.ldb.add({
             "dn": self.ou,
             "objectclass": "organizationalUnit"})
 
+        self.addCleanup(self.ldb.delete, self.ou, controls=['tree_delete:0'])
+
+
         # Add the following OU hierarchy and set otherWellKnownObjects,
         # which has BinaryDN syntax:
         #