s3/smbd: smb_set_file_unix_info2: SMB_VFS_CHFLAGS -> SMB_VFS_FCHFLAGS
authorNoel Power <noel.power@suse.com>
Fri, 11 Jun 2021 15:23:12 +0000 (16:23 +0100)
committerNoel Power <npower@samba.org>
Tue, 29 Jun 2021 08:21:38 +0000 (08:21 +0000)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/trans2.c

index b03a7721901b8a9d088d36ff1249c385236f7e70..835f487285744957c738d1d28b9485d0338201a1 100644 (file)
@@ -8501,17 +8501,13 @@ static NTSTATUS smb_set_file_unix_info2(connection_struct *conn,
                        return NT_STATUS_INVALID_PARAMETER;
                }
 
-               if (fsp &&
-                   !fsp->fsp_flags.is_pathref &&
-                   fsp_get_io_fd(fsp) != -1)
-               {
-                       /* XXX: we should be  using SMB_VFS_FCHFLAGS here. */
-                       return NT_STATUS_NOT_SUPPORTED;
-               } else {
-                       if (SMB_VFS_CHFLAGS(conn, smb_fname,
-                                           stat_fflags) != 0) {
-                               return map_nt_error_from_unix(errno);
-                       }
+               if (fsp == NULL || S_ISLNK(smb_fname->st.st_ex_mode)) {
+                       DBG_WARNING("Can't change flags on symlink %s\n",
+                               smb_fname_str_dbg(smb_fname));
+                       return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+               }
+               if (SMB_VFS_FCHFLAGS(fsp, stat_fflags) != 0) {
+                       return map_nt_error_from_unix(errno);
                }
        }