regression in new release of nrpe (patch included)

sean finney seanius at seanius.net
Tue Jan 24 17:55:04 CET 2006


hi ethan et al,

the latest version of nrpe introduces a regression in the config
file parsing code.  a new block of code intended to trim trailing
whitespace is a little overzealous and truncates out all whitespace
instead of remaining whitespace.

that is, something like 

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10<space>

will be parsed as

command[check_users]=/usr/lib/nagios/plugins/check_users

instead of

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10

the attached patch fixes this.


	sean

-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## 03_nrpe-trailing-whitespace.dpatch by  <seanius at debian.org>
##
## DP: fix for overzealous whitespace trimming in nrpe config reading code :)

@DPATCH@
diff -urNad nagios-nrpe-2.2~/src/nrpe.c nagios-nrpe-2.2/src/nrpe.c
--- nagios-nrpe-2.2~/src/nrpe.c	2006-01-21 20:23:36.000000000 +0100
+++ nagios-nrpe-2.2/src/nrpe.c	2006-01-24 17:50:43.000000000 +0100
@@ -307,10 +307,9 @@
 
 		/* trim trailing whitespace */
 		len=strlen(input_line);
-		for(x=len-1;x>=0;x--){
-			if(isspace(input_line[x]))
+		for(x=len-1;x>=0 && isspace(input_line[x]);x--){
 				input_line[x]='\x0';
-		        }
+		}
 
 		/* skip comments and blank lines */
 		if(input_line[0]=='#')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20060124/2dc0c44c/attachment.sig>


More information about the Developers mailing list