summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2021-04-19 16:38:00 -0700
committerAndreas Schneider <asn@cryptomilk.org>2021-04-20 08:23:42 +0000
commit5c3470c0f2937f0a878469f751e868b7e80234d8 (patch)
tree7283da041a19c060e7f4ceb21a8a928a23815837 /source3
parent249565c65af05fb88e15ed10d0ff770c97c938ff (diff)
downloadsamba-5c3470c0f2937f0a878469f751e868b7e80234d8.tar.gz
s3: smbd: Prevent fchmod on a symlink.
Remove selftest/knownfail.d/symlink_chmod. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Apr 20 08:23:42 UTC 2021 on sn-devel-184
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/trans2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 7c15a731e0d..de843117581 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -8324,6 +8324,12 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn,
if (raw_unixmode != SMB_MODE_NO_CHANGE) {
int ret;
+ if (fsp == NULL || S_ISLNK(smb_fname->st.st_ex_mode)) {
+ DBG_WARNING("Can't set mode on symlink %s\n",
+ smb_fname_str_dbg(smb_fname));
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
DEBUG(10,("smb_set_file_unix_basic: SMB_SET_FILE_UNIX_BASIC "
"setting mode 0%o for file %s\n",
(unsigned int)unixmode,