diff options
author | Jeremy Allison <jra@samba.org> | 2011-04-29 16:15:55 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-04-29 16:15:55 -0700 |
commit | 2cb53f066e0e42d923be89dd3a7e18ea7a1b7340 (patch) | |
tree | 59013af2202fcbc33193bcec846ddc8f67b7f33a /source3/smbd | |
parent | 440d71f6c76a4363f69eaf70cada69bdcb98c7bf (diff) | |
download | samba-2cb53f066e0e42d923be89dd3a7e18ea7a1b7340.tar.gz samba-2cb53f066e0e42d923be89dd3a7e18ea7a1b7340.tar.bz2 samba-2cb53f066e0e42d923be89dd3a7e18ea7a1b7340.zip |
Fix bug #8112 - POSIX extension opens of a directory are denied with EISDIR.
Ensure create_options are passed down to SMB_VFS_CREATE_FILE().
Correctly set create_options is SMB_O_DIRECTORY is set or pathname
is known to be a directory.
Jeremy.
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/trans2.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 028d3182a7..46f2aa0368 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -7240,7 +7240,7 @@ static NTSTATUS smb_posix_open(connection_struct *conn, uint32 mod_unixmode = 0; uint32 create_disp = 0; uint32 access_mask = 0; - uint32 create_options = 0; + uint32 create_options = FILE_NON_DIRECTORY_FILE; NTSTATUS status = NT_STATUS_OK; mode_t unixmode = (mode_t)0; files_struct *fsp = NULL; @@ -7354,6 +7354,14 @@ 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_DIRECTORY) || + VALID_STAT_OF_DIR(smb_fname->st)) { + if (access_mask != FILE_READ_DATA) { + 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; } @@ -7375,7 +7383,7 @@ static NTSTATUS smb_posix_open(connection_struct *conn, (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ FILE_SHARE_DELETE), create_disp, /* create_disposition*/ - FILE_NON_DIRECTORY_FILE, /* create_options */ + create_options, /* create_options */ mod_unixmode, /* file_attributes */ oplock_request, /* oplock_request */ 0, /* allocation_size */ |