s3: smbd: Reformat users of can_write_to_file().
authorJeremy Allison <jra@samba.org>
Thu, 30 Apr 2020 22:35:36 +0000 (15:35 -0700)
committerRalph Boehme <slow@samba.org>
Mon, 4 May 2020 13:55:33 +0000 (13:55 +0000)
Make new parameter addition clearer.

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

index 7ddc5fd3fc6ddbc7d34ac2b22becfdf72dff7914..b061e9ac794122396e3fe6a3667fc5c07d6654f6 100644 (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. */
                }
        } 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. */
                        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))) {
                }
 
                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) {
                }
 
                if (!set_dosmode_ok) {
@@ -1069,7 +1072,9 @@ int file_set_dosmode(connection_struct *conn,
                bits on a file. Just like file_ntimes below.
        */
 
                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;
        }
                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. */
         */
 
        /* 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);
                /* We are allowed to become root and change the filetime. */
                become_root();
                ret = SMB_VFS_NTIMES(conn, smb_fname, ft);
index a05b031c62d188795ab8a7e86957d90007454dc0..1b9785d670abd356f28d4dfd97487331a7d32850 100644 (file)
@@ -131,7 +131,7 @@ bool can_delete_file_in_directory(connection_struct *conn,
 ****************************************************************************/
 
 bool can_write_to_file(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,
 {
        return NT_STATUS_IS_OK(smbd_check_access_rights(conn,
                                smb_fname,
index a99aa78bde867f3273d251949f080be2be40a303..c44501108abd97742568595be93187476ed66179 100644 (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 ||
                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;
                        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 ||
                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;
                        perms = FILE_GENERIC_ALL;
                } else {
                        perms = FILE_GENERIC_READ|FILE_EXECUTE;
index 6fbec943b0ea08400bf8f05e4810bc9793a08706..2e78b9c3bbb4821842ef2dc243bdfd491175bc80 100644 (file)
@@ -2846,7 +2846,9 @@ static bool acl_group_override(connection_struct *conn,
 
        /* user has writeable permission */
        if (lp_dos_filemode(SNUM(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;
        }
 
                return true;
        }
 
index cdb7dcce41cda7fbb860afbb95852da54299c6cf..5303c477cf7b16ad5aaf35a4213ce019b41e7f17 100644 (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,
                        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);
 bool directory_has_default_acl(connection_struct *conn,
                        struct files_struct *dirfsp,
                        struct smb_filename *smb_fname);