[icinga-checkins] icinga.org: icinga-core/master: idoutils: fix string escaping for backslashes in postgresql #1121

git at icinga.org git at icinga.org
Thu Jan 20 14:03:26 CET 2011


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

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Wed Jan 19 08:38:59 2011 +0100

idoutils: fix string escaping for backslashes in postgresql #1121

oh well, everything else gets escaped, but not the single backslash...

needs to be verified/tested.

refs #1121

---

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

diff --git a/Changelog b/Changelog
index 77fbab9..6e944f7 100644
--- a/Changelog
+++ b/Changelog
@@ -81,6 +81,7 @@ FIXES
 * idoutils: increase debugoutput for conversion functions #1094
 * idoutils: fix libdbi 0.8.3 deprecated functions dbi_result_get_(u)long #559
 * idoutils: fix after core restart/reload on oracle db ORA-01403: no data found #1059
+* idoutils: fix string escaping for backslashes in postgresql #1121
 
 
 1.2.1 - 25/10/2010
diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
index ad7185c..183d6b3 100644
--- a/module/idoutils/src/db.c
+++ b/module/idoutils/src/db.c
@@ -2197,12 +2197,8 @@ char *ido2db_db_escape_string(ido2db_idi *idi, char *buf) {
                 }
                 else if(idi->dbinfo.server_type==IDO2DB_DBSERVER_PGSQL){
 
-			if (buf[x] == '\'' || buf[x] == '[' || buf[x] == ']' || buf[x] == '(' || buf[x] == ')')
+			if (buf[x] == '\'' || buf[x] == '\\' || buf[x] == '\0')
 				newbuf[y++] = '\\';
-
-                	/* should be fixed with binding values */
-			/* if(buf[x]=='\'' )
-                               newbuf[y++]='\''; */
 		}
 		else {
 





More information about the icinga-checkins mailing list