From b68e6c99103fd0f1e8a25b2fafe14d7540b2ab10 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Mon, 30 Dec 2002 04:25:30 +0000 Subject: Port the fix to cli_setup_write to handle offsets greater than 32-bits from Samba 2.2.x ... (This used to be commit 4201038588bab8674b73371a5eac70a412c5dd6c) --- source3/libsmb/clireadwrite.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 7780c93cc4..187a40cade 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -252,6 +252,7 @@ static BOOL cli_issue_write(struct cli_state *cli, int fnum, off_t offset, uint1 size_t size, int i) { char *p; + BOOL bigoffset = False; if (size > cli->bufsize) { cli->outbuf = realloc(cli->outbuf, size + 1024); @@ -264,7 +265,10 @@ static BOOL cli_issue_write(struct cli_state *cli, int fnum, off_t offset, uint1 memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - if (size > 0xFFFF) + if ((SMB_BIG_UINT)offset >> 32) + bigoffset = True; + + if (bigoffset) set_message(cli->outbuf,14,0,True); else set_message(cli->outbuf,12,0,True); @@ -277,14 +281,20 @@ static BOOL cli_issue_write(struct cli_state *cli, int fnum, off_t offset, uint1 SSVAL(cli->outbuf,smb_vwv2,fnum); SIVAL(cli->outbuf,smb_vwv3,offset); - SIVAL(cli->outbuf,smb_vwv5,(mode & 0x0008) ? 0xFFFFFFFF : 0); + SIVAL(cli->outbuf,smb_vwv5,0); SSVAL(cli->outbuf,smb_vwv7,mode); + /* + * THe following is still wrong ... + */ SSVAL(cli->outbuf,smb_vwv8,(mode & 0x0008) ? size : 0); SSVAL(cli->outbuf,smb_vwv9,((size>>16)&1)); SSVAL(cli->outbuf,smb_vwv10,size); SSVAL(cli->outbuf,smb_vwv11, smb_buf(cli->outbuf) - smb_base(cli->outbuf)); + + if (bigoffset) + SIVAL(cli->outbuf,smb_vwv12,(offset>>32) & 0xffffffff); p = smb_base(cli->outbuf) + SVAL(cli->outbuf,smb_vwv11); memcpy(p, buf, size); -- cgit