diff options
author | Jeremy Allison <jra@samba.org> | 2007-10-30 12:55:56 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-10-30 12:55:56 -0700 |
commit | 4367f4b4d4ce075f3fe8e88e68dbda47e2252349 (patch) | |
tree | 3270a75923fc0824eebcc9419841b348161fe251 | |
parent | 9da9423f21bae8e714e735f7493eef8ddb4760df (diff) | |
parent | f5dcac6e8ed17a45d82ce395b01f8d5418a11331 (diff) | |
download | samba-4367f4b4d4ce075f3fe8e88e68dbda47e2252349.tar.gz samba-4367f4b4d4ce075f3fe8e88e68dbda47e2252349.tar.bz2 samba-4367f4b4d4ce075f3fe8e88e68dbda47e2252349.zip |
Merge branch 'v3-2-test' of ssh://jra@git.samba.org/data/git/samba into v3-2-test
(This used to be commit 765b37c693516757686118fffd3c80cf4d5e7344)
-rw-r--r-- | source3/libsmb/clireadwrite.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 0d037e946e..e2d5337ee4 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -291,7 +291,7 @@ static bool cli_issue_write(struct cli_state *cli, int fnum, off_t offset, char *p; bool large_writex = False; - if (size > cli->bufsize) { + if (size + 1 > cli->bufsize) { cli->outbuf = (char *)SMB_REALLOC(cli->outbuf, size + 1024); if (!cli->outbuf) { return False; @@ -307,7 +307,7 @@ static bool cli_issue_write(struct cli_state *cli, int fnum, off_t offset, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - if (((SMB_BIG_UINT)offset >> 32) || (size > 0xFFFF)) { + if (cli->capabilities & CAP_LARGE_FILES) { large_writex = True; } @@ -315,11 +315,11 @@ static bool cli_issue_write(struct cli_state *cli, int fnum, off_t offset, set_message(cli->outbuf,14,0,True); else set_message(cli->outbuf,12,0,True); - + SCVAL(cli->outbuf,smb_com,SMBwriteX); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); - + SCVAL(cli->outbuf,smb_vwv0,0xFF); SSVAL(cli->outbuf,smb_vwv2,fnum); @@ -336,19 +336,21 @@ static bool cli_issue_write(struct cli_state *cli, int fnum, off_t offset, */ SSVAL(cli->outbuf,smb_vwv9,((size>>16)&1)); SSVAL(cli->outbuf,smb_vwv10,size); + /* +1 is pad byte. */ SSVAL(cli->outbuf,smb_vwv11, - smb_buf(cli->outbuf) - smb_base(cli->outbuf)); + smb_buf(cli->outbuf) - smb_base(cli->outbuf) + 1); if (large_writex) { SIVAL(cli->outbuf,smb_vwv12,(((SMB_BIG_UINT)offset)>>32) & 0xffffffff); } - - p = smb_base(cli->outbuf) + SVAL(cli->outbuf,smb_vwv11); + + p = smb_base(cli->outbuf) + SVAL(cli->outbuf,smb_vwv11) -1; + *p++ = '\0'; /* pad byte. */ memcpy(p, buf, size); cli_setup_bcc(cli, p+size); SSVAL(cli->outbuf,smb_mid,cli->mid + i); - + show_msg(cli->outbuf); return cli_send_smb(cli); } |