[Pkg-nagios-changes] [SCM] debian packaging of icinga(-core) branch, master, updated. 1.0.1-3-7-gb2b840f
Alexander Wirt
formorer at debian.org
Mon May 31 19:39:41 UTC 2010
The following commit has been merged in the master branch:
commit 7020e598374f49e465351106f7d6ab10e31ae98c
Author: Alexander Wirt <formorer at debian.org>
Date: Mon May 31 21:12:48 2010 +0200
Backport several ido2db fixes from git
diff --git a/debian/changelog b/debian/changelog
index 4eca766..80cde90 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
icinga (1.0.1-4) unstable; urgency=low
* Fix mini_epn p1 path
+ * Backport several ido2db fixes from git
-- Alexander Wirt <formorer at debian.org> Tue, 13 Apr 2010 11:52:52 +0200
diff --git a/debian/patches/00list b/debian/patches/00list
index 1a64a12..363e833 100644
--- a/debian/patches/00list
+++ b/debian/patches/00list
@@ -7,3 +7,6 @@
60_fix_p1.pl_patch_mini_epn.dpatch
70_fix_eventhandler_paths.dpatch
80_fix_idoutils_escaping
+85_fix_dbescaping.dpatch
+90_fix_ndo2db_get_object_id.dpatch
+95_fix_hostdb_inserts.dpatch
diff --git a/debian/patches/85_fix_dbescaping.dpatch b/debian/patches/85_fix_dbescaping.dpatch
new file mode 100644
index 0000000..bc7128e
--- /dev/null
+++ b/debian/patches/85_fix_dbescaping.dpatch
@@ -0,0 +1,81 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 85_fix_dbescaping.dpatch by Michael Friedrich
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: This patch fixes escaping for command definitions
+## DP: Backported from git: 0a98462f01f6cdf7b4fda3ad0b78e0c8658f5761
+
+ at DPATCH@
+X-Git-Url: https://git.icinga.org/?p=icinga-core.git;a=blobdiff_plain;f=module%2Fidoutils%2Fsrc%2Fdb.c;h=439bf7b5ede52f4c75f80aba728ca87b47b47dd2;hp=d542cff5cb105747ce0fac99dd01548892c961b7;hb=0a98462f01f6cdf7b4fda3ad0b78e0c8658f5761;hpb=32bd11ed15070a9ee2930de4d23c680ce4d28e0d;js=1
+
+diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
+index d542cff..439bf7b 100644
+--- a/module/idoutils/src/db.c
++++ b/module/idoutils/src/db.c
+@@ -1813,11 +1813,57 @@ char *ndo2db_db_escape_string(ndo2db_idi *idi, char *buf) {
+
+ z = strlen(buf);
+
++ /* escape characters */
++#ifndef USE_ORACLE /* everything else will be libdbi */
++ /* allocate space for the new string */
++
++ if ((newbuf = (char *) malloc((z * 2) + 1)) == NULL)
++ return NULL;
++
++ for (x = 0, y = 0; x < z; x++) {
++
++ if(idi->dbinfo.server_type==NDO2DB_DBSERVER_MYSQL){
++
++ if(buf[x]=='\'' || buf[x]=='\"' || buf[x]=='*' || buf[x]=='\\' || buf[x]=='$' || buf[x]=='?' || buf[x]=='.' || buf[x]=='^' || buf[x]=='+' || buf[x]=='[' || buf[x]==']' || buf[x]=='(' || buf[x]==')')
++ newbuf[y++]='\\';
++ }
++ else if(idi->dbinfo.server_type==NDO2DB_DBSERVER_PGSQL){
++
++ if (buf[x] == '\'' || buf[x] == '[' || buf[x] == ']' || buf[x] == '(' || buf[x] == ')')
++ newbuf[y++] = '\\';
++
++ /* should be fixed with binding values */
++ /* if(buf[x]=='\'' )
++ newbuf[y++]='\''; */
++ }
++ else {
++
++ if(buf[x]=='\'' )
++ newbuf[y++]='\'';
++
++ }
++
++ newbuf[y++] = buf[x];
++ }
++
++ /* terminate escape string */
++ newbuf[y] = '\0';
++
++ ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_db_escape_string(%s) end\n", newbuf);
++ return newbuf;
++
++ //size_t res = dbi_conn_quote_string(idi->dbinfo.dbi_conn, &buf);
++
++ //ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_db_escape_string(%s) end\n", buf);
++ //return buf;
++
++#else /* Oracle ocilib specific */
++
+ /* allocate space for the new string */
+ if ((newbuf = (char *) malloc((z * 2) + 1)) == NULL)
+ return NULL;
+
+- /* escape characters */
++
+ for (x = 0, y = 0; x < z; x++) {
+
+ if(buf[x]=='\'' )
+@@ -1825,6 +1871,7 @@ char *ndo2db_db_escape_string(ndo2db_idi *idi, char *buf) {
+
+ newbuf[y++] = buf[x];
+ }
++#endif /* Oracle ocilib specific */
+
+ /* terminate escape string */
+ newbuf[y] = '\0';
diff --git a/debian/patches/90_fix_ndo2db_get_object_id.dpatch b/debian/patches/90_fix_ndo2db_get_object_id.dpatch
new file mode 100644
index 0000000..ae0175f
--- /dev/null
+++ b/debian/patches/90_fix_ndo2db_get_object_id.dpatch
@@ -0,0 +1,53 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 90_fix_ndo2db_get_object_id.dpatch.dpatch by Michael Friedrich
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: ndo2db_get_object_id fails to return existing IDs
+## DP: backported from git 201b683c0fe0a703057c9683c45100df83d4f111
+
+ at DPATCH@
+X-Git-Url: https://git.icinga.org/?p=icinga-core.git;a=blobdiff_plain;f=module%2Fidoutils%2Fsrc%2Fdbhandlers.c;h=03cd69cc9e354d2cf3f0c00c4ad5e5eaa56e79c0;hp=248abcf93a8e2d83a3e8528ae5f4119f3ab5a423;hb=201b683c0fe0a703057c9683c45100df83d4f111;hpb=4d7721a9c1ccc3a62ceab2445795014c3527dfc0;js=1
+
+diff --git a/module/idoutils/src/dbhandlers.c b/module/idoutils/src/dbhandlers.c
+index 248abcf..03cd69c 100644
+--- a/module/idoutils/src/dbhandlers.c
++++ b/module/idoutils/src/dbhandlers.c
+@@ -162,16 +162,18 @@ int ndo2db_get_object_id(ndo2db_idi *idi, int object_type, char *n1, char *n2, u
+ }
+ }
+
+- if (asprintf(&buf, "SELECT * FROM %s WHERE instance_id='%lu' AND objecttype_id='%d' AND %s AND %s", ndo2db_db_tablenames[NDO2DB_DBTABLE_OBJECTS], idi->dbinfo.instance_id, object_type, buf1, buf2) == -1)
++ if (asprintf(&buf, "SELECT * FROM %s WHERE instance_id=%lu AND objecttype_id=%d AND %s AND %s", ndo2db_db_tablenames[NDO2DB_DBTABLE_OBJECTS], idi->dbinfo.instance_id, object_type, buf1, buf2) == -1)
+ buf = NULL;
+
+ if ((result = ndo2db_db_query(idi, buf)) == NDO_OK) {
+ if (idi->dbinfo.dbi_result != NULL) {
+- if (dbi_result_next_row(idi->dbinfo.dbi_result))
++ if (dbi_result_next_row(idi->dbinfo.dbi_result)) {
+ *object_id = dbi_result_get_ulong(idi->dbinfo.dbi_result, "object_id");
+-
++ } else {
++ result = NDO_ERROR;
++ }
+
+- dbi_result_free(idi->dbinfo.dbi_result);
++ dbi_result_free(idi->dbinfo.dbi_result);
+ idi->dbinfo.dbi_result = NULL;
+ }
+ }
+@@ -355,13 +357,11 @@ int ndo2db_get_object_id(ndo2db_idi *idi, int object_type, char *n1, char *n2, u
+ #endif /* Oracle ocilib specific */
+
+ /* free memory */
+- ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_query_objects_select_() before free\n");
++ //ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_query_objects_select_() before free\n");
+ for (x = 0; x < NAGIOS_SIZEOF_ARRAY(es); x++)
+ free(es[x]);
+
+- ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_query_objects_select_() free of es\n");
+- if (found_object == NDO_FALSE)
+- result = NDO_ERROR;
++ //ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_query_objects_select_() free of es\n");
+
+ ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_get_object_id(%lu) end\n", *object_id);
+
diff --git a/debian/patches/95_fix_hostdb_inserts.dpatch b/debian/patches/95_fix_hostdb_inserts.dpatch
new file mode 100644
index 0000000..0624a31
--- /dev/null
+++ b/debian/patches/95_fix_hostdb_inserts.dpatch
@@ -0,0 +1,47 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 95_fix_hostdb_inserts.dpatch by William Preston
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: The initial inserts of host entries into the objects
+## DP: table use the string 'NULL' instead of actual null values.
+## DP: backported from git: 4d7721a9c1ccc3a62ceab2445795014c3527dfc0
+
+ at DPATCH@
+X-Git-Url: https://git.icinga.org/?p=icinga-core.git;a=blobdiff_plain;f=module%2Fidoutils%2Fsrc%2Fdbhandlers.c;h=248abcf93a8e2d83a3e8528ae5f4119f3ab5a423;hp=6bd18d10131f881bffdf0354660111223838b1ee;hb=4d7721a9c1ccc3a62ceab2445795014c3527dfc0;hpb=6198ab4db9f57eb944ce4e56e1651966e908281b;js=1
+
+diff --git a/module/idoutils/src/dbhandlers.c b/module/idoutils/src/dbhandlers.c
+index 6bd18d1..248abcf 100644
+--- a/module/idoutils/src/dbhandlers.c
++++ b/module/idoutils/src/dbhandlers.c
+@@ -401,17 +401,28 @@ int ndo2db_get_object_id_with_insert(ndo2db_idi *idi, int object_type, char *n1,
+ return NDO_OK;
+
+ if (name1 != NULL) {
+- es[0] = ndo2db_db_escape_string(idi, name1);
++ tmp = ndo2db_db_escape_string(idi, name1);
++ asprintf(&es[0], "'%s'", tmp);
++ if (tmp) {
++ free(tmp);
++ tmp = NULL;
++ }
+ } else
+ asprintf(&es[0],"NULL");
++
+ if (name2 != NULL) {
+- es[1] = ndo2db_db_escape_string(idi, name2);
++ tmp = ndo2db_db_escape_string(idi, name2);
++ asprintf(&es[1], "'%s'", tmp);
++ if (tmp) {
++ free(tmp);
++ tmp = NULL;
++ }
+ } else
+ asprintf(&es[1], "NULL");
+
+ #ifndef USE_ORACLE /* everything else will be libdbi */
+ if (asprintf(&buf,
+- "INSERT INTO %s (instance_id, objecttype_id, name1, name2) VALUES (%lu, %d, '%s', '%s')",
++ "INSERT INTO %s (instance_id, objecttype_id, name1, name2) VALUES (%lu, %d, %s, %s)",
+ ndo2db_db_tablenames[NDO2DB_DBTABLE_OBJECTS],
+ idi->dbinfo.instance_id, object_type, es[0],
+ es[1]) == -1)
--
debian packaging of icinga(-core)
More information about the Pkg-nagios-changes
mailing list