From 9b31f6ab6cce55824f3e62f59061085abc1240db Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 28 Dec 2010 16:25:16 -0800 Subject: Fix bug #7892 - open_file_fchmod() leaves a stale lock. Autobuild-User: Jeremy Allison Autobuild-Date: Wed Dec 29 02:15:23 CET 2010 on sn-devel-104 --- source3/smbd/dosmode.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'source3/smbd/dosmode.c') diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index cf95348583..838dec035e 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -415,7 +415,7 @@ static bool set_ea_dos_attribute(connection_struct *conn, * are not violating security in doing the setxattr. */ - if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, smb_fname, + if (!NT_STATUS_IS_OK(open_file_fchmod(conn, smb_fname, &fsp))) return ret; become_root(); @@ -425,7 +425,7 @@ static bool set_ea_dos_attribute(connection_struct *conn, ret = true; } unbecome_root(); - close_file_fchmod(NULL, fsp); + close_file(NULL, fsp, NORMAL_CLOSE); return ret; } DEBUG(10,("set_ea_dos_attribute: set EA 0x%x on file %s\n", @@ -823,18 +823,15 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname, * We need to open the file with write access whilst * still in our current user context. This ensures we * are not violating security in doing the fchmod. - * This file open does *not* break any oplocks we are - * holding. We need to review this.... may need to - * break batch oplocks open by others. JRA. */ files_struct *fsp; - if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, smb_fname, + if (!NT_STATUS_IS_OK(open_file_fchmod(conn, smb_fname, &fsp))) return -1; become_root(); ret = SMB_VFS_FCHMOD(fsp, unixmode); unbecome_root(); - close_file_fchmod(NULL, fsp); + close_file(NULL, fsp, NORMAL_CLOSE); if (!newfile) { notify_fname(conn, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_ATTRIBUTES, -- cgit