diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 9 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 10 | ||||
-rw-r--r-- | source3/printing/printfsp.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_srvsvc_nt.c | 8 | ||||
-rw-r--r-- | source3/smbd/close.c | 25 | ||||
-rw-r--r-- | source3/smbd/dosmode.c | 4 | ||||
-rw-r--r-- | source3/smbd/fake_file.c | 6 | ||||
-rw-r--r-- | source3/smbd/files.c | 8 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 6 | ||||
-rw-r--r-- | source3/smbd/open.c | 52 | ||||
-rw-r--r-- | source3/smbd/posix_acls.c | 4 | ||||
-rw-r--r-- | source3/smbd/reply.c | 30 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 22 |
13 files changed, 96 insertions, 92 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index db6130ce91..f8d6f10334 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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, diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 13a6403b1c..85f42feb91 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -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(); diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c index 02122e8a6b..a247cd8427 100644 --- a/source3/printing/printfsp.c +++ b/source3/printing/printfsp.c @@ -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 */ } diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 47688b114c..b99c77c9b8 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -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) { diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 818b4c70a8..d4c531ab19 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -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); } diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index a5cca53bc7..784b36d9bd 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -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); diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c index 3887483507..58b09604c4 100644 --- a/source3/smbd/fake_file.c +++ b/source3/smbd/fake_file.c @@ -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; } diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 33c43356c6..d77ee76be7 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -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); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index baa91e2955..6361f7949a 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -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 diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 0ae444b3d8..209ad4d587 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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; diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index c151e57e4c..f129506716 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -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; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index fd37371ed0..0f38a4986f 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 850552eca6..a82c2920df 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -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); } /**************************************************************************** |