]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Test smb1 mknod
authorVolker Lendecke <vl@samba.org>
Thu, 9 Mar 2023 15:16:50 +0000 (16:16 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 16 Jun 2023 16:14:31 +0000 (16:14 +0000)
Requires O_PATH to work correctly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/samba/tests/smb1posix.py
selftest/skip.opath-required

index 52b0312ac8bdd9cdc500dbed0260dfcef8ee43a6..d77c49d066470e78dc2ee480be177b26d39897a0 100644 (file)
@@ -19,6 +19,7 @@ from samba.samba3 import libsmb_samba_internal as libsmb
 from samba import (ntstatus,NTSTATUSError)
 from samba.dcerpc import security as sec
 import samba.tests.libsmb
+import stat
 
 class Smb1PosixTests(samba.tests.libsmb.LibsmbTests):
 
@@ -47,6 +48,25 @@ class Smb1PosixTests(samba.tests.libsmb.LibsmbTests):
         conn.rmdir("lower/second")
         conn.rmdir("lower")
 
+    def test_mknod(self):
+        """Test SMB1 posix mknod"""
+        conn = libsmb.Conn(
+            self.server_ip,
+            "posix_share",
+            self.lp,
+            self.creds,
+            force_smb1=True)
+        conn.smb1_posix()
+
+        def do_test(name, filetype):
+            conn.mknod(name, filetype | 0o755)
+            st = conn.smb1_stat(name)
+            self.assertEqual(st["mode"], filetype | 0o755)
+            conn.unlink(name)
+
+        do_test("fifo", stat.S_IFIFO)
+        do_test("sock", stat.S_IFSOCK)
+
 if __name__ == '__main__':
     import unittest
     unittest.main()
index 0faf0c4bd6c7114caa01dfd81dfbcb8114ea766c..c3a13f5ec6e6afbf2d16dbb9c53aebb21a6a47ab 100644 (file)
@@ -7,3 +7,10 @@
 # These fail because become_root() doesn't work in make test
 ^samba3.blackbox.dropbox.*
 ^samba3.raw.samba3hide.*
+
+# samba.tests.smb1posix.samba.tests.smb1posix.Smb1PosixTests.test_mknod
+# creates a socket and posix stat() gives an error because opening the
+# socket from filename_covert_dirfsp() returns ENXIO. With O_PATH
+# available this works fine. So for now restrict testing posix
+# extensions to environments where we have O_PATH around
+^samba.tests.smb1posix