[icinga-checkins] icinga.org: icinga-core/master: Fix case insensitive behavior

git at icinga.org git at icinga.org
Wed Oct 21 21:24:28 CEST 2009


Module: icinga-core
Branch: master
Commit: 23a58c5d21e043efba44a6cc0687049a1b5360f5
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=23a58c5d21e043efba44a6cc0687049a1b5360f5

Author: Hendrik Baecker <andurin at process-zero.de>
Date:   Wed Oct 21 21:23:42 2009 +0200

Fix case insensitive behavior

IDO2DB now handles renamed objects like Icinga itself. Renaming is deleting
the old and creating a new object.

Why change this and possibly loose historical data based on the same database
object id?
Think about the following:
Icinga knows a "localhost" and a "LOCALHOST" two different objects.
IDOUtils (without this patch) would handle both objects as the same
including all references like services, state changes and so on.

IDOUtils would mix two different objects together - this can't be right.

---

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

diff --git a/Changelog b/Changelog
index 7590362..c1e45d7 100644
--- a/Changelog
+++ b/Changelog
@@ -36,6 +36,7 @@ Icinga 0.8.x Change Log
 * idoutils: fix idomod/icinga segfault while try to use ssl on unix sockets
 * core configure: set INIT_OPTS depending on detected host OS (no more root:root on FreeBSD?)
 * core spec: added new spec file
+* idoutils: fix case insensitive
 
 0.8.4 - 09/15/2009
 * idoutils: fix failure_prediction_options in tables hosts, services for postgres
diff --git a/module/idoutils/src/dbhandlers.c b/module/idoutils/src/dbhandlers.c
index 844fe8f..14de343 100644
--- a/module/idoutils/src/dbhandlers.c
+++ b/module/idoutils/src/dbhandlers.c
@@ -74,7 +74,7 @@ int ndo2db_get_object_id(ndo2db_idi *idi, int object_type, char *n1, char *n2, u
 			buf1 = NULL;
 	} else {
 		es[0] = ndo2db_db_escape_string(idi, name1);
-		if (asprintf(&buf1, "name1='%s'", es[0]) == -1)
+		if (asprintf(&buf1, "BINARY name1='%s'", es[0]) == -1)
 			buf1 = NULL;
 	}
 
@@ -84,7 +84,7 @@ int ndo2db_get_object_id(ndo2db_idi *idi, int object_type, char *n1, char *n2, u
 			buf2 = NULL;
 	} else {
 		es[1] = ndo2db_db_escape_string(idi, name2);
-		if (asprintf(&buf2, "name2='%s'", es[1]) == -1)
+		if (asprintf(&buf2, "BINARY name2='%s'", es[1]) == -1)
 			buf2 = NULL;
 	}
 





More information about the icinga-checkins mailing list