|
Re: LARGE_READX / LARGE_WRITEX support: msg#00050network.samba.java
I am going to place this patch in a patches directory. I have removed the Encdec change however. I believe the correct fix for that issue is the following in doRecv: int size = Encdec.dec_uint16be( BUF, 2 ) & 0xFFFF; It's correct for dec_uint16be to return a short. We just need to ensure that the value bahaves as if it were unsigned which is a simple matter of masking out the lower 16 bits. Mike On Wed, 19 Oct 2005 17:03:34 +0200 Thomas Krammer <Thomas_Krammer@xxxxxxxx> wrote: > Hi, > > the attached patch adds LARGE_READX / LARGE_WRITEX support to jCIFS > 1.2.6. It also fixes some problems I found along the way. > > 1) Debug output in Transport.java > > The patch removes some debug output that is printed to stdout. > > 2) Integer overflow in SmbTransport.java > > If you execute the following code: > > SmbFile serverFile = .... > SmbRandomAccessFile ra = new SmbRandomAccessFile(serverFile, "rw"); > > int BUFFER_SIZE = Short.MAX_VALUE; > > byte[] buffer = new byte[BUFFER_SIZE]; > > ra.read(buffer); > > you will get the following exception: > > jcifs.util.transport.TransportException: Transport1 timedout waiting for > response to > SmbComReadAndX[command=SMB_COM_READ_ANDX,received=false,errorCode=0,flags=0x0018,flags2=0xC003,signSeq=0,tid=2048,pid=10207,uid=2048,mid=475,wordCount=12,byteCount=0,andxCommand=0xFF,andxOffset=0,fid=16384,offset=0,maxCount=32767,minCount=32767,openTimeout=-1,remaining=0,offset=0] > at jcifs.util.transport.Transport.sendrecv(Transport.java:74) > at jcifs.smb.SmbTransport.send(SmbTransport.java:580) > at jcifs.smb.SmbSession.send(SmbSession.java:229) > at jcifs.smb.SmbTree.send(SmbTree.java:102) > at jcifs.smb.SmbFile.send(SmbFile.java:688) > at jcifs.smb.SmbRandomAccessFile.read(SmbRandomAccessFile.java:86) > at jcifs.smb.SmbRandomAccessFile.read(SmbRandomAccessFile.java:69) > > The reason for this error is an integer overflow in > SmbTransport.doRecv() line 422. If the specified buffer size is greater > than Short.MAX_VALUE - SMB_HEADER_LENGTH the package size gets negative > and the package is rejected. That's because Encdec.dec_uint16be returns > a short instead of an int. > > Please note that there are more similar errors in Encdec (for example > dec_uint32be returns an int instead of a long). I didn't fix those > additional errors. > > 3) LARGE_READX and LARGE_WRITEX support > > The patch adds LARGE_READX and LARGE_WRITEX support for > SmbFileInputStream, SmbFileOutputStream and SmbRandomAccessFile. This > significantly increases the performance when transferring files from and > to Windows servers. > > For example transferring a 183 MB file (using streams): > > modified 1.2.6 original 1.2.6 > Download 23 sec 39 sec > Upload 26 sec 40 sec > > Client: Windows XP SP 2, Java 1.4.2_08 > Server: Windows XP SP 2 > > The test used a 128k buffer to transfer the data from the InputStream to > the OutputStream. > > > Bye, > > Thomas > > |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Problem with jcifs.UniAddress.isValidDnsName(String): 00050, Michael B Allen |
|---|---|
| Next by Date: | Re: Struts forwards and jCIFS NTLM: 00050, Michael B Allen |
| Previous by Thread: | Re: Problem with jcifs.UniAddress.isValidDnsName(String)i: 00050, Michael B Allen |
| Next by Thread: | jcifs-1.2.7 released / Transport Error, Filter Changes, Integer Overflow, User Contributed Patches, and More: 00050, Michael B Allen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |