Pass struct smb_request to file_free
authorVolker Lendecke <vl@samba.org>
Thu, 9 Oct 2008 14:27:49 +0000 (16:27 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 13 Oct 2008 17:32:38 +0000 (19:32 +0200)
on the way to get rid of chain_fsp

13 files changed:
source3/include/proto.h
source3/printing/nt_printing.c
source3/printing/printfsp.c
source3/rpc_server/srv_srvsvc_nt.c
source3/smbd/close.c
source3/smbd/dosmode.c
source3/smbd/fake_file.c
source3/smbd/files.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/posix_acls.c
source3/smbd/reply.c
source3/smbd/trans2.c

index db6130ce9197a878c61b82b1e309c5f1bdb74045..f8d6f1033436cf7a96ea649205b7280cb634b740 100644 (file)
@@ -9370,7 +9370,8 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
 /* The following definitions come from smbd/close.c  */
 
 void set_close_write_time(struct files_struct *fsp, struct timespec ts);
-NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type);
+NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
+                   enum file_close_type close_type);
 void msg_close_file(struct messaging_context *msg_ctx,
                    void *private_data,
                    uint32_t msg_type,
@@ -9535,7 +9536,7 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
                                const char *fname,
                                uint32 access_mask,
                                files_struct **result);
-NTSTATUS close_fake_file(files_struct *fsp);
+NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
 
 /* The following definitions come from smbd/file_access.c  */
 
@@ -9590,7 +9591,7 @@ files_struct *file_find_di_first(struct file_id id);
 files_struct *file_find_di_next(files_struct *start_fsp);
 files_struct *file_find_print(void);
 void file_sync_all(connection_struct *conn);
-void file_free(files_struct *fsp);
+void file_free(struct smb_request *req, files_struct *fsp);
 files_struct *file_fnum(uint16 fnum);
 files_struct *file_fsp(struct smb_request *req, uint16 fid);
 void file_chain_reset(void);
@@ -9791,7 +9792,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
 NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
                          const char *fname,
                          SMB_STRUCT_STAT *psbuf, files_struct **result);
-NTSTATUS close_file_fchmod(files_struct *fsp);
+NTSTATUS close_file_fchmod(struct smb_request *req, files_struct *fsp);
 NTSTATUS open_directory(connection_struct *conn,
                        struct smb_request *req,
                        const char *fname,
index 13a6403b1c0e9dc4921ceb2366de69158749ab87..85f42feb91a1b6253fd04a82e80fd2c53ac28fce 100644 (file)
@@ -1376,7 +1376,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
                        DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", old_create_time));
                }
        }
-       close_file(fsp, NORMAL_CLOSE);
+       close_file(NULL, fsp, NORMAL_CLOSE);
        fsp = NULL;
 
        /* Get file version info (if available) for new file */
@@ -1417,7 +1417,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
                        DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", new_create_time));
                }
        }
-       close_file(fsp, NORMAL_CLOSE);
+       close_file(NULL, fsp, NORMAL_CLOSE);
        fsp = NULL;
 
        if (use_version && (new_major != old_major || new_minor != old_minor)) {
@@ -1447,7 +1447,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
 
        error_exit:
                if(fsp)
-                       close_file(fsp, NORMAL_CLOSE);
+                       close_file(NULL, fsp, NORMAL_CLOSE);
                return -1;
 }
 
