Commit 0761b15b authored by Andrew Bartlett's avatar Andrew Bartlett Committed by Mathieu Parent

CVE-2019-3870 pysmbd: Include tests to show the outside umask has no impact

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13834Signed-off-by: 's avatarAndrew Bartlett <abartlet@samba.org>
Reviewed-by: 's avatarJeremy Allison <jra@samba.org>
parent 84f97107
......@@ -112,6 +112,12 @@ class NtaclsBackupRestoreTests(SmbdBaseTests):
dirpath = os.path.join(self.service_root, 'a-dir')
smbd.mkdir(dirpath, self.service)
mode = os.stat(dirpath).st_mode
# This works in conjunction with the TEST_UMASK in smbd_base
# to ensure that permissions are not related to the umask
# but instead the smb.conf settings
self.assertEquals(mode & 0o777, 0o755)
self.assertTrue(os.path.isdir(dirpath))
def test_smbd_create_file(self):
......@@ -123,6 +129,13 @@ class NtaclsBackupRestoreTests(SmbdBaseTests):
smbd.create_file(filepath, self.service)
self.assertTrue(os.path.isfile(filepath))
mode = os.stat(filepath).st_mode
# This works in conjunction with the TEST_UMASK in smbd_base
# to ensure that permissions are not related to the umask
# but instead the smb.conf settings
self.assertEquals(mode & 0o777, 0o644)
# As well as checking that unlink works, this removes the
# fake xattrs from the dev/inode based DB
smbd.unlink(filepath, self.service)
......
......@@ -17,7 +17,7 @@
from samba.tests import TestCaseInTempDir
import os
TEST_UMASK = 0o022
TEST_UMASK = 0o042
class SmbdBaseTests(TestCaseInTempDir):
......
^samba.tests.ntacls_backup.samba.tests.ntacls_backup.NtaclsBackupRestoreTests.test_smbd_mkdir
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment