Skip to Content.
Sympa Menu

freetds - RE: Is TDS in unicode?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Sharad Bansal" <sharad AT ITAngel.com>
  • To: "'TDS Development Group'" <freetds AT franklin.oit.unc.edu>
  • Subject: RE: Is TDS in unicode?
  • Date: Tue, 13 Aug 2002 18:08:39 -0400


STATUS: Received Packet #0 from Client 172
Element [0] : 10
Element [1] : 1
Element [2] : 0

This is the packet in hex followed by ffffffcc
Thanks,

Sharad

-----Original Message-----
From: bounce-freetds-145183 AT franklin.oit.unc.edu
[mailto:bounce-freetds-145183 AT franklin.oit.unc.edu] On Behalf Of Brian
Bruns
Sent: Tuesday, August 13, 2002 6:00 PM
To: TDS Development Group
Subject: [freetds] RE: Is TDS in unicode?



On Tue, 13 Aug 2002, Sharad Bansal wrote:

> Hi,
> Thanks for the help so far.
> 1. I wrote a simple server that listens on port 1433 and prints out
the
> packets that come in. [C function below]
> 2. I started MS SQL Query Analyzer to connect to this server. The
Query
> Analyser is supposed to send TDS packets to port 1433 by default. My
> server picked them up.
> 3. TCP SYN/ACK packets. I'm very new to this but it could be the case.
> But, then should'nt I see this happen in freetds code as well?

Ok, didn't know if you were looking at this in a protocol analyzer or
what. You can't simply call unicode2ascii on the whole buffer but only
specific string fields within it. Can you remove the call to
unicode2ascii() and repost the output?

Brian

