s3: smbd: Add a dirfsp parameter to user_can_read_file().
authorJeremy Allison <jra@samba.org>
Thu, 30 Apr 2020 23:05:34 +0000 (16:05 -0700)
committerRalph Boehme <slow@samba.org>
Mon, 4 May 2020 13:55:33 +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 fe001a18a6c5dd8955e995b239231790f32efb83..17eeec05577eec91f6cf3a0a7c81fa5cad7320ce 100644 (file)
@@ -1069,6 +1069,7 @@ bool get_dir_entry(TALLOC_CTX *ctx,
 ********************************************************************/
 
 static bool user_can_read_file(connection_struct *conn,
+                               struct files_struct *dirfsp,
                                struct smb_filename *smb_fname)
 {
        NTSTATUS status;
@@ -1080,6 +1081,8 @@ static bool user_can_read_file(connection_struct *conn,
                                FILE_READ_ATTRIBUTES|
                                SEC_STD_READ_CONTROL;
 
+       SMB_ASSERT(dirfsp == conn->cwd_fsp);
+
        /*
         * Never hide files from the root user.
         * We use (uid_t)0 here not sec_initial_uid()
@@ -1276,6 +1279,7 @@ bool is_visible_file(connection_struct *conn,
                /* Honour _hide unreadable_ option */
                if (hide_unreadable &&
                    !user_can_read_file(conn,
+                               conn->cwd_fsp,
                                smb_fname_base))
                {
                        DEBUG(10,("is_visible_file: file %s is unreadable.\n",