s3: smbd: Use FCHMOD call, not FCHMOD_ACL call if mode bits reset needed.
authorJeremy Allison <jra@samba.org>
Thu, 17 May 2018 17:38:34 +0000 (10:38 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 25 May 2018 16:39:24 +0000 (18:39 +0200)
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 <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/open.c

index e98936559f887ba99f272f475b460e222e4183fe..c54d380c7b5de1cd2b68aec19b898921efc326c5 100644 (file)
@@ -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);
                        }
                }