Seg Faults in login.c; freetds version 0.53

cori lynn arnold ccavyell at
Sun Oct 28 16:19:43 EST 2001

Hello, this message is for: Eric Deutsch, Richard Norman & Bill Rayburn
(and everyone else getting a Seg Fault while trying to login).

I hacked freetds version 0.51 to work on the sparc solaris 8 platform back
in april, by manually reversing several bytes.  I desired a cleaner way to
use the sparc so i downloaded the 0.53 version noting comments on the
release that big-endian now works.

The symptom I noted in version 0.53 was a Seg Fault in login.c for TDS
version 7.0 while doing a strlen(config->host_name).  This happened on
both the linux and sparc solaris 8.

I've spent the weekend working on making this work for linux and solaris 8
on sparc.  I made changes in the tds7_send_login function only, and the
0.53 version now works beautifully on both platforms.

here are the changes i made:

after: if(!domain_login)  
remove: strlen(config->host_name) & strlen(config->language)

after:/* host name */
change: strlen(config->host_name) 
to: 0
remove next line: current_pos += strlen(config->host_name)*2;

after: /* language */
change: strlen(config->language)
to: 0
remove next line: current_pos += strlen(language)*2;

remove line: tds7_ascii2unicode(config->host_name, unicode_string,255);
and next line: tds_put_n(tds,unicode_string,strlen(config->host_name)*2);

remove line: tds7_ascii2unicode(config->language, unicode_string, 255);
and next line: tds_put_n(tds,unicode_string,strlen(config->language)*2);

This solution may look strange, but it had a methodology.  I figured 0.51
login worked so i made the 0.53 version login.c look the same.  I hacked
it on the linux box and moved the login.c file over to the sparc and
everything worked, wonderfully!

Thanks to the dev-freetds team for making the byte switching in the
tds_put and tds_get functions a lot cleaner than my own.

--cori lynn

More information about the FreeTDS mailing list