[Pkg-nagios-devel] Bug#328984: nagios-text: no way to include semicolon in object definitions

Norbert Buchmuller norbi.spam at nix.hu
Sun Sep 18 14:58:27 UTC 2005


Package: nagios-text
Version: 2:1.3-cvs.20050402-2.sarge.1
Severity: normal

Nagios truncates the value of object definition directives after the
first semicolon in the value string. I found nothing in the documentation
regarding this, neither Google gave any solution. The behaviour is
rather annoying for me as I use Perl's "-e" construct in notification
commands. It worked with the NetSaint version in Woody, so this is
a regression of some kind..

Here are the trials I made, in vain, to escape the semicolon:

# no escaping
define command {
        command_name                    test-command-1
        command_line                    /bin/echo foo; /bin/echo bar
}

# double quotes
define command {
        command_name                    test-command-2
        command_line                    /bin/echo "foo;bar"
}

# double quotes around whole value
define command {
        command_name                    test-command-3
        command_line                    "/bin/echo foo;bar"
}

# single quotes
define command {
        command_name                    test-command-4
        command_line                    /bin/echo 'foo;bar'
}

# single quotes around whole value
define command {
        command_name                    test-command-5
        command_line                    '/bin/echo foo;bar'
}

# backslash
define command {
        command_name                    test-command-6
        command_line                    /bin/echo foo\;bar
}

# dollar sign (Googlin' around I find someone suggesting this)
define command {
        command_name                    test-command-7
        command_line                    /bin/echo foo$;bar
}

# semicolon enclosed in dollar signs
define command {
        command_name                    test-command-8
        command_line                    /bin/echo foo$;$bar
}

And the values Nagios stored, as the CGI prints them:

test-command-1 	/bin/echo foo
test-command-2 	/bin/echo "foo
test-command-3 	"/bin/echo foo
test-command-4 	/bin/echo 'foo
test-command-5 	'/bin/echo foo
test-command-6 	/bin/echo foo\
test-command-7 	/bin/echo foo$
test-command-8 	/bin/echo foo$

It also applies to other object types/directives, eg.:

define service {
        use                             generic-service ; Name of service template to use

        host_name                       localhost
        service_description             TESTONLY
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        normal_check_interval           3
        retry_check_interval            1
        contact_groups                  sysadmins
        notification_interval           1440
        notification_period             24x7
        check_command                   test-command-1!foo;bar
}

Which gives the value, as printed by the CGI:

test-command-1!foo


I suppose the bug is in the xedtemplate_process_config_file() function (xdata/xedtemplate.c[175]),
but had not verified this.


Regards,

norbi


-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.27+imq+connbytes
Locale: LANG=C, LC_CTYPE=hu_HU (charmap=ISO-8859-2)

Versions of packages nagios-text depends on:
ii  libc6       2.3.2.ds1-22                 GNU C Library: Shared libraries an
ii  libgd2-xpm  2.0.33-1.1                   GD Graphics Library version 2
ii  libjpeg62   6b-10                        The Independent JPEG Group's JPEG 
ii  libpng12-0  1.2.8rel-1                   PNG library - runtime
ii  nagios-comm 2:1.3-cvs.20050402-2.sarge.1 A host/service/network monitoring 
ii  zlib1g      1:1.2.2-4.sarge.2            compression library - runtime

-- no debconf information




More information about the Pkg-nagios-devel mailing list