Skip to Content.
Sympa Menu

freetds - [freetds] Bug #1759652 and resolution

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Bug #1759652 and resolution
  • Date: Tue, 7 Aug 2007 10:25:34 +0200

I'm trying to fix this problem (see
http://sourceforge.net/tracker/index.php?func=detail&aid=1759652&group_i
d=33106&atid=407806) but I think I encountered some problems with this
stuff:
- server\instance and server:port syntax was NEVER documented in our
userguide. Simply added the code and documented in some places (php
docs, some mails and so on)
- if this syntax is used tds_read_conf_file is called with full name
leading to a wrong name resolution. This slow down a lot connections

Steven (who submitted the bug and the fix) correctly post a patch which
fix the servername (removing "\instance" or ":port" part), here is an
updated inline patch



Index: src/tds/config.c
===================================================================
RCS file: /cvsroot/freetds/freetds/src/tds/config.c,v
retrieving revision 1.128
diff -u -1 -0 -r1.128 config.c
--- src/tds/config.c 3 Aug 2007 11:16:55 -0000 1.128
+++ src/tds/config.c 3 Aug 2007 11:18:01 -0000
@@ -162,33 +162,33 @@
opened = tdsdump_open(path);
}
free(path);
}
}
}

tdsdump_log(TDS_DBG_INFO1, "Getting connection information for
[%s].\n",
tds_dstr_cstr(&login->server_name));
/* (The server name is set in login.c.) */

+ if (parse_server_name_for_port(connection, login)) {
+ tdsdump_log(TDS_DBG_INFO1, "Parsed servername, now %s on
%d.\n",
+ tds_dstr_cstr(&connection->server_name),
login->port);
+ }
+
/* Read the config files. */
tdsdump_log(TDS_DBG_INFO1, "Attempting to read conf files.\n");
if (!tds_read_conf_file(connection,
tds_dstr_cstr(&login->server_name))) {
/* fallback to interfaces file */
tdsdump_log(TDS_DBG_INFO1, "Failed in reading conf file.
Trying interface files.\n");
tds_read_interfaces(tds_dstr_cstr(&login->server_name),
connection);
}

- if (parse_server_name_for_port(connection, login)) {
- tdsdump_log(TDS_DBG_INFO1, "Parsed servername, now %s on
%d.\n",
- tds_dstr_cstr(&connection->server_name),
login->port);
- }
-
/* Override config file settings with environment variables. */
tds_fix_connection(connection);

/* And finally apply anything from the login structure */
tds_config_login(connection, login);

if (opened) {
tdsdump_log(TDS_DBG_INFO1, "Final connection
parameters:\n");
tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n",
"server_name", tds_dstr_cstr(&connection->server_name));
tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "port",
connection->port);



the questions are:
- is it correct?
- should we call tds_read_conf_file even if these strange syntaxes are
used?
- if is correct to call tds_read_conf_file after
parse_server_name_for_port which specifications should take precedence.
For instance if we specify foo:1234 and in section "foo" of freetds.conf
we have "port = 5678" which port should we use.
I think all these cases should be documented in our userguide.

Also I start thinking that perhaps name resolution should be done in
login.c or in net.c and not in config.c so to avoid double resolutions.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page