diff options
| author | Volker Lendecke <vl@samba.org> | 2022-08-31 12:38:23 +0200 |
|---|---|---|
| committer | Ralph Boehme <slow@samba.org> | 2022-09-02 14:31:25 +0000 |
| commit | a5156649d58df07f58e479076ea8a0b41b450ea4 (patch) | |
| tree | 2b7e96216db9e929234e63d08474e8633f6d7f10 /python | |
| parent | eaaa7425b563c6fa88210ff23d5c5d7f0d46b9f5 (diff) | |
| download | samba-a5156649d58df07f58e479076ea8a0b41b450ea4.tar.gz samba-a5156649d58df07f58e479076ea8a0b41b450ea4.tar.bz2 samba-a5156649d58df07f58e479076ea8a0b41b450ea4.zip | |
tests: Test basic handling of SMB2_CREATE_TAG_POSIX
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Sep 2 14:31:25 UTC 2022 on sn-devel-184
Diffstat (limited to 'python')
| -rw-r--r-- | python/samba/tests/smb3unix.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py index 04c451b251d..a825100d5b2 100644 --- a/python/samba/tests/smb3unix.py +++ b/python/samba/tests/smb3unix.py @@ -101,3 +101,62 @@ class Smb3UnixTests(samba.tests.TestCase): finally: self.disable_smb3unix() + + def test_posix_create_context(self): + try: + self.enable_smb3unix() + + c = libsmb.Conn( + os.getenv("SERVER_IP"), + "tmp", + self.lp, + self.creds, + posix=True) + self.assertTrue(c.have_posix()) + + cc_in=[(libsmb.SMB2_CREATE_TAG_POSIX,b'0000')] + fnum,_,cc_out = c.create_ex("",CreateContexts=cc_in) + self.assertEqual(cc_in[0][0],cc_out[0][0]) + + c.close(fnum) + + finally: + self.disable_smb3unix() + + def test_posix_create_context_noposix(self): + c = libsmb.Conn( + os.getenv("SERVER_IP"), + "tmp", + self.lp, + self.creds, + posix=True) + self.assertFalse(c.have_posix()) + + cc_in=[(libsmb.SMB2_CREATE_TAG_POSIX,b'0000')] + fnum,_,cc_out = c.create_ex("",CreateContexts=cc_in) + self.assertEqual(len(cc_out), 0) + + c.close(fnum) + + def test_posix_create_invalid_context_length(self): + try: + self.enable_smb3unix() + + c = libsmb.Conn( + os.getenv("SERVER_IP"), + "tmp", + self.lp, + self.creds, + posix=True) + self.assertTrue(c.have_posix()) + + cc_in=[(libsmb.SMB2_CREATE_TAG_POSIX,b'00000')] + + with self.assertRaises(NTSTATUSError) as cm: + fnum,_,cc_out = c.create_ex("",CreateContexts=cc_in) + + e = cm.exception + self.assertEqual(e.args[0], ntstatus.NT_STATUS_INVALID_PARAMETER) + + finally: + self.disable_smb3unix() |
