[Pkg-nagios-devel] Bug#399532: Segfault on using check_radius plugin (tests with freeradius)!

Yasper Casper komputnik at gmail.com
Mon Nov 20 13:49:08 CET 2006


Package: nagios-plugins
Priority: extra
Section: net
Architecture: amd64
Version: 1.4.4-1

Hello. check_radius plugin segfaults on invocation with commandline:
/usr/lib/nagios/plugins/check_radius -F /etc/radiusclient/radiusclient.conf
-u test -p test -H localhost -t 10 -P 1812

Debug with strace:
open("/etc/radiusclient/dictionary", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=7329, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2abbf6c0e000
read(3, "#\n# Updated 97/06/13 to livingst"..., 4096) = 4096
read(3, "\tCallback-Framed-User\t4\nVALUE\t\tS"..., 4096) = 3233
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x2abbf6c0e000, 4096)            = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

The problem is that neither valuepair data nor data_send are initialized.
So my patch works: (dpatch).

#! /bin/sh /usr/share/dpatch/dpatch-run
## 26-check_radius.dpatch by  <Yasper Casper <komputnik at gmail.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
--- nagios-plugins-1.4.4/plugins/check_radius.c 2006-06-20 13:17:
02.000000000 +0200
+++ /var/cache/apt-build/build/nagios-plugins-1.4.4/plugins/check_radius.c
2006-11-20 12:22:46.000000000 +0100
@@ -134,6 +134,14 @@
                        rc_read_dictionary (rc_conf_str (str)))
                die (STATE_UNKNOWN, _("Config file error"));

+       /*Initialize Value Pair to prevent segfault on rc_avpair_add.
+       * debugging on radiuslib-ng show that the mem isn't allocated,
+       * and some random memory is in the USER-PASSWORD pair.
+       * So, after initialization, the password is filled with the correct
values
+       */
+       data.send_pairs = NULL;
+       data.receive_pairs = NULL;
+
        service = PW_AUTHENTICATE_ONLY;

        if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0)
&&


Rgds. Y.a.s.p.e.r C.a.s.p.e.r
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/pkg-nagios-devel/attachments/20061120/881eaa79/attachment.html


More information about the Pkg-nagios-devel mailing list