[jcifs] Even-byte-alignment padding in Write AndX Request

David D. Kilzer ddkilzer at kilzer.net
Thu Jul 15 16:57:00 GMT 2004


Hi,

I'm looking for help debugging an issue with named pipes and JCIFS-0.9.5.
I believe I need to pad the data section of an SMB Write AndX Request
packet by 1 byte, but I'm not sure how to make JCIFS go about doing
this (or if it would even help).  Any thoughts or suggestions would be
appreciated.  More details below.

So I went insane yesterday and tried to incorporate JCIFS into the jTDS
JDBC driver so that jTDS could talk to SQL Server 6.5 servers that use
named pipe IPC.  You may read about it here:

[ 991684 ] Implement named pipe IPC for SQL Server 6.5
http://sourceforge.net/tracker/index.php?func=detail&aid=991684&group_id=33291&atid=407765

I have hacked up jTDS so that it emits a TDS 4.2 logon packet (which is
the data after the Write AndX Request) that is identical to what the SQL
Enterprise Manager tool sends.  Unfortunately, there are still a few
minor differences between the two packets:

  - The SQL Enterprise Manager packet has the TDS 4.2 logon packet
    even-byte-aligned by including a padding byte of 0xEE between the
    Write AndX Request and the data (TDS 4.2 logon packet).

  - Fields that differ in the SMB Header:

    Fields        SQL-E-M   JCIFS
    ------------- --------  --------
    Flags2:       0xc807    0xc003
    Tree ID:      6150      2055
    Process ID:   65279     50097
    User ID:      6150      2050
    Multiplex ID: 57601     4

  - Fields that differ in the Write AndX Request:

    Fields        SQL-E-M   JCIFS
    ------------- --------  --------
    Reserved:     FFFFFFFF  00000000
    Write Mode:   0x0008    0x0000
    Remaining:    512       0
    Data Offset:  64        63
    Byte Count:   513       512
    Padding:      EE        (n/a)

Any help would be appreciated.  I'd really like to pad the Write AndX
Request with a single 0xEE byte, and if there is an easy way to do this,
I'd appreciate the info.

Please forgive my use of incorrect terminology above.  Most of the SMB
packet format I learned yesterday by looking at what Ethereal 0.10.5a
tells me, plus a few random Google searches.

Thanks for any help you may provide!

Dave



More information about the jcifs mailing list