@@ -1583,7 +1583,7 @@ static uint32 get_correct_cversion(const char *architecture, fstring driverpath_
        DEBUG(10,("get_correct_cversion: Driver file [%s] cversion = %d\n",
                driverpath, cversion));
 
-       close_file(fsp, NORMAL_CLOSE);
+       close_file(NULL, fsp, NORMAL_CLOSE);
        close_cnum(conn, user->vuid);
        unbecome_user();
        *perr = WERR_OK;
@@ -1593,7 +1593,7 @@ static uint32 get_correct_cversion(const char *architecture, fstring driverpath_
   error_exit:
 
        if(fsp)
-               close_file(fsp, NORMAL_CLOSE);
+               close_file(NULL, fsp, NORMAL_CLOSE);
 
        close_cnum(conn, user->vuid);
        unbecome_user();
index 02122e8a6b702e1ea8c2ea7ab4f5814da0bf4874..a247cd84276106e7a819bffdc0b9789b15fd0eb3 100644 (file)
@@ -53,7 +53,7 @@ NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
        jobid = print_job_start(conn->server_info, SNUM(conn), name, NULL);
        if (jobid == -1) {
                status = map_nt_error_from_unix(errno);
-               file_free(fsp);
+               file_free(req, fsp);
                return status;
        }
 
@@ -62,7 +62,7 @@ NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
        if (fsp->rap_print_jobid == 0) {
                /* We need to delete the entry in the tdb. */
                pjob_delete(lp_const_servicename(SNUM(conn)), jobid);
-               file_free(fsp);
+               file_free(req, fsp);
                return NT_STATUS_ACCESS_DENIED; /* No errno around here */
        }
 
index 47688b114c8ad7246209aa54b58c46357811d3d7..b99c77c9b86d92603ca9c58904525b6432150231 100644 (file)
@@ -2112,7 +2112,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p,
 
        psd->dacl->revision = NT4_ACL_REVISION;
 
-       close_file(fsp, NORMAL_CLOSE);
+       close_file(NULL, fsp, NORMAL_CLOSE);
        vfs_ChDir(conn, oldcwd);
        conn_free_internal(conn);
        return WERR_OK;
@@ -2120,7 +2120,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p,
 error_exit:
 
        if (fsp) {
-               close_file(fsp, NORMAL_CLOSE);
+               close_file(NULL, fsp, NORMAL_CLOSE);
        }
 
        if (oldcwd) {
@@ -2231,7 +2231,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p,
                goto error_exit;
        }
 
-       close_file(fsp, NORMAL_CLOSE);
+       close_file(NULL, fsp, NORMAL_CLOSE);
        vfs_ChDir(conn, oldcwd);
        conn_free_internal(conn);
        return WERR_OK;
@@ -2239,7 +2239,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p,
 error_exit:
 
        if (fsp) {
-               close_file(fsp, NORMAL_CLOSE);
+               close_file(NULL, fsp, NORMAL_CLOSE);
        }
 
        if (oldcwd) {
index 818b4c70a8ce1cff6ff15caf0c4dcf97091d4142..d4c531ab1955cbca0fe3e5c48d5951f7ae07ba46 100644 (file)
@@ -505,7 +505,8 @@ static NTSTATUS update_write_time_on_close(struct files_struct *fsp)
  delete on close is done on normal and shutdown close.
 ****************************************************************************/
 
-static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_type)
+static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
+                                 enum file_close_type close_type)
 {
        NTSTATUS status = NT_STATUS_OK;
        NTSTATUS saved_status1 = NT_STATUS_OK;
@@ -536,7 +537,7 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_
 
        if (fsp->print_file) {
                print_fsp_end(fsp, close_type);
-               file_free(fsp);
+               file_free(req, fsp);
                return NT_STATUS_OK;
        }
 
@@ -585,7 +586,7 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_
                conn->num_files_open,
                nt_errstr(status) ));
 
-       file_free(fsp);
+       file_free(req, fsp);
        return status;
 }
 
@@ -593,7 +594,8 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_
  Close a directory opened by an NT SMB call. 
 ****************************************************************************/
   
