diff options
author | Jeremy Allison <jra@samba.org> | 2013-08-21 12:10:05 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-08-24 14:04:47 -0700 |
commit | ce776551abb07f18cf302ee7c0c437ee27952099 (patch) | |
tree | f51162450fb7169b3b06d383083fc2d5a639c5a4 /source3/smbd | |
parent | f124d6fbcd0a03bbd95d69477c144f475546de66 (diff) | |
download | samba-ce776551abb07f18cf302ee7c0c437ee27952099.tar.gz samba-ce776551abb07f18cf302ee7c0c437ee27952099.tar.xz samba-ce776551abb07f18cf302ee7c0c437ee27952099.zip |
Allow UNIX extensions client to act on open fsp instead of pathname if available.
Eliminates possible race condition on pathname op.
Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/trans2.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index bafd3f76dd..55272e9018 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -7119,11 +7119,18 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn, */ if (raw_unixmode != SMB_MODE_NO_CHANGE) { + int ret; + DEBUG(10,("smb_set_file_unix_basic: SMB_SET_FILE_UNIX_BASIC " "setting mode 0%o for file %s\n", (unsigned int)unixmode, smb_fname_str_dbg(smb_fname))); - if (SMB_VFS_CHMOD(conn, smb_fname->base_name, unixmode) != 0) { + if (fsp && fsp->fh->fd != -1) { + ret = SMB_VFS_FCHMOD(fsp, unixmode); + } else { + ret = SMB_VFS_CHMOD(conn, smb_fname->base_name, unixmode); + } + if (ret != 0) { return map_nt_error_from_unix(errno); } } |