diff options
author | Jeremy Allison <jra@samba.org> | 2007-03-11 02:33:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:18:33 -0500 |
commit | 5214cb6782b1ac01b4b23d53478fa11ad00915fe (patch) | |
tree | 4a3e63eef3c24cf5c938c1800c3a38bf9964b09d /source3/smbd | |
parent | 8a05fe78c966bed4c1f18561bf03f9f190b36434 (diff) | |
download | samba-5214cb6782b1ac01b4b23d53478fa11ad00915fe.tar.gz samba-5214cb6782b1ac01b4b23d53478fa11ad00915fe.tar.bz2 samba-5214cb6782b1ac01b4b23d53478fa11ad00915fe.zip |
r21783: Add in the "create info" field to the reply
from POSIX_OPEN and POSIX_MKDIR as specified
by Stevef in the wikki (extra 4 byte field).
Also fix horrible bug in James's code (James
you should review this for your Apple patch
tree) where he failed to allocate the correct
return memory size when returning a INFO2
struct. Added #define for the size of the
INFO2 struct and made sure we allocate the
correct size for return.
Jeremy.
(This used to be commit d88bc59cb4d5e8851b0856c67ed878ba8bd84552)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/trans2.c | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 5401aac15d..01956d8119 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -5227,6 +5227,7 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn, mode_t unixmode = (mode_t)0; files_struct *fsp = NULL; uint16 info_level_return = 0; + int info; char *pdata = *ppdata; if (total_data < 18) { @@ -5254,7 +5255,7 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn, FILE_CREATE, 0, mod_unixmode, - NULL, + &info, &fsp); if (NT_STATUS_IS_OK(status)) { @@ -5264,9 +5265,11 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn, info_level_return = SVAL(pdata,16); if (info_level_return == SMB_QUERY_FILE_UNIX_BASIC) { - *pdata_return_size = 8 + SMB_FILE_UNIX_BASIC_SIZE; + *pdata_return_size = 12 + SMB_FILE_UNIX_BASIC_SIZE; + } else if (info_level_return == SMB_QUERY_FILE_UNIX_INFO2) { + *pdata_return_size = 12 + SMB_FILE_UNIX_INFO2_SIZE; } else { - *pdata_return_size = 8; + *pdata_return_size = 12; } /* Realloc the data size */ @@ -5277,20 +5280,21 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn, } SSVAL(pdata,0,NO_OPLOCK_RETURN); - SSVAL(pdata,2,0); + SSVAL(pdata,2,0); /* No fnum. */ + SIVAL(pdata,4,info); /* Was directory created. */ switch (info_level_return) { case SMB_QUERY_FILE_UNIX_BASIC: - SSVAL(pdata,4,SMB_QUERY_FILE_UNIX_BASIC); - SSVAL(pdata,6,0); /* Padding. */ - store_file_unix_basic(conn, pdata + 8, fsp, psbuf); + SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_BASIC); + SSVAL(pdata,10,0); /* Padding. */ + store_file_unix_basic(conn, pdata + 12, fsp, psbuf); case SMB_QUERY_FILE_UNIX_INFO2: - SSVAL(pdata,4,SMB_QUERY_FILE_UNIX_INFO2); - SSVAL(pdata,6,0); /* Padding. */ - store_file_unix_basic_info2(conn, pdata + 8, fsp, psbuf); + SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_INFO2); + SSVAL(pdata,10,0); /* Padding. */ + store_file_unix_basic_info2(conn, pdata + 12, fsp, psbuf); default: - SSVAL(pdata,4,SMB_NO_INFO_LEVEL_RETURNED); - SSVAL(pdata,6,0); /* Padding. */ + SSVAL(pdata,8,SMB_NO_INFO_LEVEL_RETURNED); + SSVAL(pdata,10,0); /* Padding. */ } return status; @@ -5430,10 +5434,14 @@ static NTSTATUS smb_posix_open(connection_struct *conn, info_level_return = SVAL(pdata,16); + /* Allocate the correct return size. */ + if (info_level_return == SMB_QUERY_FILE_UNIX_BASIC) { - *pdata_return_size = 8 + SMB_FILE_UNIX_BASIC_SIZE; + *pdata_return_size = 12 + SMB_FILE_UNIX_BASIC_SIZE; + } else if (info_level_return == SMB_QUERY_FILE_UNIX_INFO2) { + *pdata_return_size = 12 + SMB_FILE_UNIX_INFO2_SIZE; } else { - *pdata_return_size = 8; + *pdata_return_size = 12; } /* Realloc the data size */ @@ -5457,18 +5465,20 @@ static NTSTATUS smb_posix_open(connection_struct *conn, } SSVAL(pdata,2,fsp->fnum); + SIVAL(pdata,4,info); /* Was file created etc. */ + switch (info_level_return) { case SMB_QUERY_FILE_UNIX_BASIC: - SSVAL(pdata,4,SMB_QUERY_FILE_UNIX_BASIC); - SSVAL(pdata,6,0); /* padding. */ - store_file_unix_basic(conn, pdata + 8, fsp, psbuf); + SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_BASIC); + SSVAL(pdata,10,0); /* padding. */ + store_file_unix_basic(conn, pdata + 12, fsp, psbuf); case SMB_QUERY_FILE_UNIX_INFO2: - SSVAL(pdata,4,SMB_QUERY_FILE_UNIX_INFO2); - SSVAL(pdata,6,0); /* padding. */ - store_file_unix_basic_info2(conn, pdata + 8, fsp, psbuf); + SSVAL(pdata,8,SMB_QUERY_FILE_UNIX_INFO2); + SSVAL(pdata,10,0); /* padding. */ + store_file_unix_basic_info2(conn, pdata + 12, fsp, psbuf); default: - SSVAL(pdata,4,SMB_NO_INFO_LEVEL_RETURNED); - SSVAL(pdata,6,0); /* padding. */ + SSVAL(pdata,8,SMB_NO_INFO_LEVEL_RETURNED); + SSVAL(pdata,10,0); /* padding. */ } return NT_STATUS_OK; } |