-static NTSTATUS close_directory(files_struct *fsp, enum file_close_type close_type)
+static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
+                               enum file_close_type close_type)
 {
        struct share_mode_lock *lck = 0;
        bool delete_dir = False;
@@ -698,7 +700,7 @@ static NTSTATUS close_directory(files_struct *fsp, enum file_close_type close_ty
         * Do the code common to files and directories.
         */
        close_filestruct(fsp);
-       file_free(fsp);
+       file_free(req, fsp);
        return status;
 }
 
@@ -706,17 +708,18 @@ static NTSTATUS close_directory(files_struct *fsp, enum file_close_type close_ty
  Close a files_struct.
 ****************************************************************************/
   
-NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type)
+NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
+                   enum file_close_type close_type)
 {
        NTSTATUS status;
        struct files_struct *base_fsp = fsp->base_fsp;
 
        if(fsp->is_directory) {
-               status = close_directory(fsp, close_type);
+               status = close_directory(req, fsp, close_type);
        } else if (fsp->fake_file_handle != NULL) {
-               status = close_fake_file(fsp);
+               status = close_fake_file(req, fsp);
        } else {
-               status = close_normal_file(fsp, close_type);
+               status = close_normal_file(req, fsp, close_type);
        }
 
        if ((base_fsp != NULL) && (close_type != SHUTDOWN_CLOSE)) {
@@ -731,7 +734,7 @@ NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type)
                 */
 
                SMB_ASSERT(base_fsp->base_fsp == NULL);
-               close_file(base_fsp, close_type);
+               close_file(req, base_fsp, close_type);
        }
 
        return status;
@@ -768,5 +771,5 @@ void msg_close_file(struct messaging_context *msg_ctx,
                DEBUG(10,("msg_close_file: failed to find file.\n"));
                return;
        }
-       close_file(fsp, NORMAL_CLOSE);
+       close_file(NULL, fsp, NORMAL_CLOSE);
 }
index a5cca53bc7617f801bc33ddd1ca95f3ed113ee28..784b36d9bde0de62366a685466eef2c1d6b325bf 100644 (file)
@@ -285,7 +285,7 @@ static bool set_ea_dos_attribute(connection_struct *conn, const char *path, SMB_
                        ret = True;
                }
                unbecome_root();
-               close_file_fchmod(fsp);
+               close_file_fchmod(NULL, fsp);
                return ret;
        }
        DEBUG(10,("set_ea_dos_attribute: set EA %s on file %s\n", attrstr, path));
@@ -547,7 +547,7 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
                become_root();
                ret = SMB_VFS_FCHMOD(fsp, unixmode);
                unbecome_root();
-               close_file_fchmod(fsp);
+               close_file_fchmod(NULL, fsp);
                if (!newfile) {
                        notify_fname(conn, NOTIFY_ACTION_MODIFIED,
                                FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
index 38874835079b176efbb1255bf839379f54c66149..58b09604c4f4d12feecb0ea843102e5d07b05375 100644 (file)
@@ -137,7 +137,7 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
        fsp->fake_file_handle = init_fake_file_handle(fake_file_type);
        
        if (fsp->fake_file_handle==NULL) {
-               file_free(fsp);
+               file_free(req, fsp);
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -146,8 +146,8 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
        return NT_STATUS_OK;
 }
 
-NTSTATUS close_fake_file(files_struct *fsp)
+NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp)
 {
-       file_free(fsp);
+       file_free(req, fsp);
        return NT_STATUS_OK;
 }
index 33c43356c6ab5254fab26d0a9ad9fba5328cf9a7..d77ee76be7461d07e60572185bce5b2ab9026cee 100644 (file)
@@ -145,7 +145,7 @@ void file_close_conn(connection_struct *conn)
        for (fsp=Files;fsp;fsp=next) {
                next = fsp->next;
                if (fsp->conn == conn) {
-                       close_file(fsp,SHUTDOWN_CLOSE); 
+                       close_file(NULL, fsp, SHUTDOWN_CLOSE);
                }
        }
 }
@@ -161,7 +161,7 @@ void file_close_pid(uint16 smbpid, int vuid)
        for (fsp=Files;fsp;fsp=next) {
                next = fsp->next;
                if ((fsp->file_pid == smbpid) && (fsp->vuid == vuid)) {
-                       close_file(fsp,SHUTDOWN_CLOSE); 
+                       close_file(NULL, fsp, SHUTDOWN_CLOSE);
                }
        }
 }
