[freetds] Issue connecting to SQL Server from Linux Host withnewerversions of FreeTDS...

Christos Zoulas christos at zoulas.com
Tue Nov 28 09:01:32 EST 2006


On Nov 28,  8:10am, Glenn at addsys.com ("Glenn, Chris") wrote:
-- Subject: Re: [freetds] Issue connecting to SQL Server from Linux Host with

| Just last night I was reviewing our networking code in conjunction with
| reading Steven's book, and it so happens I was looking at that very
| function.  
| 
| EINVAL is not a nice error code; it says we're not supplying a good
| value for some element of the sockaddr_in structure.  NetBSD's manpage
| doesn't even mention it at as valid errno value for connect(2).  
| 
| The code itself looks OK, and comparing it to revision 1.14 (Tue Feb 22
| 16:04:36 2005), most of the changes are to the logging code and adding
| support for DOS32.  That makes me wonder if it's a matter of configure
| perhaps misdetecting your system somehow.  I think it was around that
| time that we upgraded the toolset that generates the configure script.  
| 
| I added yet more logging code, cf. patch below.  With it, your log file
| should now dump the sockaddr_in structure.  You can verify that, say,
| sin_family really is AF_INET according to your system's header files.  
| 
| I'm not sure we should leave this code in; it won't compile under Win32,
| for instance.  But it will be in the next snapshot, and maybe it will
| help solve your problem.  
| 
| --jkl

The code is broken (if I am looking at the right version). All the fields
of sockaddr_in are required to be initialized to 0. Try adding a:

	(void)memset(&sin, 0, sizeof(sin));

at the beginning of the function.

christos



More information about the FreeTDS mailing list