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

pytest:segfault: some more ldb crashes

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2024-03-14 09:32:47 +13:00 committed by Andrew Bartlett
parent 0bf80c10ca
commit 8bb6287c3b
2 changed files with 139 additions and 0 deletions

View File

@ -415,3 +415,137 @@ class SegfaultTests(samba.tests.TestCase):
del samdb
del msg
dn.get_casefold()
@no_gdb_backtrace
@segfault_detector
def test_ldb_use_after_free_dn_assign_disconnecting_connection(self):
msg = ldb.Message()
samdb = self.get_samdb()
msg.dn = ldb.Dn(samdb, "CN=Test")
samdb.disconnect()
dn = msg.dn
dn.add_child("CN=TEST")
dn.set_component(0, "CN", "Test2")
del samdb
del msg
dn.get_casefold()
@no_gdb_backtrace
@segfault_detector
def test_ldb_use_after_free_dn_assign_disconnecting_connection_no_del(self):
msg = ldb.Message()
samdb = self.get_samdb()
msg.dn = ldb.Dn(samdb, "CN=Test")
samdb.disconnect()
dn = msg.dn
dn.add_child("CN=TEST")
dn.set_component(0, "CN", "Test2")
dn.get_casefold()
@no_gdb_backtrace
@segfault_detector
def test_ldb_use_after_free_dn_assign_disconnecting_connection_later__no_del(self):
msg = ldb.Message()
samdb = self.get_samdb()
msg.dn = ldb.Dn(samdb, "CN=Test")
dn = msg.dn
dn.add_child("CN=TEST")
dn.set_component(0, "CN", "Test2")
samdb.disconnect()
dn.get_casefold()
@no_gdb_backtrace
@segfault_detector
def test_ldb_use_after_free_dn_assign_disconnecting_connection_add_child_later(self):
msg = ldb.Message()
samdb = self.get_samdb()
msg.dn = ldb.Dn(samdb, "CN=Test")
dn = msg.dn
dn.add_child("CN=TEST")
dn.set_component(0, "CN", "Test2")
samdb.disconnect()
dn.add_child("CN=TeSt")
@no_gdb_backtrace
@segfault_detector
def test_ldb_use_after_free_dn_assign_disconnecting_connection_later(self):
msg = ldb.Message()
samdb = self.get_samdb()
msg.dn = ldb.Dn(samdb, "CN=Test")
dn = msg.dn
dn.add_child("CN=TEST")
dn.set_component(0, "CN", "Test2")
samdb.disconnect()
del samdb
dn.get_casefold()
@no_gdb_backtrace
@segfault_detector
def test_ldb_use_after_free_dn_assign_disconnecting_connection_reconnecting_later(self):
msg = ldb.Message()
samdb = self.get_samdb()
msg.dn = ldb.Dn(samdb, "CN=Test")
dn = msg.dn
dn.add_child("CN=TEST")
dn.set_component(0, "CN", "Test2")
samdb.disconnect()
lp, creds, server = self.get_lp_et_al()
url = 'ldap://' + server
samdb.connect(url)
dn.get_casefold()
@no_gdb_backtrace
@segfault_detector
def test_ldb_use_after_free_dn_assign_switching_out_connection(self):
msg = ldb.Message()
samdb = self.get_samdb()
msg.dn = ldb.Dn(samdb, "CN=Test")
lp, creds, server = self.get_lp_et_al()
url = 'ldap://' + server
samdb.disconnect()
samdb.connect(url)
dn = msg.dn
dn.add_child("CN=TEST")
dn.set_component(0, "CN", "Test2")
samdb.disconnect()
samdb.connect(url)
del samdb
del msg
dn.get_casefold()
@no_gdb_backtrace
@segfault_detector
def test_ldb_use_after_free_dn_assign_disconnecting_and_switching_out_connection(self):
msg = ldb.Message()
samdb = self.get_samdb()
msg.dn = ldb.Dn(samdb, "CN=Test")
samdb.disconnect()
lp, creds, server = self.get_lp_et_al()
url = 'ldap://' + server
samdb.connect(url)
dn = msg.dn
dn.add_child("CN=TEST")
dn.set_component(0, "CN", "Test2")
del samdb
del msg
dn.get_casefold()

View File

@ -0,0 +1,5 @@
^samba\.tests\.segfault\.samba\.tests\.segfault\.SegfaultTests\.test_ldb_use_after_free_dn_assign_disconnecting_connection\(ad_dc\)
^samba\.tests\.segfault\.samba\.tests\.segfault\.SegfaultTests\.test_ldb_use_after_free_dn_assign_disconnecting_connection_add_child_later\(ad_dc\)
^samba\.tests\.segfault\.samba\.tests\.segfault\.SegfaultTests\.test_ldb_use_after_free_dn_assign_disconnecting_connection_later\(ad_dc\)
^samba\.tests\.segfault\.samba\.tests\.segfault\.SegfaultTests\.test_ldb_use_after_free_dn_assign_disconnecting_connection_later__no_del\(ad_dc\)
^samba\.tests\.segfault\.samba\.tests\.segfault\.SegfaultTests\.test_ldb_use_after_free_dn_assign_disconnecting_connection_no_del\(ad_dc\)