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: "Fernando" <nulll AT bol.com.br>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: TDS 7.0 login packet is correct ?
  • Date: Sat, 30 Mar 2002 14:45:30 -0500


Hello,

I understand the value of packet size in header, thank you. I do this
alteration and now after I send the pcaket to SQLServer don't get a error
in EventLog, but I receive the following packet and my connect is closed.
Why?

0401006200000000AA4E0018480000010E21004C006F00670069006E0020006600610069006C0065006400200066006F00720020007500730065007200200027006600650072006E0061006E0064006F0027002E0000000000FD0200000000000000


I see this packet type in freeTDS documentation, but i don't know it mean.
Can you explain for me ? (Excuse me by bother)


Regards!!


> This code is correct but doesn't show the 8 byte netlib header that is
> sent by tds_write_packet() in write.c
>
> That is the value that is off.
>
> On Sat, 30 Mar 2002, Fernando wrote:
>
> > Hello,
> >
> > Brian, I see the following conde in file login.c :
> >
> > //.....
> > packet_size = size1 + 48;
> > tds_put_smallint(tds,packet_size); //total packet size
> > tds_put_n(tds,NULL,5);
> > if (IS_TDS80(tds)) {
> > tds_put_byte(tds,0x80);
> > } else {
> > tds_put_byte(tds,0x70);
> > }
> > tds_put_n(tds,NULL,7);
> > //.....
> >
> > In this code, the big value(plus48) is putting in payload section. I'm
> > again confused. Which way is correct ?
> >
> > Can I send this packet after of the socket connection is open or i have
> > send a other packet before ? Why the QueryAnalyser after of the connection
> > with port 1433 it send a packet 0x12 ?
> >
> > Regards!!
> >
> >
> > > Your netlib header size is still wrong, it should be 00D8.
> > >
> > > On Fri, 29 Mar 2002, Fernando wrote:
> > >
> > > > Hello,
> > > >
> > > > I do the alterations referent "byte order", still has anything
> > > > wrong in
> > > > down pakcket ? When I send this packet to MSSQLServer I get a error :
> > > > ----------
> > > > Error: 17832, Severity: 18, State: 6
> > > > 2002-03-30 00:26:35.40 ods Connection opened but invalid login
> > > > packet(s) sent. Connection closed..
> > > > ----------
> > > >
> > > > Can I send this packet after of the socket connection is open or i
> > > > have
> > > > send a other packet before ?
> > > >
> > > > //TDS70LoginPacket
> > > > 100100A800000100D800000000000070000000000000000682F2F8FF00000000E003000088FFFFFF3604000056000000560008006600060072000800820009000000000094000A00A8000000A80000000040339A6B50A8003000D80000006600650072006E0061006E0064006F006100620063003100320033005400440053005400720061006300650053006100740065006C006C00690074006500440042002D004C006900620072006100720079004E544C4D5353500001000000068200000000000000000000000000000000000000000000300000000000000030000000
> > > > //Header
> > > > 10 --Packet type
> > > > 01 --Last packet indicator
> > > > 00A8 --Partial Packet size (Big endian)
> > > > 00000100 --unknow (00000100 or 00000000) ???
> > > > //Payload
> > > > D800 --Total Packet size (Little endian)
> > > > 0000000000 --unknow
> > > > 70 --Version number
> > > > 00000000000000 --unknow
> > > > 0682F2F8FF00000000E003000088FFFFFF36040000 --magic1
> > > > 5600 --Position of hostname (Little endian)
> > > > 0000 --Length of hostname (Little endian)
> > > > 5600 --Position of username (Little endian)
> > > > 0800 --Length of username (Little endian)
> > > > 6600 --Position of password (Little endian)
> > > > 0600 --Length of password (Little endian)
> > > > 7200 --Position of appname (Little endian)
> > > > 0800 --Length of appname (Little endian)
> > > > 8200 --Position of servername (Little endian)
> > > > 0900 --Length of servername (Little endian)
> > > > 0000 --Position of unknow (Little endian)
> > > > 0000 --Length of unknow (Little endian)
> > > > 9400 --Position of libname (Little endian)
> > > > 0A00 --Length of libame (Little endian)
> > > > A800 --Position of language (Little endian)
> > > > 0000 --Length of language (Little endian)
> > > > A800 --Position of dbname (Little endian)
> > > > 0000 --Length of dbame (Little endian)
> > > > 0040339A6B50 --magic2
> > > > A800 --Partial packet size (Little endian)
> > > > 3000 --unknow (Little endian)
> > > > D800 --Total packet size (Little endian)
> > > > 0000 --unknow
> > > > 6600650072006E0061006E0064006F00 --username (fernando)
> > > > 610062006300310032003300 --password (abc123)
> > > > 54004400530054007200610063006500 --appname (TDSTrace)
> > > > 53006100740065006C006C00690074006500 --servername (Satellite)
> > > > 440042002D004C00690062007200610072007900 --libname (DB-Library)
> > > > 4E544C4D535350 --"NTLMSSSP"
> > > > 00 --unknow
> > > > 01 --unknow
> > > > 000000 --unknow
> > > > 06 --unknow
> > > > 82 --unknow
> > > > 00000000000000000000000000000000000000000000 --unknow
> > > > 30 --unknow
> > > > 00000000000000 --unknow
> > > > 30 --unknow
> > > > 000000 --unknow
> > > >
> > > >
> > > >
> > > > Regards!!
> > > >
> > > >
> > > > > 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')
> > > > > >
> > > >
> > > > ---
> > > > 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