mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
s3: smbd: Add dirfsp parameter to can_write_to_file().
Not yet used. Currently always conn->cwd_fsp. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
21d16fe212
commit
7c1f1e5243
@ -1176,7 +1176,7 @@ static bool user_can_write_file(connection_struct *conn,
|
||||
return True;
|
||||
}
|
||||
|
||||
return can_write_to_file(conn, smb_fname);
|
||||
return can_write_to_file(conn, dirfsp, smb_fname);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -220,6 +220,7 @@ static uint32_t dos_mode_from_sbuf(connection_struct *conn,
|
||||
} else if (ro_opts == MAP_READONLY_PERMISSIONS) {
|
||||
/* Check actual permissions for read-only. */
|
||||
if (!can_write_to_file(conn,
|
||||
conn->cwd_fsp,
|
||||
smb_fname))
|
||||
{
|
||||
result |= FILE_ATTRIBUTE_READONLY;
|
||||
@ -542,6 +543,7 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
|
||||
|
||||
if (!set_dosmode_ok && lp_dos_filemode(SNUM(conn))) {
|
||||
set_dosmode_ok = can_write_to_file(conn,
|
||||
conn->cwd_fsp,
|
||||
smb_fname);
|
||||
}
|
||||
|
||||
@ -1073,6 +1075,7 @@ int file_set_dosmode(connection_struct *conn,
|
||||
*/
|
||||
|
||||
if (!can_write_to_file(conn,
|
||||
conn->cwd_fsp,
|
||||
smb_fname))
|
||||
{
|
||||
errno = EACCES;
|
||||
@ -1248,6 +1251,7 @@ int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
|
||||
|
||||
/* Check if we have write access. */
|
||||
if (can_write_to_file(conn,
|
||||
conn->cwd_fsp,
|
||||
smb_fname))
|
||||
{
|
||||
/* We are allowed to become root and change the filetime. */
|
||||
|
@ -131,8 +131,10 @@ bool can_delete_file_in_directory(connection_struct *conn,
|
||||
****************************************************************************/
|
||||
|
||||
bool can_write_to_file(connection_struct *conn,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname)
|
||||
{
|
||||
SMB_ASSERT(dirfsp == conn->cwd_fsp);
|
||||
return NT_STATUS_IS_OK(smbd_check_access_rights(conn,
|
||||
smb_fname,
|
||||
false,
|
||||
|
@ -727,6 +727,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
|
||||
if (fsp->fsp_flags.is_directory ||
|
||||
fsp->fsp_flags.can_write ||
|
||||
can_write_to_file(conn,
|
||||
conn->cwd_fsp,
|
||||
smb_fname))
|
||||
{
|
||||
perms = FILE_GENERIC_ALL;
|
||||
@ -1391,6 +1392,7 @@ static void call_nt_transact_create(connection_struct *conn,
|
||||
if (fsp->fsp_flags.is_directory ||
|
||||
fsp->fsp_flags.can_write ||
|
||||
can_write_to_file(conn,
|
||||
conn->cwd_fsp,
|
||||
smb_fname))
|
||||
{
|
||||
perms = FILE_GENERIC_ALL;
|
||||
|
@ -2847,6 +2847,7 @@ static bool acl_group_override(connection_struct *conn,
|
||||
/* user has writeable permission */
|
||||
if (lp_dos_filemode(SNUM(conn)) &&
|
||||
can_write_to_file(conn,
|
||||
conn->cwd_fsp,
|
||||
smb_fname))
|
||||
{
|
||||
return true;
|
||||
|
@ -334,6 +334,7 @@ bool can_delete_file_in_directory(connection_struct *conn,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname);
|
||||
bool can_write_to_file(connection_struct *conn,
|
||||
struct files_struct *dirfsp,
|
||||
const struct smb_filename *smb_fname);
|
||||
bool directory_has_default_acl(connection_struct *conn,
|
||||
struct files_struct *dirfsp,
|
||||
|
Loading…
Reference in New Issue
Block a user