summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-12-28 16:25:16 -0800
committerJeremy Allison <jra@samba.org>2010-12-29 02:15:23 +0100
commit9b31f6ab6cce55824f3e62f59061085abc1240db (patch)
treed9112d0bbc55a1bcb0858a096da2ecd8730ec2fe /source3/smbd/open.c
parent4622812a41eb5ce07dd8f74534217e858743883f (diff)
downloadsamba-9b31f6ab6cce55824f3e62f59061085abc1240db.tar.gz
samba-9b31f6ab6cce55824f3e62f59061085abc1240db.tar.bz2
samba-9b31f6ab6cce55824f3e62f59061085abc1240db.zip
Fix bug #7892 - open_file_fchmod() leaves a stale lock.
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Dec 29 02:15:23 CET 2010 on sn-devel-104
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r--source3/smbd/open.c40
1 files changed, 4 insertions, 36 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 32a08b5967..722e461068 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2291,23 +2291,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,
struct smb_filename *smb_fname,
files_struct **result)
{
- files_struct *fsp = NULL;
- NTSTATUS status;
-
if (!VALID_STAT(smb_fname->st)) {
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 */
@@ -2318,37 +2310,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 */
0, /* private_flags */
NULL, /* sd */
NULL, /* ea_list */
- &fsp, /* result */
+ result, /* result */
NULL); /* pinfo */
-
- /*
- * 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,