[icinga-checkins] icinga.org: icinga-nrpe/mfriedrich/fixes: * add NRPE Patch to allow NASTY_METACHARS to be defined in nrpe.cfg #1274

git at icinga.org git at icinga.org
Sat Nov 12 14:51:33 CET 2011


Module: icinga-nrpe
Branch: mfriedrich/fixes
Commit: 54cf959984db5eb4022e1dae075b271ff034a1a5
URL:    https://git.icinga.org/?p=icinga-nrpe.git;a=commit;h=54cf959984db5eb4022e1dae075b271ff034a1a5

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Sat Nov 12 14:51:15 2011 +0100

* add NRPE Patch to allow NASTY_METACHARS to be defined in nrpe.cfg #1274

refs #1274

---

 Changelog                 |    1 +
 THANKS                    |    1 +
 sample-config/nrpe.cfg.in |    8 ++++++++
 src/nrpe.c                |    9 +++++++--
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 73113ba..8dac806 100644
--- a/Changelog
+++ b/Changelog
@@ -7,6 +7,7 @@ Icinga NRPE Changelog
 ENHANCEMENTS
 
 * add IPv6 Support
+* add NRPE Patch to allow NASTY_METACHARS to be defined in nrpe.cfg #1274
 
 FIXES
 
diff --git a/THANKS b/THANKS
index 267cd79..63eeb00 100644
--- a/THANKS
+++ b/THANKS
@@ -33,6 +33,7 @@ If we missed your name, let us know.
 * Peter Palfrader
 * Robert Peaslee
 * James Peterson
+* Tim Philips
 * Mark Plaksin
 * Andrew Ryder
 * Brian Seklecki
diff --git a/sample-config/nrpe.cfg.in b/sample-config/nrpe.cfg.in
index 8684882..8ca26fd 100644
--- a/sample-config/nrpe.cfg.in
+++ b/sample-config/nrpe.cfg.in
@@ -158,6 +158,14 @@ connection_timeout=300
 
 
 
+# ILLEGAL INPUT COMMAND AND ARGUMENT CHARACTERS
+# This option allows you to specify illegal characters that cannot
+# be passed to the NRPE daemon.
+
+illegal_metachars="|`&><'\"[]{};"
+
+
+
 # INCLUDE CONFIG FILE
 # This directive allows you to include definitions from an external config file.
 
diff --git a/src/nrpe.c b/src/nrpe.c
index d274dd4..6f5b457 100644
--- a/src/nrpe.c
+++ b/src/nrpe.c
@@ -87,7 +87,7 @@ int     show_version=FALSE;
 int     use_inetd=TRUE;
 int     debug=FALSE;
 
-
+char    *illegal_metachars=NASTY_METACHARS;
 
 
 int main(int argc, char **argv){
@@ -529,6 +529,11 @@ int read_config_file(char *filename){
 				syslog(LOG_WARNING,"Invalid log_facility specified in config file '%s' - Line %d\n",filename,line);
 			}
 
+                else if(!strcmp(varname,"illegal_metachars")) {
+                                illegal_metachars=strdup(varvalue);
+				syslog(LOG_INFO,"Using illegal meta characters '%s'\n",illegal_metachars);
+                        }
+
 		else{
 			syslog(LOG_WARNING,"Unknown option specified in config file '%s' - Line %d\n",filename,line);
 			continue;
@@ -1824,7 +1829,7 @@ int contains_nasty_metachars(char *str){
 	if(str==NULL)
 		return FALSE;
 	
-	result=strcspn(str,NASTY_METACHARS);
+	result=strcspn(str,illegal_metachars);
 	if(result!=strlen(str))
 		return TRUE;
 





More information about the icinga-checkins mailing list