From c7130b816b29cab981646482e57cb6923ae91b4f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 12 Oct 2004 05:07:33 +0000 Subject: r2926: name->dos.attrib is not valid unless name->exists is true (This used to be commit f85a0b725d3bf67531e6874d4e8558fb050bb66f) --- source4/ntvfs/posix/pvfs_open.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 271bd41429..29e57e5a08 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -110,12 +110,14 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, #define O_DIRECTORY 0 #endif - if ((io->generic.in.create_options & NTCREATEX_OPTIONS_DIRECTORY) && + if (name->exists && + (io->generic.in.create_options & NTCREATEX_OPTIONS_DIRECTORY) && !(name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)) { return NT_STATUS_NOT_A_DIRECTORY; } - if (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) { + if ((name->exists && name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) || + (io->generic.in.create_options & NTCREATEX_OPTIONS_DIRECTORY)) { flags = O_RDONLY | O_DIRECTORY; if (pvfs->flags & PVFS_FLAG_READONLY) { goto do_open; -- cgit