From 68750d8153f01bd0802bb86e93c3ca5d11acb199 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 14 Sep 1998 19:49:55 +0000 Subject: Fixed problems people were having with creating profile directories (NTTrans/Create with Security Descriptor for a directory). It turns out the CIFS spec is bogus (what a suprise) and the 'is a directory' flag is actually embedded in the create_options field. Jeremy. --- source/include/smb.h | 10 ++++++++++ source/smbd/nttrans.c | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/source/include/smb.h b/source/include/smb.h index 5a90f08258f..412b1f33834 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -1187,6 +1187,16 @@ struct bitmap { #define FILE_OVERWRITE 4 #define FILE_OVERWRITE_IF 5 +/* CreateOptions field. */ +#define FILE_DIRECTORY_FILE 0x0001 +#define FILE_WRITE_THROUGH 0x0002 +#define FILE_SEQUENTIAL_ONLY 0x0004 +#define FILE_NON_DIRECTORY_FILE 0x0040 +#define FILE_NO_EA_KNOWLEDGE 0x0200 +#define FILE_EIGHT_DOT_THREE_ONLY 0x0400 +#define FILE_RANDOM_ACCESS 0x0800 +#define FILE_DELETE_ON_CLOSE 0x1000 + /* Responses when opening a file. */ #define FILE_WAS_OPENED 1 #define FILE_WAS_CREATED 2 diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c index 5052e6d52ac..866d9938b14 100644 --- a/source/smbd/nttrans.c +++ b/source/smbd/nttrans.c @@ -407,6 +407,7 @@ int reply_ntcreate_and_X(connection_struct *conn, uint32 file_attributes = IVAL(inbuf,smb_ntcreate_FileAttributes); uint32 share_access = IVAL(inbuf,smb_ntcreate_ShareAccess); uint32 create_disposition = IVAL(inbuf,smb_ntcreate_CreateDisposition); + uint32 create_options = IVAL(inbuf,smb_ntcreate_CreateOptions); uint32 fname_len = MIN(((uint32)SVAL(inbuf,smb_ntcreate_NameLength)), ((uint32)sizeof(fname)-1)); int smb_ofun; @@ -521,7 +522,7 @@ int reply_ntcreate_and_X(connection_struct *conn, * If it's a request for a directory open, deal with it separately. */ - if(flags & OPEN_DIRECTORY) { + if(create_options & FILE_DIRECTORY_FILE) { oplock_request = 0; open_directory(fsp, conn, fname, smb_ofun, @@ -699,6 +700,7 @@ static int call_nt_transact_create(connection_struct *conn, uint32 file_attributes = IVAL(params,20); uint32 share_access = IVAL(params,24); uint32 create_disposition = IVAL(params,28); + uint32 create_options = IVAL(params,32); uint32 fname_len = MIN(((uint32)IVAL(params,44)), ((uint32)sizeof(fname)-1)); int smb_ofun; @@ -781,7 +783,7 @@ static int call_nt_transact_create(connection_struct *conn, * If it's a request for a directory open, deal with it separately. */ - if(flags & OPEN_DIRECTORY) { + if(create_options & FILE_DIRECTORY_FILE) { oplock_request = 0; -- cgit v1.2.1