[Nagios-devel] nrpe patch for configurable nasty metachars

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] nrpe patch for configurable nasty metachars

Post by Guest »

This is a multi-part message in MIME format.
--------------050805040206030503070006
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Ethan,

One more patch for nrpe (CVS 1-FEB-08) that allows the user to specify
the "nasty metachar" set in the nrpe.cfg file with the new
"nasty_metachar" config option. The default set of nasty metachars is
the same as it always was, if the user chooses not to use the new config
parameter.

I just realized that I probably should have updated the sample-config
files as well, but I forgot. Sorry.

I just sent two other patches for nrpe (also against CVS 1-FEB-08). As
far as I can tell, they should apply in any order, although I've only
tried them in alphabetical order. :)

John

--------------050805040206030503070006
Content-Type: text/plain;
name="nrpe-cfgmeta-cvs01022008.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="nrpe-cfgmeta-cvs01022008.patch"

diff -Naur nrpe/src/nrpe.c nrpe-patched/src/nrpe.c
--- nrpe/src/nrpe.c 2008-01-24 05:45:16.000000000 -0700
+++ nrpe-patched/src/nrpe.c 2008-02-01 16:19:33.000000000 -0700
@@ -42,7 +42,7 @@

#define DEFAULT_COMMAND_TIMEOUT 60 /* default timeout for execution of plugins */
#define MAXFD 64
-#define NASTY_METACHARS "|`&>sizeof(Nasty_Metachars)){
+ syslog(LOG_ERR,"Nasty Metcharacter list too long in config file '%s' - Line %d\n",filename,line);
+ return ERROR;
+ }
+ strncpy(Nasty_Metachars,varvalue,sizeof(Nasty_Metachars)-1);
+ Nasty_Metachars[sizeof(Nasty_Metachars)-1]='\0';
+ }
+
+ else{
syslog(LOG_WARNING,"Unknown option specified in config file '%s' - Line %d\n",filename,line);
continue;
}
@@ -1815,10 +1825,10 @@
int contains_nasty_metachars(char *str){
int result;

- if(str==NULL)
+ if(str==NULL || !Nasty_Metachars[0])
return FALSE;

- result=strcspn(str,NASTY_METACHARS);
+ result=strcspn(str,Nasty_Metachars);
if(result!=strlen(str))
return TRUE;


--------------050805040206030503070006--





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked