From: Jeremy Allison Date: Thu, 17 May 2018 17:27:11 +0000 (-0700) Subject: s3: smbd: Remove use of SMB_VFS_FCHMOD_ACL() in overwrite case. X-Git-Tag: ldb-1.4.0~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d03e9a861e207c8c0204e4f76cb4bdaec711f923;p=thirdparty%2Fsamba.git s3: smbd: Remove use of SMB_VFS_FCHMOD_ACL() in overwrite case. 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 Reviewed-by: Volker Lendecke --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 1b83e8403d2..7763a095733 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3806,32 +3806,13 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, * 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), - (unsigned int)new_unx_mode)); + (unsigned int)new_unx_mode); + } } {