summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-04-02 00:13:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:27 -0500
commit1045c786246658f5d8e289d46cb4bdfc87655c71 (patch)
tree4e6594a4b38cf130729de12e36df3b683b70b87e /source3
parent0557c6cba2a21c9df547fbc8ff4db2899bc1c171 (diff)
downloadsamba-1045c786246658f5d8e289d46cb4bdfc87655c71.tar.gz
samba-1045c786246658f5d8e289d46cb4bdfc87655c71.tar.bz2
samba-1045c786246658f5d8e289d46cb4bdfc87655c71.zip
r6174: Fixup T2 open call - we were returning 2 bytes short.
Jeremy. (This used to be commit 0c7de7615bf0edbb36a3afee445db13a71e26d2e)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/open.c17
-rw-r--r--source3/smbd/reply.c12
-rw-r--r--source3/smbd/trans2.c31
3 files changed, 35 insertions, 25 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 41ced42034..fbe763ab0a 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1098,23 +1098,6 @@ files_struct *open_file_shared1(connection_struct *conn,char *fname, SMB_STRUCT_
return print_fsp_open(conn, fname);
}
- switch(ofun) {
- case FILE_EXISTS_OPEN:
- case FILE_EXISTS_TRUNCATE:
- case FILE_EXISTS_FAIL | FILE_CREATE_IF_NOT_EXIST:
- case FILE_EXISTS_OPEN | FILE_CREATE_IF_NOT_EXIST:
- case FILE_EXISTS_TRUNCATE | FILE_CREATE_IF_NOT_EXIST:
- break; /* These are ok. */
- default:
- if (GET_OPEN_MODE(share_mode) == DOS_OPEN_EXEC) {
- ofun = FILE_EXISTS_FAIL | FILE_CREATE_IF_NOT_EXIST;
- break;
- }
- /* Cause caller to force dos errors. */
- set_saved_error_triple(ERRDOS, ERRbadaccess, NT_STATUS_INVALID);
- return NULL;
- }
-
DEBUG(10,("open_file_shared: fname = %s, dos_attrs = %x, share_mode = %x, ofun = %x, mode = %o, oplock request = %d\n",
fname, new_dos_mode, share_mode, ofun, (int)mode, oplock_request ));
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index aef9755122..22cb599195 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1295,7 +1295,17 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
END_PROFILE(SMBopenX);
return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
}
-
+
+ /* Strange open mode mapping. */
+ if (smb_ofun == 0) {
+ if (GET_OPEN_MODE(smb_mode) == DOS_OPEN_EXEC) {
+ smb_ofun = FILE_EXISTS_FAIL | FILE_CREATE_IF_NOT_EXIST;
+ } else {
+ END_PROFILE(SMBopenX);
+ return ERROR_FORCE_DOS(ERRDOS, ERRbadaccess);
+ }
+ }
+
fsp = open_file_shared(conn,fname,&sbuf,smb_mode,smb_ofun,(uint32)smb_attr,
oplock_request, &rmode,&smb_action);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index a497e8d81c..cbb350ebb7 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -732,6 +732,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, i
files_struct *fsp;
TALLOC_CTX *ctx = NULL;
struct ea_list *ea_list = NULL;
+ uint16 flags = 0;
NTSTATUS status;
/*
@@ -742,11 +743,12 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, i
return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
}
+ flags = SVAL(params, 0);
open_mode = SVAL(params, 2);
open_attr = SVAL(params,6);
- oplock_request = (SVAL(params,0) & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
+ oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
if (oplock_request) {
- oplock_request |= (SVAL(params,0) & REQUEST_BATCH_OPLOCK) ? BATCH_OPLOCK : 0;
+ oplock_request |= (flags & REQUEST_BATCH_OPLOCK) ? BATCH_OPLOCK : 0;
}
#if 0
@@ -780,6 +782,16 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, i
return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
}
+ /* Strange open mode mapping. */
+ if (open_ofun == 0) {
+ if (GET_OPEN_MODE(open_mode) == DOS_OPEN_EXEC) {
+ open_ofun = FILE_EXISTS_FAIL | FILE_CREATE_IF_NOT_EXIST;
+ } else {
+ END_PROFILE(SMBopenX);
+ return ERROR_FORCE_DOS(ERRDOS, ERRbadaccess);
+ }
+ }
+
/* Any data in this call is an EA list. */
if (total_data && !lp_ea_support(SNUM(conn))) {
return ERROR_NT(NT_STATUS_EAS_NOT_SUPPORTED);
@@ -839,21 +851,22 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, i
}
/* Realloc the size of parameters and data we will return */
- params = SMB_REALLOC(*pparams, 28);
+ params = SMB_REALLOC(*pparams, 30);
if( params == NULL ) {
return ERROR_NT(NT_STATUS_NO_MEMORY);
}
*pparams = params;
- memset((char *)params,'\0',28);
+ memset((char *)params,'\0',30);
SSVAL(params,0,fsp->fnum);
SSVAL(params,2,fmode);
put_dos_date2(params,4, mtime);
SIVAL(params,8, (uint32)size);
SSVAL(params,12,rmode);
- if (oplock_request && lp_fake_oplocks(SNUM(conn)))
+ if (oplock_request && lp_fake_oplocks(SNUM(conn))) {
smb_action |= EXTENDED_OPLOCK_GRANTED;
+ }
SSVAL(params,18,smb_action);
@@ -861,9 +874,13 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, i
* WARNING - this may need to be changed if SMB_INO_T <> 4 bytes.
*/
SIVAL(params,20,inode);
-
+ if (flags & 8) {
+ uint32 ea_size = estimate_ea_size(conn, fsp, fname);
+ SIVAL(params, 26, ea_size);
+ }
+
/* Send the required number of replies */
- send_trans2_replies(outbuf, bufsize, params, 28, *ppdata, 0);
+ send_trans2_replies(outbuf, bufsize, params, 30, *ppdata, 0);
return -1;
}