1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-05 20:58:40 +03:00

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
This commit is contained in:
Volker Lendecke 2022-08-31 12:38:23 +02:00 committed by Ralph Boehme
parent eaaa7425b5
commit a5156649d5

View File

@ -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()