@@ -219,7 +219,7 @@ void file_close_user(int vuid)
        for (fsp=Files;fsp;fsp=next) {
                next=fsp->next;
                if (fsp->vuid == vuid) {
-                       close_file(fsp,SHUTDOWN_CLOSE);
+                       close_file(NULL, fsp, SHUTDOWN_CLOSE);
                }
        }
 }
@@ -395,7 +395,7 @@ void file_sync_all(connection_struct *conn)
  Free up a fsp.
 ****************************************************************************/
 
-void file_free(files_struct *fsp)
+void file_free(struct smb_request *req, files_struct *fsp)
 {
        DLIST_REMOVE(Files, fsp);
 
index baa91e2955c1cd2797fbfb6dd9b5029f60ffee0e..6361f7949a55c985eb8071b726dd30a895c9e8d4 100644 (file)
@@ -1188,7 +1188,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
                        &info, &fsp2);
 
        if (!NT_STATUS_IS_OK(status)) {
-               close_file(fsp1,ERROR_CLOSE);
+               close_file(NULL, fsp1, ERROR_CLOSE);
                return status;
        }
 
@@ -1202,12 +1202,12 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
         * Thus we don't look at the error return from the
         * close of fsp1.
         */
-       close_file(fsp1,NORMAL_CLOSE);
+       close_file(NULL, fsp1, NORMAL_CLOSE);
 
        /* Ensure the modtime is set correctly on the destination file. */
        set_close_write_time(fsp2, get_mtimespec(&sbuf1));
 
-       status = close_file(fsp2,NORMAL_CLOSE);
+       status = close_file(NULL, fsp2, NORMAL_CLOSE);
 
        /* Grrr. We have to do this as open_file_ntcreate adds aARCH when it
           creates the file. This isn't the correct thing to do in the copy
index 0ae444b3d8c2b9a66b6aa45063bf2fdb64b5e8fd..209ad4d587bd1ef333cc6ead4434c31f9aee5da8 100644 (file)
@@ -1465,7 +1465,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                                          fname, &old_write_time);
 
                if (lck == NULL) {
-                       file_free(fsp);
+                       file_free(req, fsp);
                        DEBUG(0, ("Could not get share mode lock\n"));
                        return NT_STATUS_SHARING_VIOLATION;
                }
@@ -1476,7 +1476,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                                         oplock_request)) {
                        schedule_defer_open(lck, request_time, req);
                        TALLOC_FREE(lck);
-                       file_free(fsp);
+                       file_free(req, fsp);
                        return NT_STATUS_SHARING_VIOLATION;
                }
 
@@ -1496,7 +1496,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                                                  oplock_request)) {
                                schedule_defer_open(lck, request_time, req);
                                TALLOC_FREE(lck);
-                               file_free(fsp);
+                               file_free(req, fsp);
                                return NT_STATUS_SHARING_VIOLATION;
                        }
                }
@@ -1504,7 +1504,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                if (NT_STATUS_EQUAL(status, NT_STATUS_DELETE_PENDING)) {
                        /* DELETE_PENDING is not deferred for a second */
                        TALLOC_FREE(lck);
-                       file_free(fsp);
+                       file_free(req, fsp);
                        return status;
                }
 
@@ -1525,7 +1525,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                                        DEBUG(0, ("DOS open without an SMB "
                                                  "request!\n"));
                                        TALLOC_FREE(lck);
-                                       file_free(fsp);
+                                       file_free(req, fsp);
                                        return NT_STATUS_INTERNAL_ERROR;
                                }
 
@@ -1540,7 +1540,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
 
                                if (fsp_dup) {
                                        TALLOC_FREE(lck);
-                                       file_free(fsp);
+                                       file_free(req, fsp);
                                        if (pinfo) {
                                                *pinfo = FILE_WAS_OPENED;
                                        }
@@ -1626,7 +1626,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                        } else {
                                status = NT_STATUS_ACCESS_DENIED;
                        }
-                       file_free(fsp);
+                       file_free(req, fsp);
                        return status;
                }
 
@@ -1664,7 +1664,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                if (lck != NULL) {
                        TALLOC_FREE(lck);
                }
