Skip to Content.
Sympa Menu

freetds - Re: TDS 7.0 login packet is correct ?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: TDS Development Group <freetds AT franklin.metalab.unc.edu>
  • Subject: Re: TDS 7.0 login packet is correct ?
  • Date: Fri, 29 Mar 2002 21:31:05 -0500 (EST)


On Fri, 29 Mar 2002, Fernando wrote:

> Hello,
>
> Denove: Thank you very mutch by attetion Brian Bruns.
>
> Why the packet size 00A8 is incorrect ?

A8 refers to the portion of the packet up to the end of the variable
fields. The size of the whole packet is that plus 48 (0x30) bytes or D8
in your specific example. So D8 is actually specified in the payload but
not in the netlib header. The size field in the netlib header is in
"network byte order" or bigendian for historical reasons, but values in
the the payload will be little endian for TDS 7/8 and negotiated for TDS
4/5.

> The integer fields are in big endian. In TDS70 packet I have tha
> represent the decimal 86 such as 5600 and not 0056, by sample ? I can say
> how is it?

correct, in your payload size field you have 00d8 which is d800 little
endian.

> Could you answer the following box ?
>
> ---------------------------------------------------
> Tipo | Decimal | Big endian | Little endian |
> ---------------------------------------------------
> int8 | 5 | 0x05 | 0x05 |
> ---------------------------------------------------
> int8 | 20 | 0x14 | 0x14 |
> ---------------------------------------------------
> int16 | 210 | 0x00D2 | 0xD200 |
> ---------------------------------------------------
> int32 | 320 | 0x00000140 | 0x40010000 |
> ---------------------------------------------------
>
> Regards!!
>
>
> > Sorry, I only had a brief couple of minutes to look at the packet....your
> > netlib packet size is 00A8 which is not correct. And many of the integer
> > fields appear to be big endian, TDS 7 is a little endian only protocol.
> >
> > Brian
> >
> > On Fri, 29 Mar 2002, Fernando wrote:
> >
> > > Hello,
> > >
> > >
> > > Then which wrong points in login packet ?
> > >
> > > "fernando" = 6600650072006E0061006E0064006F00 or 6665726E616E646F ???
> > >
> > > Could you see my old message in this news (Subject:Any question about
> > > TDS)
> > > ??
> > >
> > >
> > >
> > > Regards!!
> > >
> > >
> > > > oops, my bad on the strings, yes you are correct. The other things
> > > > are
> > > > still problematic though.
> > > >
> > > > Brian
> > > >
> > > > On Fri, 29 Mar 2002, Fernando wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > >
> > > > > Tank you very mutch by attetion Brian Bruns. In your analyse
> > > > > you did
> > > > > question the following points:
> > > > >
> > > > > > 00D8 packet size bigger than the netlib header, and apparently in
> > > > > > the
> > > > > > wrong byte order
> > > > > > 0066 pos password, 0x56 + 0x08 != 0x66
> > > > > > 0082 pos servername, 0x72 + 0x08 != 82
> > > > > > 0094 pos libname, 0x82 + 9 != 0x94
> > > > > > 00A8 pos lang, 0x94 + A != A8
> > > > > > 00A8 size of (8 + 6 + 8 + 9 + 10 = 41 + 86 (fixed portion) = 127
> > > > > > = 0x7F)
> > > > > > so your variable data ends at 0x7F (i think) but your numbers are
> > > > > > off all
> > > > > > the way through.
> > > > >
> > > > >
> > > > > I see this code in freetds java source:
> > > > >
> > > > > //....
> > > > > short len = (short)(86 + 2 * (user.length() +
> > > > > password.length() +
> > > > > appName.length() +
> > > > > serverName.length() +
> > > > > libName.length()));
> > > > > //....
> > > > > comm.appendTdsShort((short)user.length()); <-- 1x
> > > > > curPos += user.length() * 2; <-- 2x
> > > > > //....
> > > > >
> > > > > Then, i puting the double of strings length (mybe Unicode):
> > > > >
> > > > > 0x56 + 0x08 != 0x66 -- but, 0x56 + 2*(0x08) = 0x66
> > > > > 0x72 + 0x08 != 82 -- but, 0x72 + 2*(0x08) = 0x82
> > > > > 0x82 + 9 != 0x94 -- but, 0x82 + 2*(0x09) = 0x94
> > > > > 0x94 + A != A8 -- but, 0x94 + 2*(0x0A) = 0xA8
> > > > > 00A8 size of (8 + 6 + 8 + 9 + 10 = 41 + 86 (fixed portion) = 127
> > > > > = 0x7F)
> > > > > but, 2*((8 + 6 + 8 + 9 + 10) = 82 + 86 (fixed portion) = 168
> > > > > = 0xA8)
> > > > >
> > > > > I'm confused. Wich way is correct ?
> > > > >
> > > > >
> > > > > "fernando" = 6600650072006E0061006E0064006F00 or 6665726E616E646F
> > > > > ???
> > > > >
> > > > >
> > > > > Could you see my message(Any question about TDS) ??
> > > > >
> > > > >
> > > > > Regards !!
> > > > >
> > > > >
> > > > > > On Fri, 29 Mar 2002, Fernando wrote:
> > > > > >
> > > > > > > Hello All,
> > > > > > >
> > > > > > > Anybody know say me if the TD7.0 login packet following is
> > > > > > > valid ?
> > > > > > >
> > > > > > >
> > > > > > > UserName = 'fernando'
> > > > > > > Pwd = 'abc123'
> > > > > > > ServerName = 'Satellite'
> > > > > > > AppName = 'TDSTrace'
> > > > > > > LibraryName = 'DB-Library'
> > > > > > >
> > > > > > >
> > > > > > /* netlib header */
> > > > > > 10 0x10 TDS 7 login packet identifier
> > > > > > 01 Last packet indicator ( true )
> > > > > > 00A8 packet size (168 octets)
> > > > > > 00001000 unknown
> > > > > > /* TDS payload */
> > > > > > 00D8 packet size bigger than the netlib header, and apparently in
> > > > > > the
> > > > > > wrong byte order
> > > > > > 0000000000
> > > > > > five 0x00's, ok
> > > > > > 70 version number, ok
> > > > > > 00000000000000
> > > > > > seven 0x00's, ok
> > > > > > 0682F2F8FF00000000E003000088FFFFFF36040000
> > > > > > magic, agrees with mine, ok
> > > > > > 0056 position of hostname, ok
> > > > > > 0000 length of hostname, ok
> > > > > > 0056 pos of username, ok
> > > > > > 0008 len of username, ok
> > > > > > 0066 pos password, 0x56 + 0x08 != 0x66
> > > > > > 0006 len password, ok
> > > > > > 0072 pos appname, ok
> > > > > > 0008 len appname, ok
> > > > > > 0082 pos servername, 0x72 + 0x08 != 82
> > > > > > 0009 len servername, ok
> > > > > > 0000 pos unknown
> > > > > > 0000 len unknown
> > > > > > 0094 pos libname, 0x82 + 9 != 0x94
> > > > > > 000A len libname, ok
> > > > > > 00A8 pos lang, 0x94 + A != A8
> > > > > > 0000 len lang, ok
> > > > > > 00A8 pos dbname, ok
> > > > > > 0000 len dbname, ok
> > > > > > 0040339A6B50
> > > > > > magic2, ok
> > > > > > 00A8 size of (8 + 6 + 8 + 9 + 10 = 41 + 86 (fixed portion) = 127
> > > > > > = 0x7F)
> > > > > > so your variable data ends at 0x7F (i think) but your numbers are
> > > > > > off all
> > > > > > the way through.
> > > > > >
> > > > > > 003000D800006600650072006E0061006E0064006F00610062006300310032003300540044005300540072006100630065006C006F00630061006C0068006F0073007400440042002D004C006900620072006100720079004E544C4D5353500001000000068200000000000000000000000000000000000000000000300000000000000030000000
> > > > > > >
> > > > > > > Regards!
> > > > > > >
> > > > >
> > > > > ---
> > > > > You are currently subscribed to freetds as: [camber AT ais.org]
> > > > > To unsubscribe, forward this message to $subst('Email.Unsub')
> > > > >
> > >
> > > ---
> > > You are currently subscribed to freetds as: [camber AT ais.org]
> > > To unsubscribe, forward this message to $subst('Email.Unsub')
> > >
>
> ---
> You are currently subscribed to freetds as: [camber AT ais.org]
> To unsubscribe, forward this message to $subst('Email.Unsub')
>





Archive powered by MHonArc 2.6.24.

Top of Page