]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests: test POSIX file type on reparse point
authorRalph Boehme <slow@samba.org>
Wed, 27 Nov 2024 14:14:32 +0000 (15:14 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 27 Nov 2024 18:22:29 +0000 (18:22 +0000)
Create a symlink reparse point over SMB2. Then query file info over SMB2 and
check the POSIX file type is correctly assigned in the POSIX info levels.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
python/samba/tests/reparsepoints.py
selftest/knownfail.d/samba.tests.reparsepoints

index 50e1fb591826928c5ee43e291293692ca8571811..a55686160213a43ccdf9731477b2359f670cfb48 100644 (file)
@@ -441,6 +441,34 @@ class ReparsePoints(samba.tests.libsmb.LibsmbTests):
         """Test SOCK reparse tag"""
         self.do_test_nfs_reparse('sock', stat.S_IFSOCK, 'NFS_SPECFILE_SOCK')
 
+    def test_reparsepoint_posix_type(self):
+        conn = self.connection(posix=True)
+        filename = 'reparse'
+        self.clean_file(conn, filename)
+
+        fd,_,_ = conn.create_ex(
+            filename,
+            DesiredAccess=sec.SEC_FILE_WRITE_ATTRIBUTE,
+            CreateDisposition=libsmb.FILE_CREATE,
+            CreateContexts=[posix_context(0o600)])
+        b = reparse_symlink.symlink_put("y", "y", 0, 0)
+        conn.fsctl(fd, libsmb.FSCTL_SET_REPARSE_POINT, b, 0)
+        conn.close(fd)
+
+        dirents = conn.list("", filename,info_level=libsmb.SMB2_FIND_POSIX_INFORMATION)
+        self.assertEqual(
+            dirents[0]["attrib"],
+            libsmb.FILE_ATTRIBUTE_REPARSE_POINT|
+            libsmb.FILE_ATTRIBUTE_ARCHIVE)
+        self.assertEqual(
+            dirents[0]["reparse_tag"],
+            libsmb.IO_REPARSE_TAG_SYMLINK)
+
+        type, perms = self.wire_mode_to_unix(dirents[0]['perms'])
+        self.assertEqual(type, stat.S_IFLNK)
+
+        self.clean_file(conn, filename)
+
 if __name__ == '__main__':
     import unittest
     unittest.main()
index fb7205e14b39a8c7db2e9964ad33108a1ae3ca84..357149c9b55449b40f8bcb14db3a31515c4a2a21 100644 (file)
@@ -1,2 +1,3 @@
 ^samba.tests.reparsepoints.samba.tests.reparsepoints.ReparsePoints.test_fifo_reparse\(fileserver_smb1\)
 ^samba.tests.reparsepoints.samba.tests.reparsepoints.ReparsePoints.test_sock_reparse\(fileserver_smb1\)
+^samba.tests.reparsepoints.samba.tests.reparsepoints.ReparsePoints.test_reparsepoint_posix_type\(fileserver_smb1\)