>
> Thanks!
>
> - Sharad
>
>
> int
> TCPechod(SOCKET fd)
> {
> char buf[BUFSIZE];
> char temp[BUFSIZE];
> int cc;
> cc = recv(fd, buf, sizeof buf, 0);
> int count = 0;
> while (cc != SOCKET_ERROR && cc > 0) {
> unicode2ascii(buf,temp,cc);
> strcpy(temp,buf);
> temp[cc] = '\0';
> printf ("\nSTATUS: Received Packet #%d
> from Client %d\n",count,cc);
> for (int ct =0; ct < cc; ct++)
> printf ("Element [%d] : %c
> \n",ct,temp[ct]);
> cc = recv(fd, buf, sizeof buf, 0);
> printf ("\n");
> ++count;
> }
> if (cc == SOCKET_ERROR)
> fprintf(stderr, "echo recv error: %d\n",
> GetLastError());
> closesocket(fd);
> return 0;
> }
>
> -----Original Message-----
> From: bounce-freetds-145183 AT franklin.oit.unc.edu
> [mailto:bounce-freetds-145183 AT franklin.oit.unc.edu] On Behalf Of Brian
> Bruns
> Sent: Tuesday, August 13, 2002 4:22 PM
> To: TDS Development Group
> Subject: [freetds] RE: Is TDS in unicode?
>
>
> On Tue, 13 Aug 2002, Sharad Bansal wrote:
>
> > Hi,
> > I looked at the spec.
> > 1. It's my understanding that all packets do come in unicode.
> > 2. I'm trying to understand the packets coming from a SQL analyzer
> > client to my server that is listening on port 1433 [default port]
> > 3. I see that it sends 52 identical bytes each time you try to do a
> > login.
>
> The login would typically be over 100 bytes (depending on the length
of
> certain fields such as username, password, etc...). Could this be the

> standard TCP SYN/ACK setup packets?
>
> > 4. I looked at the freetds code to figure out what the bytes
contain.
> As
> > per my understanding, these should be the "login record". Is this
> right?
> > What's the first packet that freetds sends to SQL server
> > [PreLoginHandshake?] ?
>
> There is no payload sent prior to the login. I'm not sure what you
have
>
> there but it's not a TDS packet that I know of. Want to explain
exactly
>
> how you got this?
>
> > 5. Since the bytes did not make sense to me, I applied the function
> > unicodetoascii to try to read the packets [see below].
>
> >
> >
> > Question: I think I'm making a basic mistake in figuring out the
> > packets. Any help will be appreciated.
> >
> > - Sharad
> >
> >
> > STATUS: Received Packet #0
> > Element [0] : 12
> > Element [1] : 1
> > Element [2] : 0
> > Element [3] : 0
> > Element [4] : 0
> > Element [5] : 15
> > Element [6] : 6
> > Element [7] : 0
> > Element [8] : 0
> > Element [9] : 2
> > Element [10] : 1c
> > Element [11] : c
> > Element [12] : 0
> > Element [13] : 0
> > Element [14] : ffffffff
> > Element [15] : 0
> > Element [16] : 10
> > Element [17] : 0
> > Element [18] : 4d
> > Element [19] : 53
> > Element [20] : 4c
> > Element [21] : 65
> > Element [22] : 76
> > Element [23] : 72
> > Element [24] : 34
> > Element [25] : 0
> > Element [26 - 51] : ffffffcc
> > -----Original Message-----
> > From: bounce-freetds-145183 AT franklin.oit.unc.edu
> > [mailto:bounce-freetds-145183 AT franklin.oit.unc.edu] On Behalf Of
Brian
> > Bruns
> > Sent: Friday, August 09, 2002 7:42 AM
> > To: TDS Development Group
> > Subject: [freetds] RE: Is TDS in unicode?
> >
> >
> > You might want to look at the explanation in the User Guide and come
> > back
> > with questions from there.
> >
> > http://www.freetds.org/userguide/x833.htm
> >
> > Cheers,
> >
> > Brian
> >
> > On Fri, 9 Aug 2002, Sharad Bansal wrote:
> >
> > > How do you read UCS2? Does the unicode2ascii in login.c do just
> that?
> > >
> > > Do you the know the message type of the initial message that a
> client
> > > would send to the SQL server ?
> > >
> > > Thanks.
> > > Sharad
> > >
> > > -----Original Message-----
> > > From: bounce-freetds-145183 AT franklin.oit.unc.edu
> > > [mailto:bounce-freetds-145183 AT franklin.oit.unc.edu] On Behalf Of
> > ZIGLIO
> > > Frediano
> > > Sent: Friday, August 09, 2002 6:21 AM
> > > To: TDS Development Group
> > > Subject: [freetds] RE: Is TDS in unicode?
> > >
> > >
> > > >
> > > >Hi,
> > > >I'm very new to all of this. I was studying the first packets
sent
> by
> > > MS
> > > SQl >analyzer to the SQL server and reading the freetds code
[tds.h,
> > > login.c] to >figure it out. Is all the the traffic in Unicode ?
The
> > > initial
> > > packets
> > > >should be a message of what type?
> > >
> > > TDS 7 and TDS 8 (MS versions) are wire-coded in UCS2.
> > > I don't know Sybase (it should support Unicode with UTF8 coding)
> > >
> > > freddy77
> > >
> > > =================================
> > > "STRICTLY PERSONAL AND CONFIDENTIAL
> > >
> > > This message may contain confidential and proprietary material for
> the
> > > sole
> > > use of the intended recipient. Any review or distribution by
others
> is
> > > strictly prohibited. If you are not the intended recipient please
> > > contact
> > > the sender and delete all copies.
> > > The contents of this message that do not relate to the official
> > business
> > > of
> > > our company shall be understood as neither given nor endorsed by
> it."
> > >
> > > =================================
> > >
> > > ---
> > > You are currently subscribed to freetds as: [sharad AT ITAngel.com]
> > > 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: [sharad AT ITAngel.com]
> > 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: [sharad AT ITAngel.com]
> 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: [sharad AT ITAngel.com]
To unsubscribe, forward this message to
$subst('Email.Unsub')





Archive powered by MHonArc 2.6.24.

Top of Page