From 23deb79a28009f5c4ea2f2c2ceb84cfdbc9fb5b1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 7 Oct 2023 12:28:05 +0200 Subject: [PATCH] tests: Add reproducer for bug 15487 Show that smbd crashes if asked to return full information on close of a stream handle with delete on close disposition set. Bug: https://bugzilla.samba.org/show_bug.cgi?id=15487 Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- python/samba/tests/libsmb-basic.py | 21 +++++++++++++++++++++ selftest/knownfail.d/close_full_info | 1 + 2 files changed, 22 insertions(+) create mode 100644 selftest/knownfail.d/close_full_info diff --git a/python/samba/tests/libsmb-basic.py b/python/samba/tests/libsmb-basic.py index 163c5b09ea9..20d3dd48c3c 100644 --- a/python/samba/tests/libsmb-basic.py +++ b/python/samba/tests/libsmb-basic.py @@ -242,6 +242,27 @@ class LibsmbTestCase(samba.tests.libsmb.LibsmbTests): # Without the bugfix for 15481 we get 'file' not 'File' self.assertEqual(directory[0]['name'], 'File') + def test_stream_close_with_full_information(self): + c = libsmb.Conn(self.server_ip, "streams_xattr", self.lp, self.creds) + + try: + c.deltree("teststreams") + except: + pass + + c.mkdir("teststreams") + fh = c.create("teststreams\\stream_full_close_info.txt:Stream", + DesiredAccess=security.SEC_STD_DELETE, + CreateDisposition=libsmb.FILE_CREATE) + c.delete_on_close(fh, 1) + + try: + c.close(fh, libsmb.SMB2_CLOSE_FLAGS_FULL_INFORMATION) + except: + self.fail() + + c.deltree("teststreams") + if __name__ == "__main__": import unittest unittest.main() diff --git a/selftest/knownfail.d/close_full_info b/selftest/knownfail.d/close_full_info new file mode 100644 index 00000000000..ff8e2ab20a3 --- /dev/null +++ b/selftest/knownfail.d/close_full_info @@ -0,0 +1 @@ +^samba.tests.libsmb-basic.samba.tests.libsmb-basic.LibsmbTestCase.test_stream_close_with_full_information