Discussion:
[freetds] patch for ct.c
Gerhard Lausser
2013-08-22 22:23:41 UTC
Permalink
Hi,

i am the author of check_mssql_health, a plugin for the Nagios monitoring
system, which is used to monitor MS SQL and Sybase databases. It uses
freetds and DBD::Sybase.
The plugin can be called as

check_mssql_health --server <an_entry_in_freetds.conf> --username ....
which internally uses DBI->connect("DBI:Sybase:server=...
or
check_mssql_health --hostname <host_or_ip> --port <port> --username ....
which internally uses DBI->connect("DBI:Sybase:host=...;port=...

This worked reliably so far with the libs and modules from the linux
distributions.
Today i was compiling DBD::Sybase-1.15 and freetds-0.91 from source and with
this platform, calling check_mssql_health with --hostname no longer worked.
I got the error "Server name not found in configuration files"

Attached is a patch for freetds-0.91, which fixed the error for me.

Cheers,
Gerhard



__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 8718
(20130822) __________

E-Mail wurde gepruft mit ESET NOD32 Antivirus.

http://www.eset.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ct_connect-fix-dbdsybase-host-arg.patch
Type: application/octet-stream
Size: 630 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20130823/8cebdb4a/attachment.obj
Gerhard Lausser
2014-01-07 14:35:37 UTC
Permalink
Hi,

half a year has passed......is anybody interested in this patch? I get constantly mails from users which have the problem i was describing below and i just can answer that i submitted a patch some months ago.

Happy new year,
Gerhard

----- Urspr?ngliche Mail -----
Von: "Gerhard Lausser" <Gerhard.Lausser at consol.de>
An: freetds at lists.ibiblio.org
Gesendet: Freitag, 23. August 2013 00:23:41
Betreff: [freetds] patch for ct.c

Hi,

i am the author of check_mssql_health, a plugin for the Nagios monitoring
system, which is used to monitor MS SQL and Sybase databases. It uses
freetds and DBD::Sybase.
The plugin can be called as

check_mssql_health --server <an_entry_in_freetds.conf> --username ....
which internally uses DBI->connect("DBI:Sybase:server=...
or
check_mssql_health --hostname <host_or_ip> --port <port> --username ....
which internally uses DBI->connect("DBI:Sybase:host=...;port=...

This worked reliably so far with the libs and modules from the linux
distributions.
Today i was compiling DBD::Sybase-1.15 and freetds-0.91 from source and with
this platform, calling check_mssql_health with --hostname no longer worked.
I got the error "Server name not found in configuration files"

Attached is a patch for freetds-0.91, which fixed the error for me.

Cheers,
Gerhard



__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 8718
(20130822) __________

E-Mail wurde gepruft mit ESET NOD32 Antivirus.

http://www.eset.com
Frediano Ziglio
2014-01-07 21:55:30 UTC
Permalink
The patch looks good, comparing to other code ip_addrs is related to
set server_host_name. However usually first name is resolved then you
set server_host_name. Can this works for you ?

Something like this

diff --git a/src/ctlib/ct.c b/src/ctlib/ct.c
index c8611ec..10ec830 100644
--- a/src/ctlib/ct.c
+++ b/src/ctlib/ct.c
@@ -615,8 +615,14 @@ ct_connect(CS_CONNECTION * con, CS_CHAR *
servername, CS_INT snamelen)
con->tds_socket = NULL;
return CS_FAIL;
}
- if (con->server_addr)
+ if (con->server_addr) {
+ char ip_addr[256];
+
+ if
(tds_lookup_host(tds_dstr_cstr(&connection->server_host_name),
ip_addr) != TDS_SUCCEED)
+ return CS_FAIL;
tds_dstr_copy(&connection->server_host_name, con->server_addr);
+ tds_dstr_copy(&connection->ip_addr, ip_addr);
+ }

/* override locale settings with CS_CONNECTION settings, if any */
if (con->locale) {


Frediano
Post by Gerhard Lausser
Hi,
half a year has passed......is anybody interested in this patch? I get constantly mails from users which have the problem i was describing below and i just can answer that i submitted a patch some months ago.
Happy new year,
Gerhard
----- Urspr?ngliche Mail -----
Von: "Gerhard Lausser" <Gerhard.Lausser at consol.de>
An: freetds at lists.ibiblio.org
Gesendet: Freitag, 23. August 2013 00:23:41
Betreff: [freetds] patch for ct.c
Hi,
i am the author of check_mssql_health, a plugin for the Nagios monitoring
system, which is used to monitor MS SQL and Sybase databases. It uses
freetds and DBD::Sybase.
The plugin can be called as
check_mssql_health --server <an_entry_in_freetds.conf> --username ....
which internally uses DBI->connect("DBI:Sybase:server=...
or
check_mssql_health --hostname <host_or_ip> --port <port> --username ....
which internally uses DBI->connect("DBI:Sybase:host=...;port=...
This worked reliably so far with the libs and modules from the linux
distributions.
Today i was compiling DBD::Sybase-1.15 and freetds-0.91 from source and with
this platform, calling check_mssql_health with --hostname no longer worked.
I got the error "Server name not found in configuration files"
Attached is a patch for freetds-0.91, which fixed the error for me.
Cheers,
Gerhard
__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 8718
(20130822) __________
E-Mail wurde gepruft mit ESET NOD32 Antivirus.
http://www.eset.com
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
Loading...