-               file_free(fsp);
+               file_free(req, fsp);
                return fsp_open;
        }
 
@@ -1695,7 +1695,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                        DEBUG(0, ("open_file_ntcreate: Could not get share "
                                  "mode lock for %s\n", fname));
                        fd_close(fsp);
-                       file_free(fsp);
+                       file_free(req, fsp);
                        return NT_STATUS_SHARING_VIOLATION;
                }
 
@@ -1706,7 +1706,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                        schedule_defer_open(lck, request_time, req);
                        TALLOC_FREE(lck);
                        fd_close(fsp);
-                       file_free(fsp);
+                       file_free(req, fsp);
                        return NT_STATUS_SHARING_VIOLATION;
                }
 
@@ -1725,7 +1725,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                                schedule_defer_open(lck, request_time, req);
                                TALLOC_FREE(lck);
                                fd_close(fsp);
-                               file_free(fsp);
+                               file_free(req, fsp);
                                return NT_STATUS_SHARING_VIOLATION;
                        }
                }
@@ -1734,7 +1734,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                        struct deferred_open_record state;
 
                        fd_close(fsp);
-                       file_free(fsp);
+                       file_free(req, fsp);
 
                        state.delayed_for_oplocks = False;
                        state.id = id;
@@ -1776,7 +1776,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
 
                        TALLOC_FREE(lck);
                        fd_close(fsp);
-                       file_free(fsp);
+                       file_free(req, fsp);
 
                        return NT_STATUS_SHARING_VIOLATION;
                }
@@ -1802,7 +1802,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                        status = map_nt_error_from_unix(errno);
                        TALLOC_FREE(lck);
                        fd_close(fsp);
-                       file_free(fsp);
+                       file_free(req, fsp);
                        return status;
                }
        }
@@ -1863,7 +1863,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                        del_share_mode(lck, fsp);
                        TALLOC_FREE(lck);
                        fd_close(fsp);
-                       file_free(fsp);
+                       file_free(req, fsp);
                        return status;
                }
                /* Note that here we set the *inital* delete on close flag,
@@ -1977,7 +1977,7 @@ NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
         */
 
        if (!NT_STATUS_IS_OK(status)) {
-               file_free(fsp);
+               file_free(req, fsp);
                return status;
        }
 
@@ -1989,10 +1989,10 @@ NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
  Close the fchmod file fd - ensure no locks are lost.
 ****************************************************************************/
 
-NTSTATUS close_file_fchmod(files_struct *fsp)
+NTSTATUS close_file_fchmod(struct smb_request *req, files_struct *fsp)
 {
        NTSTATUS status = fd_close(fsp);
-       file_free(fsp);
+       file_free(req, fsp);
        return status;
 }
 
@@ -2238,7 +2238,7 @@ NTSTATUS open_directory(connection_struct *conn,
 
        if (lck == NULL) {
                DEBUG(0, ("open_directory: Could not get share mode lock for %s\n", fname));
-               file_free(fsp);
+               file_free(req, fsp);
                return NT_STATUS_SHARING_VIOLATION;
        }
 
@@ -2248,7 +2248,7 @@ NTSTATUS open_directory(connection_struct *conn,
 
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(lck);
-               file_free(fsp);
+               file_free(req, fsp);
                return status;
        }
 
@@ -2261,7 +2261,7 @@ NTSTATUS open_directory(connection_struct *conn,
                status = can_set_delete_on_close(fsp, True, 0);
                if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_DIRECTORY_NOT_EMPTY)) {
                        TALLOC_FREE(lck);
-                       file_free(fsp);
+                       file_free(req, fsp);
                        return status;
                }
 
@@ -2302,7 +2302,7 @@ NTSTATUS create_directory(connection_struct *conn, struct smb_request *req, cons
                                &fsp);
 
        if (NT_STATUS_IS_OK(status)) {
-               close_file(fsp, NORMAL_CLOSE);
+               close_file(req, fsp, NORMAL_CLOSE);
        }
 
        return status;
@@ -2512,7 +2512,7 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn,
 
                DEBUG(10, ("Closing stream # %d, %s\n", i,
                           streams[i]->fsp_name));
