[Pkg-nagios-devel] Bug#480001: nagios3: spurious dollar signs added to command_lines

Stephane Chazelas stephane at artesyncp.com
Wed May 7 13:19:52 UTC 2008


Package: nagios3
Version: 3.0.1-1
Severity: normal
Tags: patch


Hiya,

In the definition of a "command" object such as:

define command{
	command_name	my_test
	command_line	echo '$xxx'
	}

If the "command_line" contains an odd number of "$'s", then
nagios adds an extra one.

For instance, in the above example, the command becomes
echo '$xxx'$

And the output of a service based on that "command" becomes
"$xxx$" instead "$xxx".

It can have more severe impacts than that.

Fix:

--- common/macros.c-before-fix-extra-dollar	2008-05-07 14:03:35.000000000 +0100
+++ common/macros.c	2008-05-07 14:03:41.000000000 +0100
@@ -195,7 +195,8 @@ int process_macros(char *input_buffer, c
 				*output_buffer=(char *)realloc(*output_buffer,strlen(*output_buffer)+strlen(temp_buffer)+3);
 				strcat(*output_buffer,"$");
 				strcat(*output_buffer,temp_buffer);
-				strcat(*output_buffer,"$");
+				if (buf_ptr!=NULL)
+					strcat(*output_buffer,"$");
 				}
 
 			/* insert macro */


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.24.2
Locale: LANG=en_GB.ISO-8859-15, LC_CTYPE=en_GB.ISO-8859-15 (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages nagios3 depends on:
ii  libc6                  2.7-10            GNU C Library: Shared libraries
ii  libgd1-noxpm           1.8.4.debian-1    GD Graphics Library (old version, 
ii  libglib2.0-0           2.16.3-2          The GLib library of C routines
ii  libjpeg62              6b-14             The Independent JPEG Group's JPEG 
ii  libltdl3               1.5.26-3          A system independent dlopen wrappe
ii  libperl5.8             5.8.8-12          Shared Perl library
ii  libpng12-0             1.2.26-1          PNG library - runtime
ii  nagios3-common         3.0.1-1           support files for nagios3
ii  perl                   5.8.8-12          Larry Wall's Practical Extraction 
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

nagios3 recommends no packages.

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff
Type: text/x-c
Size: 492 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-nagios-devel/attachments/20080507/b12cb4ea/attachment.bin 


More information about the Pkg-nagios-devel mailing list