diff options
author | Jeremy Allison <jra@samba.org> | 2010-12-28 18:11:33 -0800 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2011-01-13 17:58:54 +0100 |
commit | 4559441464b81c6a1582af376a5379025e369b44 (patch) | |
tree | 9849cd12aa0161e5f855292a96a134ecf08750b5 /source3/smbd/open.c | |
parent | 133b474c6d8cc0191148f3a00cab878784aaf9bd (diff) | |
download | samba-4559441464b81c6a1582af376a5379025e369b44.tar.gz |
Fix bug #7892 - open_file_fchmod() leaves a stale lock.
(cherry picked from commit 023aa6f4aae29ba22b3d42c815027ba6a66f8ee2)
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r-- | source3/smbd/open.c | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index ab3bf1ec757..1722895e37b 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2207,23 +2207,15 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, Open a file for for write to ensure that we can fchmod it. ****************************************************************************/ -NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn, +NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf, files_struct **result) { - files_struct *fsp = NULL; - NTSTATUS status; - if (!VALID_STAT(*psbuf)) { return NT_STATUS_INVALID_PARAMETER; } - status = file_new(req, conn, &fsp); - if(!NT_STATUS_IS_OK(status)) { - return status; - } - - status = SMB_VFS_CREATE_FILE( + return SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ 0, /* root_dir_fid */ @@ -2235,37 +2227,13 @@ NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn, FILE_OPEN, /* create_disposition*/ 0, /* create_options */ 0, /* file_attributes */ - 0, /* oplock_request */ + INTERNAL_OPEN_ONLY, /* oplock_request */ 0, /* allocation_size */ NULL, /* sd */ NULL, /* ea_list */ - &fsp, /* result */ + result, /* result */ NULL, /* pinfo */ psbuf); /* psbuf */ - - /* - * This is not a user visible file open. - * Don't set a share mode. - */ - - if (!NT_STATUS_IS_OK(status)) { - file_free(req, fsp); - return status; - } - - *result = fsp; - return NT_STATUS_OK; -} - -/**************************************************************************** - Close the fchmod file fd - ensure no locks are lost. -****************************************************************************/ - -NTSTATUS close_file_fchmod(struct smb_request *req, files_struct *fsp) -{ - NTSTATUS status = fd_close(fsp); - file_free(req, fsp); - return status; } static NTSTATUS mkdir_internal(connection_struct *conn, |