s3: smbd: Add dirfsp parameter to user_can_write_file().
authorJeremy Allison <jra@samba.org>
Thu, 30 Apr 2020 22:31:43 +0000 (15:31 -0700)
committerRalph Boehme <slow@samba.org>
Mon, 4 May 2020 13:55:32 +0000 (13:55 +0000)
Not yet used. Currently always conn->cwd_fsp.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/dir.c

index 1ac273664f898f514a55a0843bd7f807d4d2bfd5..1758bbd98c9bbdd007d77ef1dd9989303eb2af22 100644 (file)
@@ -1153,8 +1153,11 @@ static bool user_can_read_file(connection_struct *conn,
 ********************************************************************/
 
 static bool user_can_write_file(connection_struct *conn,
+                               struct files_struct *dirfsp,
                                const struct smb_filename *smb_fname)
 {
+       SMB_ASSERT(dirfsp == conn->cwd_fsp);
+
        /*
         * Never hide files from the root user.
         * We use (uid_t)0 here not sec_initial_uid()
@@ -1281,6 +1284,7 @@ bool is_visible_file(connection_struct *conn,
                /* Honour _hide unwriteable_ option */
                if (hide_unwriteable &&
                    !user_can_write_file(conn,
+                               conn->cwd_fsp,
                                smb_fname_base))
                {
                        DEBUG(10,("is_visible_file: file %s is unwritable.\n",