CS_SERVERADDR tag is not handled correctly in ct_con_props
Stephen Marshall <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAJX-rPN6t9RAewLtJqCbkn+npXShvpR5HFsx7rKr36_s_t3kqQ@mail.gmail.com> |
FreeTDS 0.91 does not honor the CS_SERVERADDR tag in the ct_con_props function. This function and tag are used to allow database connections using a "<host> <port>" syntax. There is code in FreeTDS that compensates for this problem by allowing the user to specify the server name as "<host>:<port>". FreeTDS supports this syntax as a fallback case when a server name cannot be found in the configuration file. See freetds file src/tds/config.c, parse_server_name_for_port function for details. However, this is not a standard part of the TDS protocol. Client applications conforming to the standard can end up doing the wrong thing. I have noticed this problem in the sqsh client, but may affect other clients as well. The connection code should either be fixed or the CS_SERVERADDR macro should be disabled. The latter would signal to client applications that CS_SERVERADDR does not work per spec, which would allow client applications to avoid calling this function when linked against FreeTDS. Note: this problem was originally submitted as a bug to the sqsh project, but latter determined to be a problem in FreeTDS. Further details of the original submission can be found here: http://sourceforge.net/p/sqsh/bugs/60/ Also note that I tried to fix this myself, but I got a little lost in mapping of connection information between several different data structures. It does not seem like the port information is carried through all of them. With some guidance on how to proceed without inducing side effects, I would be happy to work on this problem.