summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_open.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-05-20 11:58:47 +1000
committerAndrew Tridgell <tridge@samba.org>2008-05-20 11:58:47 +1000
commit2352602a57989ac1572151cba1da1e78b9410860 (patch)
treeef868f6b8813ad164b41e313960af14fb2ccceed /source4/ntvfs/posix/pvfs_open.c
parent803c076450da4075c71faaba3f0882f0b8e6208a (diff)
downloadsamba-2352602a57989ac1572151cba1da1e78b9410860.tar.gz
samba-2352602a57989ac1572151cba1da1e78b9410860.tar.bz2
samba-2352602a57989ac1572151cba1da1e78b9410860.zip
check the creation options where the client can require a path to be a
file or a directory (This used to be commit c05b58940f06b01b9770c218eb0708cb621215ef)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_open.c')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index c9c1c56f14..67937324cc 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -1117,6 +1117,20 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
return status;
}
+ /* if the client specified that it must not be a directory then
+ check that it isn't */
+ if (name->exists && (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) &&
+ (io->generic.in.create_options & NTCREATEX_OPTIONS_NON_DIRECTORY_FILE)) {
+ return NT_STATUS_FILE_IS_A_DIRECTORY;
+ }
+
+ /* if the client specified that it must be a directory then
+ check that it is */
+ if (name->exists && !(name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) &&
+ (io->generic.in.create_options & NTCREATEX_OPTIONS_DIRECTORY)) {
+ return NT_STATUS_NOT_A_DIRECTORY;
+ }
+
/* directory opens are handled separately */
if ((name->exists && (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)) ||
(io->generic.in.create_options & NTCREATEX_OPTIONS_DIRECTORY)) {