]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests: Show that in smb1 posix we don't treat dirs as case sensitive
authorVolker Lendecke <vl@samba.org>
Wed, 14 Dec 2022 17:05:04 +0000 (18:05 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 15 Dec 2022 10:34:34 +0000 (10:34 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
python/samba/tests/smb1posix.py [new file with mode: 0644]
selftest/knownfail.d/posix_case_sensivity [new file with mode: 0644]
source3/selftest/tests.py

diff --git a/python/samba/tests/smb1posix.py b/python/samba/tests/smb1posix.py
new file mode 100644 (file)
index 0000000..52b0312
--- /dev/null
@@ -0,0 +1,52 @@
+# Unix SMB/CIFS implementation.
+# Copyright Volker Lendecke <vl@samba.org> 2022
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+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
+
+class Smb1PosixTests(samba.tests.libsmb.LibsmbTests):
+
+    def test_directory_case_sensivity(self):
+        """Test that in smb1 posix dirs are case sensitive"""
+        conn = libsmb.Conn(
+            self.server_ip,
+            "posix_share",
+            self.lp,
+            self.creds,
+            force_smb1=True)
+        conn.smb1_posix()
+
+        try:
+            conn.mkdir("lower")
+        except NTSTATUSError as e:
+            if e.args[0] != ntstatus.NT_STATUS_OBJECT_NAME_COLLISION:
+                raise
+        try:
+            conn.mkdir("lower/second")
+        except NTSTATUSError as e:
+            if e.args[0] != ntstatus.NT_STATUS_OBJECT_NAME_COLLISION:
+                raise
+
+        self.assertFalse(conn.chkpath("Lower/second"))
+        conn.rmdir("lower/second")
+        conn.rmdir("lower")
+
+if __name__ == '__main__':
+    import unittest
+    unittest.main()
diff --git a/selftest/knownfail.d/posix_case_sensivity b/selftest/knownfail.d/posix_case_sensivity
new file mode 100644 (file)
index 0000000..895c9e3
--- /dev/null
@@ -0,0 +1 @@
+samba.tests.smb1posix
index 1630fdd20359b9d52ed1b2ac89247ffae2b70ee0..a1379e8080e454cc0a84aab146799c220defd6d3 100755 (executable)
@@ -1689,3 +1689,4 @@ for t in CLUSTERED_LOCAL_TESTS:
 planpythontestsuite("fileserver", "samba.tests.smb3unix")
 planpythontestsuite("fileserver", "samba.tests.reparsepoints")
 planpythontestsuite("fileserver_smb1", "samba.tests.smb2symlink")
+planpythontestsuite("fileserver_smb1", "samba.tests.smb1posix")