From aaed6b4e995bb95fdc3ca6e768e84d14b3a3e446 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 May 2018 10:38:34 -0700 Subject: [PATCH] s3: smbd: Use FCHMOD call, not FCHMOD_ACL call if mode bits reset needed. This is a behavior change, it will modify the POSIX ACL mask from a value of rwx instead of modifying the existing ACE entries to be ANDed with the passed in mode. However it will have no effect on the underlying permissions, and better reflects the proper use of POSIX ACLs (i.e. I didn't understand the use of the mask entry in the ACL when I first wrote the POSIX ACL code). In addition, the vfs_acl_common.c module already filters these calls for all but POSIX opens, which means the only place this change is exposed to the client would be a cifsfs unix extensions client doing posix acl calls (and they would expect the mask to be set like this on chmod). Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- source3/smbd/open.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e98936559f8..c54d380c7b5 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3777,12 +3777,12 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, if (!posix_open && new_file_created && !def_acl) { if (unx_mode != smb_fname->st.st_ex_mode) { - /* We might get ENOSYS in the next call.. */ - int saved_errno = errno; - - if (SMB_VFS_FCHMOD_ACL(fsp, unx_mode) == -1 && - errno == ENOSYS) { - errno = saved_errno; /* Ignore ENOSYS */ + int ret = SMB_VFS_FCHMOD(fsp, unx_mode); + if (ret == -1) { + DBG_INFO("failed to reset " + "attributes of file %s to 0%o\n", + smb_fname_str_dbg(smb_fname), + (unsigned int)unx_mode); } } -- 2.47.2