[freetds] TDS/RPC messages and embedded comments

Jones, James O James.Jones at unisys.com
Tue Jan 7 15:41:30 EST 2003


This is a low-level TDS protocol question, specifically related to the
construction of RPC messages (TDS packetType=0x03).

I hope to embed a text comment somewhere in a TDS/RPC message buffer. I need
this comment to ultimately be captured in SQL Server log file.

If RPC message buffers don't explicitly support comments, I would welcome
any creative suggestions for how to accomplish this. I am working with TDS
7.0 and SQL Server 2000. I have studied TDS protocol documentation on the
FreeTDS site and also source module query.c that constructs RPC messages.

More background-----

I am writing a library that intercepts outbound TDS messages and adds
auditing information about the client beyond what the standard SQL logfile
captures about the client. This is needed in billing/chargeback scenarios
when a middle-tier application server makes all database calls and hides the
identity of the actual end-user from the database server. I have been
successful in modifying simple text-based messages (TDS packetType 0x01),
but not RPC messages (packetType=0x03).

For example, I can modify a text-based SQL statement such as the following
	select * from authors
by inserting a comment identifying the end-client 
	-- clientID=DOMAIN\jonesjo <cr><lf>
	select * from authors

Thanks,
Jamie Jones
Unisys Corp



More information about the FreeTDS mailing list