summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-05-17 16:18:51 -0700
committerJeremy Allison <jra@samba.org>2011-05-18 02:22:32 +0200
commit28734295557620c36ffe8f51dcef7158c46d78a0 (patch)
tree6baa57f38719f032d0e0ca9c7088e50ce307ec97 /source3
parent87a1888272127b53bab61a6e69023e67bdfca8d1 (diff)
downloadsamba-28734295557620c36ffe8f51dcef7158c46d78a0.tar.gz
samba-28734295557620c36ffe8f51dcef7158c46d78a0.tar.bz2
samba-28734295557620c36ffe8f51dcef7158c46d78a0.zip
Fix bug #8144 - touch /mnt/newfile fails to set timestamp with CIFS client.
The extra checks added for Windows correctness in our metadata changing paths to ensure the file handle has been opened with the correct access mask to allow FILE_WRITE_ATTRIBUTES etc. caused problems with the POSIX open code. The old POSIX open code maped O_RDONLY into FILE_READ, O_WRONLY into FILE_WRITE, and O_RDWR into FILE_READ|FILE_WRITE. This patch extends the mapping to add FILE_WRITE_ATTRIBUTES, FILE_READ_ATTRIBUTES and FILE_WRITE_EA, FILE_READ_EA to allow POSIX opens to set these values. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed May 18 02:22:32 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/trans2.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 733f1bc2a8..75d0a41e6b 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -7226,6 +7226,9 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn,
Open/Create a file with POSIX semantics.
****************************************************************************/
+#define SMB_O_RDONLY_MAPPING (FILE_READ_DATA|FILE_READ_ATTRIBUTES|FILE_READ_EA)
+#define SMB_O_WRONLY_MAPPING (FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES|FILE_WRITE_EA)
+
static NTSTATUS smb_posix_open(connection_struct *conn,
struct smb_request *req,
char **ppdata,
@@ -7271,13 +7274,14 @@ static NTSTATUS smb_posix_open(connection_struct *conn,
switch (wire_open_mode & SMB_ACCMODE) {
case SMB_O_RDONLY:
- access_mask = FILE_READ_DATA;
+ access_mask = SMB_O_RDONLY_MAPPING;
break;
case SMB_O_WRONLY:
- access_mask = FILE_WRITE_DATA;
+ access_mask = SMB_O_WRONLY_MAPPING;
break;
case SMB_O_RDWR:
- access_mask = FILE_READ_DATA|FILE_WRITE_DATA;
+ access_mask = (SMB_O_RDONLY_MAPPING|
+ SMB_O_WRONLY_MAPPING);
break;
default:
DEBUG(5,("smb_posix_open: invalid open mode 0x%x\n",
@@ -7355,20 +7359,21 @@ static NTSTATUS smb_posix_open(connection_struct *conn,
if (wire_open_mode & SMB_O_SYNC) {
create_options |= FILE_WRITE_THROUGH;
}
+ if (wire_open_mode & SMB_O_APPEND) {
+ access_mask |= FILE_APPEND_DATA;
+ }
+ if (wire_open_mode & SMB_O_DIRECT) {
+ mod_unixmode |= FILE_FLAG_NO_BUFFERING;
+ }
+
if ((wire_open_mode & SMB_O_DIRECTORY) ||
VALID_STAT_OF_DIR(smb_fname->st)) {
- if (access_mask != FILE_READ_DATA) {
+ if (access_mask != SMB_O_RDONLY_MAPPING) {
return NT_STATUS_FILE_IS_A_DIRECTORY;
}
create_options &= ~FILE_NON_DIRECTORY_FILE;
create_options |= FILE_DIRECTORY_FILE;
}
- if (wire_open_mode & SMB_O_APPEND) {
- access_mask |= FILE_APPEND_DATA;
- }
- if (wire_open_mode & SMB_O_DIRECT) {
- mod_unixmode |= FILE_FLAG_NO_BUFFERING;
- }
DEBUG(10,("smb_posix_open: file %s, smb_posix_flags = %u, mode 0%o\n",
smb_fname_str_dbg(smb_fname),