1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3: smbd: Reformat users of can_write_to_file().

Make new parameter addition clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2020-04-30 15:35:36 -07:00 committed by Ralph Boehme
parent 18f67e354f
commit 21d16fe212
5 changed files with 22 additions and 9 deletions

View File

@ -219,7 +219,9 @@ 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, smb_fname)) {
if (!can_write_to_file(conn,
smb_fname))
{
result |= FILE_ATTRIBUTE_READONLY;
}
} /* Else never set the readonly bit. */
@ -539,7 +541,8 @@ 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, smb_fname);
set_dosmode_ok = can_write_to_file(conn,
smb_fname);
}
if (!set_dosmode_ok) {
@ -1069,7 +1072,9 @@ int file_set_dosmode(connection_struct *conn,
bits on a file. Just like file_ntimes below.
*/
if (!can_write_to_file(conn, smb_fname)) {
if (!can_write_to_file(conn,
smb_fname))
{
errno = EACCES;
return -1;
}
@ -1242,7 +1247,9 @@ int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
*/
/* Check if we have write access. */
if (can_write_to_file(conn, smb_fname)) {
if (can_write_to_file(conn,
smb_fname))
{
/* We are allowed to become root and change the filetime. */
become_root();
ret = SMB_VFS_NTIMES(conn, smb_fname, ft);

View File

@ -131,7 +131,7 @@ bool can_delete_file_in_directory(connection_struct *conn,
****************************************************************************/
bool can_write_to_file(connection_struct *conn,
const struct smb_filename *smb_fname)
const struct smb_filename *smb_fname)
{
return NT_STATUS_IS_OK(smbd_check_access_rights(conn,
smb_fname,

View File

@ -726,7 +726,9 @@ void reply_ntcreate_and_X(struct smb_request *req)
p += 25;
if (fsp->fsp_flags.is_directory ||
fsp->fsp_flags.can_write ||
can_write_to_file(conn, smb_fname)) {
can_write_to_file(conn,
smb_fname))
{
perms = FILE_GENERIC_ALL;
} else {
perms = FILE_GENERIC_READ|FILE_EXECUTE;
@ -1388,7 +1390,9 @@ static void call_nt_transact_create(connection_struct *conn,
p += 25;
if (fsp->fsp_flags.is_directory ||
fsp->fsp_flags.can_write ||
can_write_to_file(conn, smb_fname)) {
can_write_to_file(conn,
smb_fname))
{
perms = FILE_GENERIC_ALL;
} else {
perms = FILE_GENERIC_READ|FILE_EXECUTE;

View File

@ -2846,7 +2846,9 @@ static bool acl_group_override(connection_struct *conn,
/* user has writeable permission */
if (lp_dos_filemode(SNUM(conn)) &&
can_write_to_file(conn, smb_fname)) {
can_write_to_file(conn,
smb_fname))
{
return true;
}

View File

@ -334,7 +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,
const struct smb_filename *smb_fname);
const struct smb_filename *smb_fname);
bool directory_has_default_acl(connection_struct *conn,
struct files_struct *dirfsp,
struct smb_filename *smb_fname);