[jcifs] SOLVED Problem connecting to NetWare

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Thu May 23 15:02:04 EST 2002


The CIFS spec says you're supposed to have a Pad[] before Data[DataLength] to word
align the payload. I did this and it is technically correct. But nobody does this and I
didn't know why till now. They just make DataOffset point to the byte right after
ByteCount. In the SMB_COM_WRITE_ANDX packets that were adding the mystery
byte this location was 59 (from the beginning of the SMB header) and therefore jCIFS
put in a 1 byte Pad[] and made DataOffset 60. But Netware is obviously calculating the
length of the payload by subtracting the packet length from the DataOffset. It's probably
faster for their architecture or something. Typical example CIFS BS.

Mike

4.2.5  WRITE_ANDX: Write Bytes to file or resource

 Client Request          Description
 ======================  ====================================

 UCHAR WordCount;        Count of parameter words = 12 or 14
 UCHAR AndXCommand;      Secondary (X) command;  0xFF = none
 UCHAR AndXReserved;     Reserved (must be 0)
 USHORT AndXOffset;      Offset to next command WordCount
 USHORT Fid;             File handle
 ULONG Offset;           Offset in file to begin write
 ULONG Reserved;         Must be 0
 USHORT WriteMode;       Write mode bits:
                          0 - write through
 USHORT Remaining;       Bytes remaining to satisfy request
 USHORT Reserved;
 USHORT DataLength;      Number of data bytes in buffer (>=0)
 USHORT DataOffset;      Offset to data bytes
 ULONG OffsetHigh;       Upper 32 bits of offset (only
                         present if WordCount = 14)
 USHORT ByteCount;       Count of data bytes
 UCHAR Pad[];            Pad to SHORT or LONG <- Netware doesn't
                                                 like this :~(
 UCHAR Data[DataLength]; Data to write

> -----Original Message-----
> From:	Tony Thompson [SMTP:tony.thompson at stone-ware.com]
> Sent:	Thursday, May 23, 2002 12:39 AM
> To:	miallen at eskimo.com
> Cc:	jcifs at samba.org
> Subject:	Re: [jcifs] Problem connecting to NetWare
> 
> I tried both FileOps and NetWareWrite and they both worked great!
> 
> Without getting too terribly deep into it, can you give me an idea what the issue was?
> 
> Thanks again,
> Tony
> 
> >>> "Michael B. Allen" <miallen at eskimo.com> 05/22/02 02:43PM >>>
> On Mon, 20 May 2002 08:45:37 -0500
> "Tony Thompson" <tony.thompson at stone-ware.com> wrote:
> 
> > The attached zip file contains the log and the two data files.
> 
> I believe I have fixed the problem Tony. Can you please try FileOps.java
> example again with this jar?
> 
>   http://www.eskimo.com/~miallen/jcifs/jcifs-0.6.4nopad.jar 
> 
> Thanks,
> Mike
> 
> > > On Sun, 19 May 2002 11:06:44 -0500
> > > "Tony Thompson" <tony.thompson at stone-ware.com> wrote:
> > > 
> > > > I zipped the file.  It should be attached.  I did not pull it through the SMB server.
> > > 
> > > 0000140   t       o   n       U   N   I   X   ,       s   m   b   f   s
> > > 0000150       o   n       L   i   n   u   x   ,       a   n   d       e
> > > 0000160   l   s   e   w   h   e   r   e   .  \r  \n   ` <--- 0x60 Backtick
> > > 
> > > Mmmm. There's a 0x60 reverse quote chacter appended. That's very odd. And
> > > not good. I don't know spit about Netware. It could be a bug in Netware
> > > that's only been exposed with jCIFS. Can you do me a big favor and run
> > > this program and send me the data.0 and data.1 files it writes. Just
> > > run it like:
> > > 
> > > java -Dlog=ALL NetWareWrite smb://admin:testing@192.168.0.1/Share1/ 
> > > 
> > > That will create data.0 and data.1 in that directory. Please send the
> > > log too.
> > > 
> > > The data.1 file is actually one byte shorter. 362 is evenly divisable
> > > by 2. Maybe Netware likes things word aligned.
> > > 
> > > Mike
> 
> -- 
> May The Source be with you.
> 
> 
> 





More information about the jcifs mailing list