Nagios 4: Commands are unescaped twice

Adam James adam.james at transitiv.co.uk
Mon Jan 7 23:00:21 CET 2013


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.

Any thoughts?

Cheers,

Adam

[1] https://github.com/ageric/nagios/blob/master/lib/runcmd.c#L153
[2] https://github.com/ageric/nagios/blob/master/base/utils.c#L638
-- 
Open Source Consultant, Transitiv Technologies Ltd.

Business Critical Support and Services for Open Source Software.

T: 0203 384 7207
E: adam.james at transitiv.co.uk
W: http://www.transitiv.co.uk

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412




More information about the Developers mailing list