-               close_file(streams[i], NORMAL_CLOSE);
+               close_file(NULL, streams[i], NORMAL_CLOSE);
        }
 
  fail:
@@ -2843,11 +2843,11 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
        DEBUG(10, ("create_file_unixpath: %s\n", nt_errstr(status)));
 
        if (fsp != NULL) {
-               close_file(fsp, ERROR_CLOSE);
+               close_file(req, fsp, ERROR_CLOSE);
                fsp = NULL;
        }
        if (base_fsp != NULL) {
-               close_file(base_fsp, ERROR_CLOSE);
+               close_file(req, base_fsp, ERROR_CLOSE);
                base_fsp = NULL;
        }
        return status;
@@ -3094,7 +3094,7 @@ NTSTATUS create_file(connection_struct *conn,
        DEBUG(10, ("create_file: %s\n", nt_errstr(status)));
 
        if (fsp != NULL) {
-               close_file(fsp, ERROR_CLOSE);
+               close_file(req, fsp, ERROR_CLOSE);
                fsp = NULL;
        }
        return status;
index c151e57e4c3d671ed47a17cc214979756f7f5b2e..f129506716356574ca997cb27eede7903ca46962 100644 (file)
@@ -3206,7 +3206,7 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
        ret = SMB_VFS_FCHOWN(fsp, uid, (gid_t)-1);
        unbecome_root();
 
-       close_file_fchmod(fsp);
+       close_file_fchmod(NULL, fsp);
 
        return ret;
 }
