smbd: Pass "struct vfs_open_how" to reopen_from_procfd()
authorVolker Lendecke <vl@samba.org>
Thu, 31 Aug 2023 12:59:47 +0000 (14:59 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 5 Oct 2023 12:58:33 +0000 (12:58 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/open.c

index 87719eec06e6aabb6d829e62617c8ba8d74d2720..b73e1cba2d845bac4bdd4cded2c574966542dd25 100644 (file)
@@ -1202,10 +1202,8 @@ static NTSTATUS fd_open_atomic(struct files_struct *dirfsp,
 }
 
 static NTSTATUS reopen_from_procfd(struct files_struct *fsp,
-                                  int flags,
-                                  mode_t mode)
+                                  const struct vfs_open_how *how)
 {
-       struct vfs_open_how how = { .flags = flags, .mode = mode };
        struct smb_filename proc_fname;
        const char *p = NULL;
        char buf[PATH_MAX];
@@ -1246,7 +1244,7 @@ static NTSTATUS reopen_from_procfd(struct files_struct *fsp,
                                fsp->conn->cwd_fsp,
                                &proc_fname,
                                fsp,
-                               &how);
+                               how);
        if (new_fd == -1) {
                status = map_nt_error_from_unix(errno);
                fd_close(fsp);
@@ -1269,6 +1267,10 @@ static NTSTATUS reopen_from_fsp(struct files_struct *dirfsp,
                                mode_t mode,
                                bool *p_file_created)
 {
+       struct vfs_open_how how = {
+               .flags = flags,
+               .mode = mode,
+       };
        bool __unused_file_created = false;
        NTSTATUS status;
 
@@ -1281,9 +1283,7 @@ static NTSTATUS reopen_from_fsp(struct files_struct *dirfsp,
         *       SMB_VFS_REOPEN_FSP()?
         */
 
-       status = reopen_from_procfd(fsp,
-                                   flags,
-                                   mode);
+       status = reopen_from_procfd(fsp, &how);
        if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
                return status;
        }