]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests: add a test for copy-chunk on a POSIX handle
authorRalph Boehme <slow@samba.org>
Mon, 11 Nov 2024 09:39:15 +0000 (10:39 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 7 Jan 2025 22:04:32 +0000 (22:04 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15751

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/samba/tests/smb3unix.py
selftest/knownfail.d/samba.tests.smb3unix [new file with mode: 0644]

index 04cfd82fb8d30a25a52f1ff0e598376eaebfd81b..cbd280956e9a640921aa87e91ad30648cbfdfaeb 100644 (file)
@@ -510,3 +510,36 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
             winconn.get_posix_fs_info()
         e = cm.exception
         self.assertEqual(e.args[0], ntstatus.NT_STATUS_INVALID_INFO_CLASS)
+
+    def test_copy_chunk_posix(self):
+        """
+        Test copy-chunk works with a destination handle opened in POSIX mode
+        """
+        (_, c) = self.connections()
+
+        self.clean_file(c, '\\test_copy_chunk_posix_src')
+        self.clean_file(c, '\\test_copy_chunk_posix_dst')
+
+        wire_mode = libsmb.unix_mode_to_wire(0o644)
+
+        sh,*_ = c.create_ex('\\test_copy_chunk_posix_src',
+                          DesiredAccess=security.SEC_GENERIC_ALL,
+                          CreateDisposition=libsmb.FILE_CREATE,
+                          CreateContexts=[posix_context(wire_mode)])
+
+        dh,*_ = c.create_ex('\\test_copy_chunk_posix_dst',
+                          DesiredAccess=security.SEC_GENERIC_WRITE,
+                          CreateDisposition=libsmb.FILE_CREATE,
+                          CreateContexts=[posix_context(wire_mode)])
+
+        c.write(sh, buffer=b"data", offset=0)
+
+        try:
+            written = c.copy_chunk(sh, dh, 4, 0, 0)
+        except Exception as e:
+            self.fail(str(e))
+        finally:
+            c.close(sh)
+            c.close(dh)
+            self.clean_file(c, '\\test_copy_chunk_posix_src')
+            self.clean_file(c, '\\test_copy_chunk_posix_dst')
diff --git a/selftest/knownfail.d/samba.tests.smb3unix b/selftest/knownfail.d/samba.tests.smb3unix
new file mode 100644 (file)
index 0000000..2882296
--- /dev/null
@@ -0,0 +1 @@
+^samba.tests.smb3unix.samba.tests.smb3unix.Smb3UnixTests.test_copy_chunk_posix\(fileserver_smb1\)