@@ -3264,7 +3264,7 @@ NTSTATUS append_parent_acl(files_struct *fsp,
        status = SMB_VFS_GET_NT_ACL(parent_fsp->conn, parent_fsp->fsp_name,
                                    DACL_SECURITY_INFORMATION, &parent_sd );
 
-       close_file(parent_fsp, NORMAL_CLOSE);
+       close_file(NULL, parent_fsp, NORMAL_CLOSE);
 
        if (!NT_STATUS_IS_OK(status)) {
                return status;
index fd37371ed04b89a673cdf81dd1bbd4e41d2cd41f..0f38a4986f53a084347b4e0e0264285ba1e0689c 100644 (file)
@@ -1687,7 +1687,7 @@ void reply_open(struct smb_request *req)
 
        if (fattr & aDIR) {
                DEBUG(3,("attempt to open a directory %s\n",fsp->fsp_name));
-               close_file(fsp,ERROR_CLOSE);
+               close_file(req, fsp, ERROR_CLOSE);
                reply_doserror(req, ERRDOS,ERRnoaccess);
                END_PROFILE(SMBopen);
                return;
@@ -1830,14 +1830,14 @@ void reply_open_and_X(struct smb_request *req)
        if (((smb_action == FILE_WAS_CREATED) || (smb_action == FILE_WAS_OVERWRITTEN)) && allocation_size) {
                fsp->initial_allocation_size = smb_roundup(fsp->conn, allocation_size);
                if (vfs_allocate_file_space(fsp, fsp->initial_allocation_size) == -1) {
-                       close_file(fsp,ERROR_CLOSE);
+                       close_file(req, fsp, ERROR_CLOSE);
                        reply_nterror(req, NT_STATUS_DISK_FULL);
                        END_PROFILE(SMBopenX);
                        return;
                }
                retval = vfs_set_filelen(fsp, (SMB_OFF_T)allocation_size);
                if (retval < 0) {
-                       close_file(fsp,ERROR_CLOSE);
+                       close_file(req, fsp, ERROR_CLOSE);
                        reply_nterror(req, NT_STATUS_DISK_FULL);
                        END_PROFILE(SMBopenX);
                        return;
@@ -1848,7 +1848,7 @@ void reply_open_and_X(struct smb_request *req)
        fattr = dos_mode(conn,fsp->fsp_name,&sbuf);
        mtime = sbuf.st_mtime;
        if (fattr & aDIR) {
-               close_file(fsp,ERROR_CLOSE);
+               close_file(req, fsp, ERROR_CLOSE);
                reply_doserror(req, ERRDOS, ERRnoaccess);
                END_PROFILE(SMBopenX);
                return;
@@ -2363,11 +2363,11 @@ static NTSTATUS do_unlink(connection_struct *conn,
 
        /* The set is across all open files on this dev/inode pair. */
        if (!set_delete_on_close(fsp, True, &conn->server_info->utok)) {
-               close_file(fsp, NORMAL_CLOSE);
+               close_file(req, fsp, NORMAL_CLOSE);
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       return close_file(fsp,NORMAL_CLOSE);
+       return close_file(req, fsp, NORMAL_CLOSE);
 }
 
 /****************************************************************************
@@ -4285,7 +4285,7 @@ void reply_close(struct smb_request *req)
                 * Special case - close NT SMB directory handle.
                 */
                DEBUG(3,("close directory fnum=%d\n", fsp->fnum));
-               status = close_file(fsp,NORMAL_CLOSE);
+               status = close_file(req, fsp, NORMAL_CLOSE);
        } else {
                time_t t;
                /*
@@ -4309,7 +4309,7 @@ void reply_close(struct smb_request *req)
                 * a disk full error. If not then it was probably an I/O error.
                 */
  
-               status = close_file(fsp,NORMAL_CLOSE);
+               status = close_file(req, fsp, NORMAL_CLOSE);
        }  
 
        if (!NT_STATUS_IS_OK(status)) {
@@ -4384,7 +4384,7 @@ void reply_writeclose(struct smb_request *req)
        if (numtowrite) {
                DEBUG(3,("reply_writeclose: zero length write doesn't close file %s\n",
                        fsp->fsp_name ));
-               close_status = close_file(fsp,NORMAL_CLOSE);
+               close_status = close_file(req, fsp, NORMAL_CLOSE);
        }
 
        DEBUG(3,("writeclose fnum=%d num=%d wrote=%d (numopen=%d)\n",
@@ -4690,7 +4690,7 @@ void reply_printclose(struct smb_request *req)
        DEBUG(3,("printclose fd=%d fnum=%d\n",
                 fsp->fh->fd,fsp->fnum));
   
-       status = close_file(fsp,NORMAL_CLOSE);
+       status = close_file(req, fsp, NORMAL_CLOSE);
 
        if(!NT_STATUS_IS_OK(status)) {
                reply_nterror(req, status);
@@ -5785,7 +5785,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                                              last_component_dest,
                                              attrs, replace_if_exists);
 
-               close_file(fsp, NORMAL_CLOSE);
+               close_file(req, fsp, NORMAL_CLOSE);
 
                DEBUG(3, ("rename_internals: Error %s rename %s -> %s\n",
                          nt_errstr(status), directory,newname));
@@ -5889,7 +5889,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                status = rename_internals_fsp(conn, fsp, destname, dname,
                                              attrs, replace_if_exists);
 
-               close_file(fsp, NORMAL_CLOSE);
+               close_file(req, fsp, NORMAL_CLOSE);
 
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(3, ("rename_internals_fsp returned %s for "
@@ -6104,7 +6104,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
        TALLOC_FREE(dest);
 
        if (!NT_STATUS_IS_OK(status)) {
-               close_file(fsp1,ERROR_CLOSE);
+               close_file(NULL, fsp1, ERROR_CLOSE);
                return status;
        }
 
@@ -6123,7 +6123,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
                ret = vfs_transfer_file(fsp1, fsp2, src_sbuf.st_size);
        }
 
-       close_file(fsp1,NORMAL_CLOSE);
+       close_file(NULL, fsp1, NORMAL_CLOSE);
 
        /* Ensure the modtime is set correctly on the destination file. */
        set_close_write_time(fsp2, get_mtimespec(&src_sbuf));
@@ -6134,7 +6134,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
         * Thus we don't look at the error return from the
         * close of fsp1.
         */
-       status = close_file(fsp2,NORMAL_CLOSE);
+       status = close_file(NULL, fsp2, NORMAL_CLOSE);
 
        if (!NT_STATUS_IS_OK(status)) {
                return status;
index 850552eca6ae32e1bbbd144336db61ee9edc219f..a82c2920df81548210be705551a5668e40a5a36b 100644 (file)
@@ -1031,7 +1031,7 @@ static void call_trans2open(connection_struct *conn,
        mtime = sbuf.st_mtime;
        inode = sbuf.st_ino;
        if (fattr & aDIR) {
-               close_file(fsp,ERROR_CLOSE);
+               close_file(req, fsp, ERROR_CLOSE);
                reply_doserror(req, ERRDOS,ERRnoaccess);
                return;
        }
@@ -5016,12 +5016,12 @@ static NTSTATUS smb_set_file_size(connection_struct *conn,
 
        if (vfs_set_filelen(new_fsp, size) == -1) {
                status = map_nt_error_from_unix(errno);
-               close_file(new_fsp,NORMAL_CLOSE);
+               close_file(req, new_fsp,NORMAL_CLOSE);
                return status;
        }
 
        trigger_write_time_update_immediate(new_fsp);
-       close_file(new_fsp,NORMAL_CLOSE);
+       close_file(req, new_fsp,NORMAL_CLOSE);
        return NT_STATUS_OK;
 }
 
@@ -5771,7 +5771,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
        if (allocation_size != get_file_size(*psbuf)) {
                if (vfs_allocate_file_space(new_fsp, allocation_size) == -1) {
                        status = map_nt_error_from_unix(errno);
-                       close_file(new_fsp,NORMAL_CLOSE);
+                       close_file(req, new_fsp, NORMAL_CLOSE);
                        return status;
                }
        }
@@ -5783,7 +5783,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
         */
        trigger_write_time_update_immediate(new_fsp);
 
-       close_file(new_fsp,NORMAL_CLOSE);
+       close_file(req, new_fsp, NORMAL_CLOSE);
        return NT_STATUS_OK;
 }
 
@@ -6196,7 +6196,7 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn,
                                &fsp);
 
         if (NT_STATUS_IS_OK(status)) {
-                close_file(fsp, NORMAL_CLOSE);
+                close_file(req, fsp, NORMAL_CLOSE);
         }
 
        info_level_return = SVAL(pdata,16);
@@ -6389,7 +6389,7 @@ static NTSTATUS smb_posix_open(connection_struct *conn,
        /* Realloc the data size */
        *ppdata = (char *)SMB_REALLOC(*ppdata,*pdata_return_size);
        if (*ppdata == NULL) {
-               close_file(fsp,ERROR_CLOSE);
+               close_file(req, fsp, ERROR_CLOSE);
                *pdata_return_size = 0;
                return NT_STATUS_NO_MEMORY;
        }
@@ -6507,7 +6507,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
        if (lck == NULL) {
                DEBUG(0, ("smb_posix_unlink: Could not get share mode "
                        "lock for file %s\n", fsp->fsp_name));
-               close_file(fsp, NORMAL_CLOSE);
+               close_file(req, fsp, NORMAL_CLOSE);
                return NT_STATUS_INVALID_PARAMETER;
        }
 
@@ -6523,7 +6523,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
                                continue;
                        }
                        /* Fail with sharing violation. */
-                       close_file(fsp, NORMAL_CLOSE);
+                       close_file(req, fsp, NORMAL_CLOSE);
                        TALLOC_FREE(lck);
                        return NT_STATUS_SHARING_VIOLATION;
                }
@@ -6540,12 +6540,12 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
                                                psbuf);
 
        if (!NT_STATUS_IS_OK(status)) {
-               close_file(fsp, NORMAL_CLOSE);
+               close_file(req, fsp, NORMAL_CLOSE);
                TALLOC_FREE(lck);
                return status;
        }
        TALLOC_FREE(lck);
-       return close_file(fsp, NORMAL_CLOSE);
+       return close_file(req, fsp, NORMAL_CLOSE);
 }
 
 /****************************************************************************