From: Jeremy Allison Date: Wed, 2 Jun 2021 18:59:07 +0000 (-0700) Subject: s3: smbd: dos_mode_from_sbuf(), can_write_to_file() -> can_write_to_fsp(). X-Git-Tag: tevent-0.11.0~586 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d0fced71416e885a01d749fe40848a7c7747c0f3;p=thirdparty%2Fsamba.git s3: smbd: dos_mode_from_sbuf(), can_write_to_file() -> can_write_to_fsp(). Code with MS-DFS link where smb_fname->fsp == NULL. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index de62811d4b7..92dd60c089e 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -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. */