smbd: remove redundant conn arg from fd_open()
authorRalph Boehme <slow@samba.org>
Fri, 10 Apr 2020 14:58:16 +0000 (16:58 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 21 May 2020 05:23:32 +0000 (05:23 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/durable.c
source3/smbd/files.c
source3/smbd/open.c
source3/smbd/proto.h
source3/smbd/smb2_query_directory.c

index 59fd5a3d55b4a31a835cbc74403a77db413ec811..0b0885238937fbfdbcd4c3436047141f99df0556 100644 (file)
@@ -815,7 +815,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
                flags = O_RDONLY;
        }
 
-       status = fd_open(conn, fsp, flags, 0 /* mode */);
+       status = fd_open(fsp, flags, 0 /* mode */);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(lck);
                DEBUG(1, ("vfs_default_durable_reconnect: failed to open "
index e460cfdc02780956f305eb0b5d614e2add585228..1a59db7d1e1dc49206d1c1518c79625e1e3717cc 100644 (file)
@@ -222,7 +222,7 @@ NTSTATUS open_internal_dirfsp(connection_struct *conn,
 #ifdef O_DIRECTORY
        open_flags |= O_DIRECTORY;
 #endif
-       status = fd_open(conn, fsp, open_flags, 0);
+       status = fd_open(fsp, open_flags, 0);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_INFO("Could not open fd for %s (%s)\n",
                         smb_fname_str_dbg(smb_dname),
index 21a8e35984a6ea77c05eccc8af0df79b94c24a15..bd4d8c3616514697e85b9228d83abb5adf1d9d19 100644 (file)
@@ -759,11 +759,11 @@ static int non_widelink_open(struct connection_struct *conn,
  fd support routines - attempt to do a dos_open.
 ****************************************************************************/
 
-NTSTATUS fd_open(struct connection_struct *conn,
-                files_struct *fsp,
+NTSTATUS fd_open(files_struct *fsp,
                 int flags,
                 mode_t mode)
 {
+       struct connection_struct *conn = fsp->conn;
        struct smb_filename *smb_fname = fsp->fsp_name;
        NTSTATUS status = NT_STATUS_OK;
        int saved_errno = 0;
@@ -1028,7 +1028,6 @@ static NTSTATUS fd_open_atomic(files_struct *fsp,
                               mode_t mode,
                               bool *file_created)
 {
-       struct connection_struct *conn = fsp->conn;
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
        NTSTATUS retry_status;
        bool file_existed = VALID_STAT(fsp->fsp_name->st);
@@ -1038,7 +1037,7 @@ static NTSTATUS fd_open_atomic(files_struct *fsp,
                /*
                 * We're not creating the file, just pass through.
                 */
-               status = fd_open(conn, fsp, flags, mode);
+               status = fd_open(fsp, flags, mode);
                *file_created = false;
                return status;
        }
@@ -1047,7 +1046,7 @@ static NTSTATUS fd_open_atomic(files_struct *fsp,
                /*
                 * Fail if already exists, just pass through.
                 */
-               status = fd_open(conn, fsp, flags, mode);
+               status = fd_open(fsp, flags, mode);
 
                /*
                 * Here we've opened with O_CREAT|O_EXCL. If that went
@@ -1087,7 +1086,7 @@ static NTSTATUS fd_open_atomic(files_struct *fsp,
                retry_status = NT_STATUS_OBJECT_NAME_COLLISION;
        }
 
-       status = fd_open(conn, fsp, curr_flags, mode);
+       status = fd_open(fsp, curr_flags, mode);
        if (NT_STATUS_IS_OK(status)) {
                *file_created = !file_existed;
                return NT_STATUS_OK;
@@ -1106,7 +1105,7 @@ static NTSTATUS fd_open_atomic(files_struct *fsp,
                        curr_flags = flags | O_EXCL;
                }
 
-               status = fd_open(conn, fsp, curr_flags, mode);
+               status = fd_open(fsp, curr_flags, mode);
        }
 
        *file_created = (NT_STATUS_IS_OK(status) && !file_existed);
@@ -4506,7 +4505,7 @@ static NTSTATUS open_directory(connection_struct *conn,
        flags |= O_DIRECTORY;
 #endif
 
-       status = fd_open(conn, fsp, flags, 0);
+       status = fd_open(fsp, flags, 0);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_INFO("Could not open fd for "
                        "%s (%s)\n",
index c2491f9c43b0c5b2ce016d3935b14db12cbd1f5c..3a0b25f021b8abbdab4d39ff60b8eadc01ac46ab 100644 (file)
@@ -722,7 +722,7 @@ NTSTATUS check_parent_access(struct connection_struct *conn,
                                struct files_struct *dirfsp,
                                struct smb_filename *smb_fname,
                                uint32_t access_mask);
-NTSTATUS fd_open(struct connection_struct *conn, files_struct *fsp,
+NTSTATUS fd_open(files_struct *fsp,
                 int flags, mode_t mode);
 NTSTATUS fd_close(files_struct *fsp);
 void change_file_owner_to_parent(connection_struct *conn,
index 4da051e18ebe281a918ea28e72c66518c10111dd..66bc932925ba73ebc386a782901cd4da4fb6618d 100644 (file)
@@ -386,7 +386,7 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx,
 #ifdef O_DIRECTORY
                flags |= O_DIRECTORY;
 #endif
-               status = fd_open(conn, fsp, flags, 0);
+               status = fd_open(fsp, flags, 0);
                if (tevent_req_nterror(req, status)) {
                        return tevent_req_post(req, ev);
                }