[Samba] Re: smbclient and large file support

Richard Sharpe rsharpe at richardsharpe.com
Mon Dec 30 04:08:19 GMT 2002


On Sun, 29 Dec 2002, Adnan Olia wrote:

> Hi Herb,
> 
> I made the changes with this patch on Samba 2.2.7a and then re-compiled it
> with
> ./configure --with-libsmbclient
> 
> After the new samba install, I tried to "get" a file from Win2000 Advanced
> Server to Mandrake Linux 8.2 server using SMBCLIENT and was successfully
> able to transfer a 6.63GB file.  Then I tried to "put" a file from Mandrake
> Linux 8.2 server to the Win2000 Advanced Server and the file completed at
> 4GB rather than 6.63 GB.  Is this normal?

The following might be a fix to your problem :-)

diff -u -r1.2.4.9 clireadwrite.c
--- libsmb/clireadwrite.c	19 Dec 2002 16:12:41 -0000	1.2.4.9
+++ libsmb/clireadwrite.c	30 Dec 2002 04:04:37 -0000
@@ -231,6 +231,7 @@
 			    size_t size, int i)
 {
 	char *p;
+	BOOL bigoffset = False;
 
 	if (size > cli->bufsize) {
 		cli->outbuf = realloc(cli->outbuf, size + 1024);
@@ -243,7 +244,10 @@
 	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);
@@ -256,14 +260,20 @@
 	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);

Regards
-----
Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org, 
sharpe[at]ethereal.com, http://www.richardsharpe.com




More information about the samba mailing list