[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Dec 20 01:33:02 UTC 2022


The branch, master has been updated
       via  5c25e262e7d tests: add a Python test for case insensitive access
      from  44a44005a6b compression/huffman: debug function bails upon disaster (CID 1517261)

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5c25e262e7dce3b40c9c4982444ce965a139b490
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 16 10:43:11 2022 +0100

    tests: add a Python test for case insensitive access
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Dec 20 01:32:07 UTC 2022 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 python/samba/tests/libsmb-basic.py | 52 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)


Changeset truncated at 500 lines:

diff --git a/python/samba/tests/libsmb-basic.py b/python/samba/tests/libsmb-basic.py
index 36566436e87..61a25a8c682 100644
--- a/python/samba/tests/libsmb-basic.py
+++ b/python/samba/tests/libsmb-basic.py
@@ -141,6 +141,58 @@ class LibsmbTestCase(samba.tests.libsmb.LibsmbTests):
         self.assertEqual(len(cc[0][1]),8)
         c.close(fnum)
 
+    def test_libsmb_TortureCaseSensitivity(self):
+        testdir = "test_libsmb_torture_case_sensitivity"
+        filename = "file"
+        filepath = testdir + "/" + filename
+
+        c = libsmb.Conn(self.server_ip, "tmp", self.lp, self.creds)
+
+        try:
+            c.deltree(testdir)
+        except:
+            pass
+
+        c.mkdir(testdir)
+
+        try:
+            # Now check for all possible upper-/lowercase combinations:
+            # - testdir/file
+            # - TESTDIR/file
+            # - testdir/FILE
+            # - TESTDIR/FILE
+
+            dircases = [testdir, testdir, testdir.upper(), testdir.upper()]
+            filecases = [filename, filename.upper(), filename, filename.upper()]
+            tcases = [{'dir':dir, 'file':file} for dir,file in zip(dircases,filecases)]
+
+            for tcase in tcases:
+                testpath = tcase['dir'] + "/" + tcase['file']
+
+                # Create the testfile
+                h = c.create(filepath,
+                             DesiredAccess=security.SEC_FILE_ALL,
+                             CreateDisposition=libsmb.FILE_OPEN_IF)
+                c.close(h)
+
+                # Open
+                c.loadfile(testpath)
+
+                # Search
+                ls = [f['name'] for f in c.list(tcase['dir'], mask=tcase['file'])]
+                self.assertIn(filename, ls, msg='When searching for "%s" not found in "%s"' % (tcase['file'], tcase['dir']))
+
+                # Rename
+                c.rename(testpath, tcase['dir'] + "/tmp")
+                c.rename(tcase['dir'] + "/TMP", filepath)
+                c.loadfile(testpath)
+
+                # Delete
+                c.unlink(testpath)
+
+        finally:
+            c.deltree(testdir)
+
 if __name__ == "__main__":
     import unittest
     unittest.main()


-- 
Samba Shared Repository



More information about the samba-cvs mailing list