Title: [opsview-base] [231] Merged upstream fixes from Nagios.
Revision
231
Author
tvoon
Date
2013-03-25 13:12:51 +0000 (Mon, 25 Mar 2013)

Log Message

Merged upstream fixes from Nagios. Include tilda in shell execution.
Semi colons in check commands are now not considered as comments

Modified Paths

Added Paths

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2013-03-23 00:18:17 UTC (rev 230)
+++ trunk/Makefile	2013-03-25 13:12:51 UTC (rev 231)
@@ -588,7 +588,10 @@
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_handle_escape_characters.patch
 	# Patch below already in nagios, commit 2608
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_cgi_error_for_hosts_with_umlats.patch
+	# The event handler below is done in upstream code via 2683, but that doesn't seem to give the
+	# proper timeout if event handler takes too long. We'll use our version until upstream works
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_4_support_event_handlers.patch
+	#cd ${NAGIOS} && patch -p1 < ../patches/nagios_bugfix_2683.patch
 	# bugfixes below already in nagios, listing commit numbers
 	cd ${NAGIOS} && patch -l -p2 < ../patches/nagios_bugfix_2576.patch
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_bugfix_2578.patch
@@ -609,6 +612,9 @@
 	# Single backslashes are converted by Nagios into a double backslash in SERVICEOUTPUT, which then gets passed to NRD
 	# NRD will just send data as is
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_convert_to_linefeeds_from_checkresults.patch
+	cd ${NAGIOS} && patch -p1 < ../patches/nagios_allow_unescaped_semi_colons_for_check_commands_in_config_file.patch
+	cd ${NAGIOS} && patch -p1 < ../patches/nagios_bugfix_2637_to_2640.patch
+	cd ${NAGIOS} && patch -p0 < ../patches/nagios_tilda_in_commands_execute_via_shell.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_allow_unescaped_semi_colons_for_check_commands_in_config_file.patch
===================================================================
--- trunk/patches/nagios_allow_unescaped_semi_colons_for_check_commands_in_config_file.patch	                        (rev 0)
+++ trunk/patches/nagios_allow_unescaped_semi_colons_for_check_commands_in_config_file.patch	2013-03-25 13:12:51 UTC (rev 231)
@@ -0,0 +1,19 @@
+diff -ur nagios-4.0.20130107.original/xdata/xodtemplate.c nagios-4.0.20130107/xdata/xodtemplate.c
+--- nagios-4.0.20130107.original/xdata/xodtemplate.c	2013-03-25 06:43:21.000000000 +0000
++++ nagios-4.0.20130107/xdata/xodtemplate.c	2013-03-25 08:08:59.000000000 +0000
+@@ -641,6 +641,15 @@
+ 			if(input[x] == ';') {
+ 				if(x == 0)
+ 					break;
++				// Opsview patch: This is quite ugly. This says that the comment delimiter is
++				// ignored if the string "check_(timeperiod_)?command" appears before it. Clearly, there are
++				// cases where this is not true. However, the alternative is to make a copy of the line
++				// and then "close the gap" when the semicolon is escaped, which might break
++				// other things. This could be introduced in future, with the cost at reload time
++				// to escape semi-colons
++				else if(((ptr=strstr(input,"check_command"))!=NULL || ((ptr=strstr(input,"check_timeperiod_command"))!=NULL)) && ((ptr - &input[0]) < x)){
++					// Let this go through
++					}
+ 				else if(input[x - 1] != '\\')
+ 					break;
+ 				}

