]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: dos_mode_from_sbuf(), can_write_to_file() -> can_write_to_fsp().
authorJeremy Allison <jra@samba.org>
Wed, 2 Jun 2021 18:59:07 +0000 (11:59 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 9 Jun 2021 13:14:30 +0000 (13:14 +0000)
Code with MS-DFS link where smb_fname->fsp == NULL.

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

index de62811d4b76c12a8781155afcc65b80e6b6d9c1..92dd60c089ec04460ee4f212d7bbd888c7b16953 100644 (file)
@@ -206,12 +206,13 @@ static uint32_t dos_mode_from_sbuf(connection_struct *conn,
                        result |= FILE_ATTRIBUTE_READONLY;
                }
        } else if (ro_opts == MAP_READONLY_PERMISSIONS) {
+               /* smb_fname->fsp can be NULL for an MS-DFS link. */
                /* Check actual permissions for read-only. */
-               if (!can_write_to_file(conn,
-                               conn->cwd_fsp,
-                               smb_fname))
-               {
-                       result |= FILE_ATTRIBUTE_READONLY;
+               if (smb_fname->fsp != NULL) {
+                       if (!can_write_to_fsp(smb_fname->fsp))
+                       {
+                               result |= FILE_ATTRIBUTE_READONLY;
+                       }
                }
        } /* Else never set the readonly bit. */