NRPE patch for metachars

Stephen Carpenter scarpe01 at tufts.edu
Tue Aug 3 17:35:05 CEST 2004


I noticed a bit ago someone else had the same problem I did: trying
to pass a perl regular expression to a check failed due to a rather
paranoid restriction in NRPE.

I submitted a patch to nagios at nagios.org a while ago but heard
nothing, so I figure maybe sending it to this list will help someone.
I have added a new config option:

allow_metachars=1

This and command line arguments has vastly simplified my life.

=== Allow Metachars Patch ===
here is the patch:
RCS file: /usr/local/cvsroot/build/nrpe2/src/src/nrpe.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- nrpe.c      29 Dec 2003 17:30:05 -0000      1.1
+++ nrpe.c      24 Jun 2004 15:28:29 -0000      1.2
@@ -67,6 +67,7 @@
 char    *nrpe_group=NULL;
 
 int     allow_arguments=FALSE;
+int     allow_metachars=FALSE;
 
 int     show_help=FALSE;
 int     show_license=FALSE;
@@ -381,6 +382,9 @@
                else if(!strcmp(varname,"dont_blame_nrpe"))
                        allow_arguments=(atoi(varvalue)==1)?TRUE:FALSE;
 
+               else if(!strcmp(varname,"allow_metachars"))
+                       allow_metachars=(atoi(varvalue)==1)?TRUE:FALSE;
+
                else if(!strcmp(varname,"command_timeout")){
                        command_timeout=atoi(varvalue);
                        if(command_timeout<1){
@@ -1295,7 +1299,7 @@
                }
 
        /* make sure request doesn't contain nasties */
-       if(contains_nasty_metachars(pkt->buffer)==TRUE){
+       if(! allow_metachars &&
contains_nasty_metachars(pkt->buffer)==TRUE){
                syslog(LOG_ERR,"Error: Request contained illegal
metachars!");
                return ERROR;
                }
=== END ===

-- 
"The Creation of the Universe was made possible by a grant from Texas 
Instruments. "
                -- PBS 


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list