[freetds] Server dumps core while reading login packet

Steve Kirkendall skirkendall at dsl-only.net
Tue Apr 13 19:57:48 EDT 2004

I'm trying to write a simple SQL server so Windows users can run Crystal
Reports on data in my company's Linux application.  Last week I wrote the
SQL interpreter, and now I'm trying to use -ltdssrv to make it a server.
However, both my server and the freetds-0.62.3/src/server/unittest.c
program dump core in the roughly the same place.

They crash while trying to read strings for the login packet.  My little
SQL server dies while reading the client's host_name (the very first
string), while the unittest program fails while reading the password,
after successfully reading the host_name and user_name.  In one instance
I think unittest.c failed while reading user_name, but I'm not 100% sure
about that.  Both programs die while trying to free the old value of that
string, when the old value is bogus.

Is this a known problem?  Or is it just me?

Do I need to set up a "tdssrv.conf" file or anything like that?  Because
I haven't.  I couldn't find any documentation saying it's needed for a
server.  It makes sense to me that a server wouldn't need a configuration
file, but still I thought I'd mention it.

Can anybody suggest a good keyword for me to use when searching through
the mailing list archives?  "Server" just doesn't cut it.  Surprisingly,
"tdssrv" isn't much better.

Am I correct in assuming that most programmers use FreeTDS for writing
clients, not servers?  Is there any documentation for the server
functions?  Or a better example than unittest.c?

I'm using FreeTDS 0.62.3 (current stable version), in SuSE 8.2, Linux
kernel 2.4.23, gcc version 3.3 20030226.  I compiled the unittest.c
program with "gcc -g unittest.c -ltdssrv -ounittest" (after installing
the tdssrv library where gcc could find it).

I've been doing most of my tests by going to a Windows machine and
using the "Test Connection" button in the ODBC Data Source Administrator
dialog of the Control Panel.  It's using the MS-SQL Server driver, but
I've confirmed that it is sending a TDS5 login packet, not a TDS7 one.
I'll worry about TDS7 later.

Oh, one other little problem: The tsql program seems to ignore the
-pportnumber flag.  I tried using -p1433 to make it use the same port
as MS SQL Server, but it insists on using port 4000.

For any advice you can give -- thank you.

Steve Kirkendall    |A:It is confusing, since people don't read that way
kirkenda at cs.pdx.edu |Q:Why is top-posting bad?
                    |A:It is adding comments to the top of a message
                    |Q:What is top-posting?

More information about the FreeTDS mailing list