1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

libsmb: Test smb1 mknod

Requires O_PATH to work correctly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2023-03-09 16:16:50 +01:00 committed by Jeremy Allison
parent 41b094dd2f
commit 880eb2bd56
2 changed files with 27 additions and 0 deletions

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

View 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