From a2a279e262ef341b95fe2511d7164cbc60f6b026 Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Thu, 23 Dec 2010 11:40:20 -0500 Subject: Fix check_ldap overriding the port when --ssl was specified after -p --- plugins/check_ldap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index b933ff28..726ffa64 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 (); } -- cgit v1.2.3