Double escaping in $ARGx$
Ton Voon
ton.voon at opsera.com
Sat Sep 12 01:50:50 CEST 2009
On 10 Aug 2009, at 23:14, Ton Voon wrote:
> Can I propose that we have a new nagios.cfg option called
> "use_backward_compatible_arg_escaping". This will default to 1 on
> configurations that do not have this set. However, new installs will
> have this configured in nagios.cfg to 0, so new systems can benefit
> from more obvious arguments, while older systems from a straight
> upgrade will work as is.
>
> I think the change for the sample nagios.cfg will be:
>
> # This option controls the argument escaping for host/service
> check_command definitions. Only the exclamation mark (!) will
> # require escaping - everything else is passed through "as-is" to
> the check command definition. This simplifies situations where
> # there are other escaped characters (such as \ or $). Macros are
> passed "as-is" to the check command definition but will be expanded
> # when expanding the check command
> # If you are upgrading, you should set this to 1 to retain existing
> behaviour
> # The default option is 1 if this parameter is not set
> use_backwards_compatible_arg_escaping=0
>
> The documentation update for the main configuration variables will be:
>
> If use_backwards_compatible_arg_escaping is set to 0, this will
> avoid double escaping for arguments in a host/service check_command
> definition. For example:
>
> define command {
> command_name check_nrpe
> command_line $USER1$/check_nrpe $ARG1$
> }
>
> define service {
> ...
> check_command check_nrpe!-H windows.opsera.com -c CheckFileSize -a
> ShowAll 'File:PageFile=c:\\pagefile.sys'
> }
>
>
> With use_backward_compatible_arg_escaping=0, the command executed
> will be: check_nrpe -H windows.opsera.com -c CheckFileSize -a
> ShowAll 'File:PageFile=c:\\pagefile.sys'
>
> With use_backward_compatible_arg_escaping=1, the command executed
> will be: check_nrpe -H windows.opsera.com -c CheckFileSize -a
> ShowAll 'File:PageFile=c:\pagefile.sys'
There's been no objections to the escaping proposal above, so I will
have a go at implementing this in the next few weeks.
Andreas' suggestion about checking for shell characters and using an
execv method for non-shell commands is captured here: http://tracker.nagios.org/view.php?id=86
Thomas' suggestion about a new way of defining a check command to
force it to use the execv method is here: http://tracker.nagios.org/view.php?id=87
I'm not planning on doing either of these at the moment, so I'll leave
it for someone else to pick up.
Ton
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
More information about the Developers
mailing list