[Pkg-nagios-devel] Bug#479984: nagios-plugins: check_ldap doesn't allow empty bases

Stephane Chazelas stephane at artesyncp.com
Wed May 7 10:43:54 UTC 2008


Package: nagios-plugins
Version: 1.4.11-2
Severity: normal


Hiya,

$ /usr/lib/nagios/plugins/check_ldap -H localhost -b ''
check_ldap: Please specify the LDAP base

doesn't work.

For me, a check with an empty base seems like the most obvious
thing to do.

So I don't understand why it is explicitely disallowed in the
code (note that the error message is also confusing)

A simple fix:

--- plugins/check_ldap.c-before-base-fix	2008-05-07 11:32:13.000000000 +0100
+++ plugins/check_ldap.c	2008-05-07 11:34:50.000000000 +0100
@@ -374,7 +374,7 @@ validate_arguments ()
 	if (ld_host==NULL || strlen(ld_host)==0)
 		usage4 (_("Please specify the host name\n"));
 
-	if (ld_base==NULL || strlen(ld_base)==0)
+	if (ld_base == NULL)
 		usage4 (_("Please specify the LDAP base\n"));
 
 	return OK;


The similar check for strlen(ld_host) could be removed as well,
because if ld_host is "", it's because the user specified -H '',
so did specify the hostname, so that the error message is
misleading.

-- 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 nagios-plugins depends on:
ii  nagios-plugins-basic          1.4.11-2   Plugins for the nagios network mon
ii  nagios-plugins-standard       1.4.11-2   Plugins for the nagios network mon

nagios-plugins recommends no packages.

-- no debconf information
-------------- next part --------------
--- plugins/check_ldap.c-before-base-fix	2008-05-07 11:32:13.000000000 +0100
+++ plugins/check_ldap.c	2008-05-07 11:34:50.000000000 +0100
@@ -374,7 +374,7 @@ validate_arguments ()
 	if (ld_host==NULL || strlen(ld_host)==0)
 		usage4 (_("Please specify the host name\n"));
 
-	if (ld_base==NULL || strlen(ld_base)==0)
+	if (ld_base == NULL)
 		usage4 (_("Please specify the LDAP base\n"));
 
 	return OK;


More information about the Pkg-nagios-devel mailing list