s3: smbd: Remove use of SMB_VFS_FCHMOD_ACL() in overwrite case.
authorJeremy Allison <jra@samba.org>
Thu, 17 May 2018 17:27:11 +0000 (10:27 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 25 May 2018 16:39:24 +0000 (18:39 +0200)
We have potentially called SMB_VFS_FCHMOD() here in
the file_set_dosmode() call associated with the comment
/* Overwritten files should be initially set as archive */
at line 3755 above, so there is no need to do any POSIX ACL
mask protection.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/open.c

index 1b83e8403d2c8e3a4c2eb2fe33a6c1a9c7d2fb31..7763a09573396c5150dcfa09f5bf59d60c8b6d24 100644 (file)
@@ -3806,32 +3806,13 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                 * an overwritten file.
                 */
 
                 * an overwritten file.
                 */
 
-               int ret = -1;
-
-               /* Attributes need changing. File already existed. */
-
-               {
-                       int saved_errno = errno; /* We might get ENOSYS in the
-                                                 * next call.. */
-                       ret = SMB_VFS_FCHMOD_ACL(fsp, new_unx_mode);
-
-                       if (ret == -1 && errno == ENOSYS) {
-                               errno = saved_errno; /* Ignore ENOSYS */
-                       } else {
-                               DEBUG(5, ("open_file_ntcreate: reset "
-                                         "attributes of file %s to 0%o\n",
-                                         smb_fname_str_dbg(smb_fname),
-                                         (unsigned int)new_unx_mode));
-                               ret = 0; /* Don't do the fchmod below. */
-                       }
-               }
-
-               if ((ret == -1) &&
-                   (SMB_VFS_FCHMOD(fsp, new_unx_mode) == -1))
-                       DEBUG(5, ("open_file_ntcreate: failed to reset "
+               int ret = SMB_VFS_FCHMOD(fsp, new_unx_mode);
+               if (ret == -1) {
+                       DBG_INFO("failed to reset "
                                  "attributes of file %s to 0%o\n",
                                  smb_fname_str_dbg(smb_fname),
                                  "attributes of file %s to 0%o\n",
                                  smb_fname_str_dbg(smb_fname),
-                                 (unsigned int)new_unx_mode));
+                                 (unsigned int)new_unx_mode);
+               }
        }
 
        {
        }
 
        {