Skip to Content.
Sympa Menu

freetds - RE: [freetds] RPC/Packet Type 3 Format

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: <lists-tds AT mymailfilter.net>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] RPC/Packet Type 3 Format
  • Date: Thu, 17 Jul 2003 16:32:27 -0500 (CDT)

See below.

On Thu, 17 Jul 2003, Lowden, James K wrote:

> Excellent, Jeff. I can tell you for certain that several people here will
> be interested to learn what you discover. I'm quite sure what you're
> looking at is unknown to us. Is this SQL Server 7 or 2000?

SQL Server 2000, although I've run into the same thing (or very similar)
using 7.0. I suppose it could also be that ADO or the underlying db-lib
is responsible for differences in the query packets sent to the server.

> Our Chief Reverse Engineer Emeritus, Brian Bruns (hmm, I wonder how he'll
> like that title?) wrote a TDS filter for Ethereal, but I expect that won't
> decode your packet, either. If we're fortunate, he might have some
> insight/strategy to offer. If we're extremely fortunate, someone with a
> friend at Microsoft might have something to offer. But that kind of direct
> help doesn't arrive often.

The hex data I provided was captured using Ethereal, and the TDS filter
says:

Tabular Data Stream
Type: Unknown (0x03)

> That file is maintained in CVS and can be found in the doc directory of the
> source distribution. (On my TODO is to update the website and move its
> documents into CVS, too.) We have a complete TDS 7.0 login packet now, but
> nothing more on type 3 packets.

Thanks, I did find the updated documentation vis CVS this morning and I
noticed the TODO related to RPC, but nothing more...

> I can point you to our source code, if that helps. See src/tds/query.c and
> src/tds/write.c. tds_write_packet() constructs the header (starting with
> 0x03). query.c has our prepared statement functionality.

Thank you. I did have a look at the code earlier, but I didn't get to the
write.c file, and that sounds like it's the one that will help.

> If I could offer a baby-simple strategy, how about this?
>
> create procedure foo @bar char(1) = 'B' output
> as select @bar='A'
> return 0
>
> Then try these three calls:
>
> execute foo
> execute foo @a
> execute foo @a output
>
> Maybe the differences in the mystery bytes will shed light on their purpose.
> I at least would be interested in what turns up.

Good idea. I haven't examined these yet, but here they are (let me know
if anything jumps out):

execute foo
-----------
0000 00 08 7c c2 42 c2 00 03 47 8b 23 05 08 00 45 00 ..|.B...G.#...E.
0010 00 82 3b 8c 40 00 80 06 69 3d 0a 00 2c 4c 0a 00 ..;.@...i=..,L..
0020 15 61 04 e7 05 99 f8 4d a0 17 a1 35 e3 31 50 18 .a.....M...5.1P.
0030 f7 46 67 4f 00 00 03 01 00 5a 00 00 01 00 ff ff .FgO.....Z......
0040 0b 00 00 00 00 01 26 04 04 ff ff ff ff 00 00 63 ......&........c
0050 00 00 00 00 09 04 00 01 32 ff ff ff ff 00 00 63 ........2......c
0060 1a 00 00 00 09 04 00 01 32 1a 00 00 00 65 00 78 ........2....e.x
0070 00 65 00 63 00 75 00 74 00 65 00 20 00 66 00 6f .e.c.u.t.e. .f.o
0080 00 6f 00 0d 00 0a 00 00 00 26 04 04 01 00 00 00 .o.......&......

delcare @a char(1)
execute foo @a
--------------
0000 00 08 7c c2 42 c2 00 03 47 8b 23 05 08 00 45 00 ..|.B...G.#...E.
0010 00 b0 3d 09 40 00 80 06 67 92 0a 00 2c 4c 0a 00 ..=.@...g...,L..
0020 15 61 04 e7 05 99 f8 4d a1 9c a1 35 e5 4b 50 18 .a.....M...5.KP.
0030 fa f0 2a d3 00 00 03 01 00 88 00 00 01 00 ff ff ..*.............
0040 0b 00 00 00 00 01 26 04 04 ff ff ff ff 00 00 63 ......&........c
0050 00 00 00 00 09 04 00 01 32 ff ff ff ff 00 00 63 ........2......c
0060 48 00 00 00 09 04 00 01 32 48 00 00 00 64 00 65 H.......2H...d.e
0070 00 63 00 6c 00 61 00 72 00 65 00 20 00 40 00 61 .c.l.a.r.e. .@.a
0080 00 20 00 63 00 68 00 61 00 72 00 28 00 31 00 29 . .c.h.a.r.(.1.)
0090 00 0d 00 0a 00 65 00 78 00 65 00 63 00 75 00 74 .....e.x.e.c.u.t
00a0 00 65 00 20 00 66 00 6f 00 6f 00 20 00 40 00 61 .e. .f.o.o. .@.a
00b0 00 0d 00 0a 00 00 00 26 04 04 01 00 00 00 .......&......

delcare @a char(1)
execute foo @a output
---------------------
0000 00 08 7c c2 42 c2 00 03 47 8b 23 05 08 00 45 00 ..|.B...G.#...E.
0010 00 be 3e c7 40 00 80 06 65 c6 0a 00 2c 4c 0a 00 ..>.@...e...,L..
0020 15 61 04 e7 05 99 f8 4d a4 6a a1 35 e6 ab 50 18 .a.....M.j.5..P.
0030 f9 90 17 0a 00 00 03 01 00 96 00 00 01 00 ff ff ................
0040 0b 00 00 00 00 01 26 04 04 ff ff ff ff 00 00 63 ......&........c
0050 00 00 00 00 09 04 00 01 32 ff ff ff ff 00 00 63 ........2......c
0060 56 00 00 00 09 04 00 01 32 56 00 00 00 64 00 65 V.......2V...d.e
0070 00 63 00 6c 00 61 00 72 00 65 00 20 00 40 00 61 .c.l.a.r.e. .@.a
0080 00 20 00 63 00 68 00 61 00 72 00 28 00 31 00 29 . .c.h.a.r.(.1.)
0090 00 0d 00 0a 00 65 00 78 00 65 00 63 00 75 00 74 .....e.x.e.c.u.t
00a0 00 65 00 20 00 66 00 6f 00 6f 00 20 00 40 00 61 .e. .f.o.o. .@.a
00b0 00 20 00 6f 00 75 00 74 00 70 00 75 00 74 00 0d . .o.u.t.p.u.t..
00c0 00 0a 00 00 00 26 04 04 01 00 00 00 .....&......







Archive powered by MHonArc 2.6.24.

Top of Page