Title: [opsview-base] [214] Fix for the unescaping of characters, especially for Windows checks
Revision
214
Author
tvoon
Date
2013-02-15 15:18:32 +0000 (Fri, 15 Feb 2013)

Log Message

Fix for the unescaping of characters, especially for Windows checks

Modified Paths


Added Paths

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2013-02-11 14:25:49 UTC (rev 213)
+++ trunk/Makefile	2013-02-15 15:18:32 UTC (rev 214)
@@ -584,6 +584,8 @@
 	cd ${NAGIOS} && patch -p0 < ../patches/nagios_fix_cgi_object_relationships.patch
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_statusmap_remove_user_supplied_option.patch
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_statusmap_reduce_nagios_process_text.patch
+	# Patch below already in nagios, commit 2599
+	cd ${NAGIOS} && patch -p1 < ../patches/nagios_handle_escape_characters.patch
 	if [ $(KERNEL_NAME) = Linux ] ; then \
 		cd ${NAGIOS} && CFLAGS="${CFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-command-group=$(NAGIOS_GROUP) --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \
 	elif [ $(KERNEL_NAME) = Darwin ] ; then \

Added: trunk/patches/nagios_handle_escape_characters.patch
===================================================================
--- trunk/patches/nagios_handle_escape_characters.patch	                        (rev 0)
+++ trunk/patches/nagios_handle_escape_characters.patch	2013-02-15 15:18:32 UTC (rev 214)
@@ -0,0 +1,41 @@
+diff -ur nagios-4.0.20130107.original//base/utils.c nagios-4.0.20130107/base/utils.c
+--- nagios-4.0.20130107.original//base/utils.c	2013-01-21 13:44:50.000000000 +0000
++++ nagios-4.0.20130107/base/utils.c	2013-02-15 15:12:08.000000000 +0000
+@@ -614,7 +614,6 @@
+ 	register int x = 0;
+ 	register int y = 0;
+ 	register int arg_index = 0;
+-	register int escaped = FALSE;
+ 
+ 	log_debug_info(DEBUGL_FUNCTIONS, 0, "get_raw_command_line_r()\n");
+ 
+@@ -651,22 +650,17 @@
+ 			/* can't use strtok(), as that's used in process_macros... */
+ 			for(arg_index++, y = 0; y < sizeof(temp_arg) - 1; arg_index++) {
+ 
+-				/* backslashes escape */
+-				if(cmd[arg_index] == '\\' && escaped == FALSE) {
+-					escaped = TRUE;
+-					continue;
+-					}
+-
+-				/* end of argument */
+-				if((cmd[arg_index] == '!' && escaped == FALSE) || cmd[arg_index] == '\x0')
++				/* handle escaped argument delimiters */
++				if(cmd[arg_index] == '\\' && cmd[arg_index+1] == '!') {
++					arg_index++;
++				} else if(cmd[arg_index] == '!' || cmd[arg_index] == '\x0') {
++					/* end of argument */
+ 					break;
++				}
+ 
+-				/* normal of escaped char */
++				/* copy the character */
+ 				temp_arg[y] = cmd[arg_index];
+ 				y++;
+-
+-				/* clear escaped flag */
+-				escaped = FALSE;
+ 				}
+ 			temp_arg[y] = '\x0';
+ 

_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to