[nagiosplug] Fix check_ldap overriding the port when --ssl was ...

Thomas Guyot-Sionnest dermoth at users.sourceforge.net
Thu Dec 23 17:41:06 CET 2010


 Module: nagiosplug
 Branch: master
 Commit: a2a279e262ef341b95fe2511d7164cbc60f6b026
 Author: Thomas Guyot-Sionnest <dermoth at aei.ca>
   Date: Thu Dec 23 11:40:20 2010 -0500
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=a2a279e

Fix check_ldap overriding the port when --ssl was specified after -p

---

 NEWS                 |    3 ++-
 plugins/check_ldap.c |    8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index c352995..e002133 100644
--- a/NEWS
+++ b/NEWS
@@ -8,7 +8,8 @@ This file documents the major additions and syntax changes between releases.
 	FIXES
 	Fix check_disk free space calculation if blocksizes differ within a disk group (Bekar - #2973603)
 	check_disk_smb now handles NT_STATUS_ACCESS_DENIED properly (Debian #601696) 
-	Make check_snmp work more like v1.4.14 with regard to using special values (Timeticks, STRING) as numeric thresholds.
+	Make check_snmp work more like v1.4.14 with regard to using special values (Timeticks, STRING) as numeric thresholds
+	Fix check_ldap overriding the port when --ssl was specified after -p
 
 1.4.15 27th July 2010
 	ENHANCEMENTS
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index b933ff2..726ffa6 100644
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
@@ -58,7 +58,7 @@ char *ld_host = NULL;
 char *ld_base = NULL;
 char *ld_passwd = NULL;
 char *ld_binddn = NULL;
-int ld_port = DEFAULT_PORT;
+int ld_port = -1;
 #ifdef HAVE_LDAP_SET_OPTION
 int ld_protocol = DEFAULT_PROTOCOL;
 #endif
@@ -341,7 +341,8 @@ process_arguments (int argc, char **argv)
 		case 'S':
 			if (! starttls) {
 				ssl_on_connect = TRUE;
-				ld_port = LDAPS_PORT;
+				if (ld_port == -1)
+					ld_port = LDAPS_PORT;
 			} else
 				usage_va(_("%s cannot be combined with %s"), "-S/--ssl", "-T/--starttls");
 			break;
@@ -364,6 +365,9 @@ process_arguments (int argc, char **argv)
 	if (ld_base == NULL && argv[c])
 		ld_base = strdup (argv[c++]);
 
+	if (ld_port == -1)
+		ld_port = DEFAULT_PORT;
+
 	return validate_arguments ();
 }
 





More information about the Commits mailing list