[icinga-checkins] icinga.org: icinga-core/rb_1.2: idoutils: fix database port in ido2db. cfg not honoured using libdbi #825

git at icinga.org git at icinga.org
Tue Sep 28 16:52:57 CEST 2010


Module: icinga-core
Branch: rb_1.2
Commit: 3b27f37b01756a38197a9eafcd1076c94f171b7d
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=3b27f37b01756a38197a9eafcd1076c94f171b7d

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Mon Sep 27 18:48:01 2010 +0200

idoutils: fix database port in ido2db.cfg not honoured using libdbi #825

fixes #825

---

 Changelog                |    1 +
 module/idoutils/src/db.c |    8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index b5454a9..287b6ee 100644
--- a/Changelog
+++ b/Changelog
@@ -43,6 +43,7 @@ FIXES
 * classic ui: drop dead code on cgis (check_daemon_running)
 
 * idoutils: fix ido2db forking if database connection failed, now immediately disconnecting the client #773
+* idoutils: fix database port in ido2db.cfg not honoured using libdbi #825
 
 * install: remove php dependency and files for updatechecks/extended search in icinga.spec #800
 * install: add mkdir -p for HTTPDCONF directory creation instead of install -D (misses on Unix) #802
diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
index 8928faa..6888670 100644
--- a/module/idoutils/src/db.c
+++ b/module/idoutils/src/db.c
@@ -419,9 +419,9 @@ int ido2db_db_connect(ido2db_idi *idi) {
 #endif /* Oracle ocilib specific */
 
 
-	/* Check if the dbi connection was created successful */
-
 #ifdef USE_LIBDBI /* everything else will be libdbi */
+
+	/* Check if the dbi connection was created successful */
 	if (idi->dbinfo.dbi_conn == NULL) {
 		dbi_conn_error(idi->dbinfo.dbi_conn, &dbi_error);
 		syslog(LOG_USER | LOG_INFO, "Error: Could  not dbi_conn_new(): %s", dbi_error);
@@ -431,6 +431,7 @@ int ido2db_db_connect(ido2db_idi *idi) {
 	}
 
 	dbi_conn_set_option(idi->dbinfo.dbi_conn, "host", ido2db_db_settings.host);
+	dbi_conn_set_option_numeric(idi->dbinfo.dbi_conn, "port", (int)ido2db_db_settings.port);
 	dbi_conn_set_option(idi->dbinfo.dbi_conn, "username", ido2db_db_settings.username);
 	dbi_conn_set_option(idi->dbinfo.dbi_conn, "password", ido2db_db_settings.password);
 	dbi_conn_set_option(idi->dbinfo.dbi_conn, "dbname", ido2db_db_settings.dbname);
@@ -468,8 +469,9 @@ int ido2db_db_connect(ido2db_idi *idi) {
 						ido2db_db_settings.dbname,
 						ido2db_db_settings.username,
 						ido2db_db_settings.password);
+	free(temp_port);
 
-        ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_db_connect() pgsql segfault?\n"); 
+        ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_db_connect() pgsql segfault?\n");
 
 	if(PQstatus(idi->dbinfo.pg_conn) != CONNECTION_OK) {
                 syslog(LOG_USER | LOG_INFO, "Error: Could not connect to pgsql database: %s", PQerrorMessage(idi->dbinfo.pg_conn));





More information about the icinga-checkins mailing list