Added: trunk/patches/nagios_bugfix_2637_to_2640.patch
===================================================================
--- trunk/patches/nagios_bugfix_2637_to_2640.patch	                        (rev 0)
+++ trunk/patches/nagios_bugfix_2637_to_2640.patch	2013-03-25 13:12:51 UTC (rev 231)
@@ -0,0 +1,43 @@
+diff -ur nagios-4.0.20130107.original/lib/runcmd.c nagios-4.0.20130107/lib/runcmd.c
+--- nagios-4.0.20130107.original/lib/runcmd.c	2013-03-25 06:43:21.000000000 +0000
++++ nagios-4.0.20130107/lib/runcmd.c	2013-03-25 08:06:30.000000000 +0000
+@@ -208,17 +208,26 @@
+ 			break;
+ 
+ 		case '`':
+-			if (!in_quotes) {
++			if (!(state & STATE_INSQ)) {
+ 				add_ret(CMD_HAS_SUBCOMMAND);
+ 			}
+ 			break;
+ 
+-		case '(':
++		case '(': case ')':
+ 			if (!in_quotes) {
+ 				add_ret(CMD_HAS_PAREN);
+ 			}
+ 			break;
+ 
++		case '$':
++			if (!(state & STATE_INSQ)) {
++				if (p[1] == '(')
++					add_ret(CMD_HAS_SUBCOMMAND);
++				else
++					add_ret(CMD_HAS_SHVAR);
++			}
++			break;
++
+ 		case '*': case '?':
+ 			if (!in_quotes) {
+ 				add_ret(CMD_HAS_WILDCARD);
+diff -ur nagios-4.0.20130107.original/lib/runcmd.h nagios-4.0.20130107/lib/runcmd.h
+--- nagios-4.0.20130107.original/lib/runcmd.h	2012-12-24 15:29:25.000000000 +0000
++++ nagios-4.0.20130107/lib/runcmd.h	2013-03-25 07:26:36.000000000 +0000
+@@ -19,6 +19,7 @@
+ #define CMD_HAS_UBSQ (1 << 4) /**< unbalanced single quotes */
+ #define CMD_HAS_UBDQ (1 << 5) /**< unbalanced double quotes */
+ #define CMD_HAS_WILDCARD (1 << 6) /**< wildcards present */
++#define CMD_HAS_SHVAR    (1 << 7) /**< shell variables present */
+ 
+ 
+ #define RUNCMD_EFD    (-1)  /**< Failed to pipe() or open() */

Added: trunk/patches/nagios_bugfix_2683.patch
===================================================================
--- trunk/patches/nagios_bugfix_2683.patch	                        (rev 0)
+++ trunk/patches/nagios_bugfix_2683.patch	2013-03-25 13:12:51 UTC (rev 231)
@@ -0,0 +1,22 @@
+diff -ur nagios-4.0.20130107.original/base/workers.c nagios-4.0.20130107/base/workers.c
+--- nagios-4.0.20130107.original/base/workers.c	2013-03-25 08:37:28.000000000 +0000
++++ nagios-4.0.20130107/base/workers.c	2013-03-25 08:39:07.000000000 +0000
+@@ -995,7 +995,7 @@
+ int wproc_run_check(check_result *cr, char *cmd, struct kvvec *kvv)
+ {
+ 	worker_job *job;
+-	time_t timeout;
++	int timeout;
+ 
+ 	if (cr->service_description)
+ 		timeout = service_check_timeout;
+@@ -1009,8 +1009,7 @@
+ int wproc_run(int jtype, char *cmd, int timeout, struct kvvec *kvv)
+ {
+ 	worker_job *job;
+-	time_t real_timeout = timeout + time(NULL);
+ 
+-	job = create_job(jtype, NULL, real_timeout, cmd);
++	job = create_job(jtype, NULL, timeout, cmd);
+ 	return wproc_run_job(job, kvv);
+ }

Added: trunk/patches/nagios_tilda_in_commands_execute_via_shell.patch
===================================================================
--- trunk/patches/nagios_tilda_in_commands_execute_via_shell.patch	                        (rev 0)
+++ trunk/patches/nagios_tilda_in_commands_execute_via_shell.patch	2013-03-25 13:12:51 UTC (rev 231)
@@ -0,0 +1,13 @@
+Index: lib/runcmd.c
+===================================================================
+--- lib/runcmd.c	(revision 2701)
++++ lib/runcmd.c	(working copy)
+@@ -228,7 +228,7 @@
+ 			}
+ 			break;
+ 
+-		case '*': case '?':
++		case '*': case '?': case '~':
+ 			if (!in_quotes) {
+ 				add_ret(RUNCMD_HAS_WILDCARD);
+ 			}

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

Reply via email to