Page 1 of 1

Re: [Nagios-devel] Nagios 4: Commands are unescaped twice

Posted: Tue Jan 08, 2013 10:12 am
by Guest
On 01/07/2013 11:00 PM, Adam James wrote:
> Hello,
>
> Whilst doing some testing on Nagios 4 I noticed that check commands with
> arguments containing sequential backslashes are unescaped twice.
>
> In Nagios 3, the following check_command:
>
> check_nrpe!CheckCounter!ShowAll "Counter:Processor Time
> (%)=\\\\Processor(_Total)\\% Processor Time"
>
> is executed as:
>
> check_nrpe -H foobar -a CheckCounter -c 'ShowAll "Counter:Processor Time
> (%)=\\Processor(_Total)\% Processor Time"'
>
> However in Nagios 4 it is executed as:
>
> check_nrpe -H foobar -a CheckCounter -c 'ShowAll "Counter:Processor Time
> (%)=\Processor(_Total)% Processor Time"'
>
> This is due to the backslash being unescaped in base/utils.c around line
> 638 [1] and again in lib/runcmd.c around line 153 [2].
>
> I fixed this by removing the escape code in lib/runcmd.c, but I have my
> doubts about whether it is the correct solution.
>

lib/runcmd.c is the library code which shouldn't change its behaviour. The
code in utils.c should be removed instead.

On the other hand, the runcmd.c code should have a flag argument one can
use to tell it to ignore certain characters, with "ignore everything" to
be taken as "split on every whitespace-sequence and disregard quoting and
escaping entirely".

Good catch though.

--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.





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