[Nagios-devel] Custom Object Variables: Contrary to docs,

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Custom Object Variables: Contrary to docs,

Post by Guest »

I'm trying to use special chars in "Custom Object Variables" or "Custom=20
Variable Macros" - the same concept as I under stand it.

That doesn't work. Because they are subjected to "Macro Cleansing"=20
according to "illegal_macro_output_chars" from nagios.cfg.

The doc page "Understanding Macros and How They Work"[1] gives a list of=20
macros to which "Macro Cleansing" is applied, and no custom macros are=20
mentioned. "Cleansing" is also not metioned on the "Custom Object=20
Variables"[2] page.
1: http://nagios.sourceforge.net/docs/3_0/macros.html
2: http://nagios.sourceforge.net/docs/3_0/ ... tvars.html

Applying this patch (against CVS) brings the code and executable=20
behavior in line with the documentation (tested on debian lenny): It'll=20
probably wrap here, so get it at http://pastebin.com/RR4h4eFL instead

cvs diff: Diffing .
Index: macros.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/nagios/nagios/common/macros.c,v
retrieving revision 1.37
diff -u -r1.37 macros.c
--- macros.c 6 Aug 2010 11:40:46 -0000 1.37
+++ macros.c 27 Aug 2010 12:47:40 -0000
@@ -615,16 +615,10 @@
}

/***** CUSTOM VARIABLE MACROS *****/
- else if(macro_name[0]=3D=3D'_'){
-
+ else if(macro_name[0]=3D=3D'_')
/* get the macro value */
result=3Dgrab_custom_macro_value(macro_name,arg[0],arg[1],output);

- /* custom variable values get cleaned */
- if(result=3D=3DOK)
- *clean_options|=3D(STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS);
- }
-
/* no macro matched... */
else{
#ifdef NSCORE

Any chance of this patch being accepted? If not, the documentation=20
should be updated instead! But I don't see the danger of Custom Object=20
Variables being exempt from escaping. This (bug?) has apparently been=20
there for some time, as it was introduced by:

revision 1.17 date: 2007/10/24 00:54:19;
A rather massive rewrite of the macro logic - phew!

And the first tag after this was: nagios-3-0b6. So I'm guessing it has=20
been there since the birth of the Custom Object Variables.

Peter
--=20
Peter Valdemar M=C3=B8rch
http://www.morch.com





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: ?UTF-8?B?IlBldGVyIFZhbGRlbWFyIE3DuHJjaCAoTGlzdHMpIg==?
Locked