Bug 81605 - smbclient fails to put >4GB file
Summary: smbclient fails to put >4GB file
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: samba
Version: 7.2
Hardware: athlon
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jay Fenlason
QA Contact: David Lawrence
URL: http://groups.google.com/groups?hl=en...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-01-10 23:58 UTC by David Yerger
Modified: 2014-08-31 23:24 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-05-17 19:31:45 UTC


Attachments (Terms of Use)

Description David Yerger 2003-01-10 23:58:27 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2.1) Gecko/20021130

Description of problem:
After I experienced this problem, found the following in the 
URL I have included (I did not try patch myself):

> 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

Version-Release number of selected component (if applicable):


How reproducible:
Didn't try

Steps to Reproduce:
1.connect to W2K Pro with smbclient 
2.put file >4GB

    

Actual Results:  Only 4GB gets written.

Expected Results:  Whole file gets written :-)

Additional info:

This was supposed to have been merged in samba 3.0 CVS?  But 
maybe the patch will work against 2.2.1a?

Comment 1 David Yerger 2003-01-11 21:14:14 UTC
Tried patch against 2.2.1a SRPM, did *not* work - now fails at 2GB instead of 4GB -

I am assured by our network admin that W2KSP3 has an 8GB filesize limit for
FAT32, not 4GB.  He is going to test.

Comment 2 David Yerger 2003-01-13 21:38:22 UTC
Tested with unpatched smbclient against a share on the (NT 4.0) server using
NTFS, also failed (this time simply locked up), so it's not the other end.

Comment 3 David Yerger 2003-01-14 11:38:40 UTC
Tested smbclient from samba 2_2 CVS, it includes this patch and *does* work.

*Yay*

So the patch seems only to work against later versions of samba than 2.2.1a.

I maybe could put together an RPM and attach it if you like. . . 

Comment 4 David Yerger 2003-01-24 22:33:53 UTC
I used

./configure \
	--prefix=/usr \
	--sysconfdir=/etc \
        --with-fhs \
        --with-privatedir=/usr/bin \
        --with-lockdir=/var/cache/samba \
        --with-swatdir=/usr/share/swat \
        --with-codepagedir=/usr/share/samba/codepages \
        --with-automount \
        --with-smbmount \
        --with-pam \
        --with-pam_smbpass \
        --with-mmap \
        --with-quotas \
        --without-smbwrapper

(mostly stolen from the official SRPM's .spec file) to compile.

It calls itself 2.2.7pre1
.

HTH

Comment 5 David Yerger 2003-06-30 01:18:31 UTC
Still broke with smbclient from the samba-client package, version 2.2.7, 
release 3.7.2, April 6 2003 (bugfix from rhn overwrote my copy <groan>)


Note You need to log in before you can comment on or make changes to this bug.