summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2010-12-23 11:40:20 -0500
committerThomas Guyot-Sionnest <dermoth@aei.ca>2010-12-23 11:40:20 -0500
commita2a279e262ef341b95fe2511d7164cbc60f6b026 (patch)
treee34930dcb74009637db00165fd4e39d2203f7233 /plugins
parentc49fed07c3837fb7590bd05d192d6b6f6c4ae5d4 (diff)
downloadmonitoring-plugins-a2a279e262ef341b95fe2511d7164cbc60f6b026.tar.gz
Fix check_ldap overriding the port when --ssl was specified after -p
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_ldap.c8
1 files changed, 6 insertions, 2 deletions
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;
58char *ld_base = NULL; 58char *ld_base = NULL;
59char *ld_passwd = NULL; 59char *ld_passwd = NULL;
60char *ld_binddn = NULL; 60char *ld_binddn = NULL;
61int ld_port = DEFAULT_PORT; 61int ld_port = -1;
62#ifdef HAVE_LDAP_SET_OPTION 62#ifdef HAVE_LDAP_SET_OPTION
63int ld_protocol = DEFAULT_PROTOCOL; 63int ld_protocol = DEFAULT_PROTOCOL;
64#endif 64#endif
@@ -341,7 +341,8 @@ process_arguments (int argc, char **argv)
341 case 'S': 341 case 'S':
342 if (! starttls) { 342 if (! starttls) {
343 ssl_on_connect = TRUE; 343 ssl_on_connect = TRUE;
344 ld_port = LDAPS_PORT; 344 if (ld_port == -1)
345 ld_port = LDAPS_PORT;
345 } else 346 } else
346 usage_va(_("%s cannot be combined with %s"), "-S/--ssl", "-T/--starttls"); 347 usage_va(_("%s cannot be combined with %s"), "-S/--ssl", "-T/--starttls");
347 break; 348 break;
@@ -364,6 +365,9 @@ process_arguments (int argc, char **argv)
364 if (ld_base == NULL && argv[c]) 365 if (ld_base == NULL && argv[c])
365 ld_base = strdup (argv[c++]); 366 ld_base = strdup (argv[c++]);
366 367
368 if (ld_port == -1)
369 ld_port = DEFAULT_PORT;
370
367 return validate_arguments (); 371 return validate_arguments ();
368} 372}
369 373