summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-02 12:21:34 -0700
committerJeremy Allison <jra@samba.org>2007-11-02 12:21:34 -0700
commit329365684bca99bf9020b6638a1357df65c1d938 (patch)
tree78d2ddfa0440fcaf14f4c9d4adbcf7c71572b968 /source3/smbd
parentf2a63dccabcd82ce2ae1cf0df5ce824c7ab63fc2 (diff)
downloadsamba-329365684bca99bf9020b6638a1357df65c1d938.tar.gz
samba-329365684bca99bf9020b6638a1357df65c1d938.tar.bz2
samba-329365684bca99bf9020b6638a1357df65c1d938.zip
Change the client library to write directly out of
the incoming buffer in the non-signed case. Speeds up writes by over 10% or so. Complete the server recvfile implementation. Jeremy. (This used to be commit 81ca5853b2475f123faab3b550f0a7b24ae3c208)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 84c1892560..a7fa67df22 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3848,12 +3848,12 @@ void reply_write(connection_struct *conn, struct smb_request *req)
(2*14) + /* word count (including bcc) */ \
1 /* pad byte */)
-bool is_valid_writeX_buffer(char *inbuf)
+bool is_valid_writeX_buffer(const char *inbuf)
{
size_t numtowrite;
connection_struct *conn = NULL;
unsigned int doff = 0;
- size_t len = smb_len(inbuf);
+ size_t len = smb_len_large(inbuf);
if (CVAL(inbuf,smb_com) != SMBwriteX ||
CVAL(inbuf,smb_vwv0) != 0xFF ||
@@ -3867,14 +3867,19 @@ bool is_valid_writeX_buffer(char *inbuf)
if (IS_IPC(conn)) {
return false;
}
+ doff = SVAL(inbuf,smb_vwv11);
+
numtowrite = SVAL(inbuf,smb_vwv10);
- numtowrite |= ((((size_t)SVAL(inbuf,smb_vwv9)) & 1 )<<16);
+
+ if (len > doff && len - doff > 0xFFFF) {
+ numtowrite |= (((size_t)SVAL(inbuf,smb_vwv9))<<16);
+ }
+
if (numtowrite == 0) {
return false;
}
- /* Ensure the sizes match up. */
- doff = SVAL(inbuf,smb_vwv11);
+ /* Ensure the sizes match up. */
if (doff < STANDARD_WRITE_AND_X_HEADER_SIZE) {
/* no pad byte...old smbclient :-( */
return false;