diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-06-02 14:06:29 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-06-03 21:08:19 +0200 |
commit | abcd095847c7438c3be39f6c9200a04c90394ed6 (patch) | |
tree | 516edb6cfcaffbfbb43ececc3a547df081a1b4c5 | |
parent | f66d88d10afff65d743663b2e27a94271225b229 (diff) | |
download | samba-abcd095847c7438c3be39f6c9200a04c90394ed6.tar.gz samba-abcd095847c7438c3be39f6c9200a04c90394ed6.tar.bz2 samba-abcd095847c7438c3be39f6c9200a04c90394ed6.zip |
s3:smbd/close: call del_share_mode() directly before TALLOC_FREE(lck)
metze
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Sun Jun 3 21:08:19 CEST 2012 on sn-devel-104
-rw-r--r-- | source3/smbd/close.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c index adcd67a5f5..1fb7bdeb84 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -1047,6 +1047,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, files_struct *fsp) static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, enum file_close_type close_type) { + struct server_id self = messaging_server_id(fsp->conn->sconn->msg_ctx); struct share_mode_lock *lck = NULL; bool delete_dir = False; NTSTATUS status = NT_STATUS_OK; @@ -1066,11 +1067,6 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, return NT_STATUS_INVALID_PARAMETER; } - if (!del_share_mode(lck, fsp)) { - DEBUG(0, ("close_directory: Could not delete share entry for " - "%s\n", fsp_str_dbg(fsp))); - } - if (fsp->initial_delete_on_close) { bool became_user = False; @@ -1107,6 +1103,10 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, if (fsp->posix_open && (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) { continue; } + if (procid_equal(&self, &e->pid) && + (e->share_file_id == fsp->fh->gen_id)) { + continue; + } if (share_mode_stale_pid(lck->data, i)) { continue; } @@ -1131,6 +1131,11 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, del_token->groups, del_nt_token); + if (!del_share_mode(lck, fsp)) { + DEBUG(0, ("close_directory: Could not delete share entry for " + "%s\n", fsp_str_dbg(fsp))); + } + TALLOC_FREE(lck); if ((fsp->conn->fs_capabilities & FILE_NAMED_STREAMS) @@ -1162,6 +1167,11 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, remove_pending_change_notify_requests_by_fid(fsp, NT_STATUS_DELETE_PENDING); } } else { + if (!del_share_mode(lck, fsp)) { + DEBUG(0, ("close_directory: Could not delete share entry for " + "%s\n", fsp_str_dbg(fsp))); + } + TALLOC_FREE(lck); remove_pending_change_notify_requests_by_fid( fsp, NT_STATUS_OK); |