summaryrefslogtreecommitdiffstats
path: root/plugins/check_ldap.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_ldap.c')
-rw-r--r--plugins/check_ldap.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index a1bfe1b..868ffc1 100644
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
@@ -71,9 +71,9 @@ thresholds *entries_thresholds = NULL;
71struct timeval tv; 71struct timeval tv;
72char* warn_entries = NULL; 72char* warn_entries = NULL;
73char* crit_entries = NULL; 73char* crit_entries = NULL;
74int starttls = FALSE; 74bool starttls = false;
75int ssl_on_connect = FALSE; 75bool ssl_on_connect = false;
76int verbose = 0; 76bool verbose = false;
77 77
78/* for ldap tls */ 78/* for ldap tls */
79 79
@@ -97,9 +97,6 @@ main (int argc, char *argv[])
97 int tls; 97 int tls;
98 int version=3; 98 int version=3;
99 99
100 /* for entry counting */
101
102 LDAPMessage *next_entry;
103 int status_entries = STATE_OK; 100 int status_entries = STATE_OK;
104 int num_entries = 0; 101 int num_entries = 0;
105 102
@@ -118,7 +115,7 @@ main (int argc, char *argv[])
118 usage4 (_("Could not parse arguments")); 115 usage4 (_("Could not parse arguments"));
119 116
120 if (strstr(argv[0],"check_ldaps") && ! starttls && ! ssl_on_connect) 117 if (strstr(argv[0],"check_ldaps") && ! starttls && ! ssl_on_connect)
121 starttls = TRUE; 118 starttls = true;
122 119
123 /* initialize alarm signal handling */ 120 /* initialize alarm signal handling */
124 signal (SIGALRM, socket_timeout_alarm_handler); 121 signal (SIGALRM, socket_timeout_alarm_handler);
@@ -256,11 +253,11 @@ main (int argc, char *argv[])
256 fperfdata ("time", elapsed_time, "s", 253 fperfdata ("time", elapsed_time, "s",
257 (int)warn_time, warn_time, 254 (int)warn_time, warn_time,
258 (int)crit_time, crit_time, 255 (int)crit_time, crit_time,
259 TRUE, 0, FALSE, 0), 256 true, 0, false, 0),
260 sperfdata ("entries", (double)num_entries, "", 257 sperfdata ("entries", (double)num_entries, "",
261 warn_entries, 258 warn_entries,
262 crit_entries, 259 crit_entries,
263 TRUE, 0.0, FALSE, 0.0)); 260 true, 0.0, false, 0.0));
264 } else { 261 } else {
265 printf (_("LDAP %s - %.3f seconds response time|%s\n"), 262 printf (_("LDAP %s - %.3f seconds response time|%s\n"),
266 state_text (status), 263 state_text (status),
@@ -268,7 +265,7 @@ main (int argc, char *argv[])
268 fperfdata ("time", elapsed_time, "s", 265 fperfdata ("time", elapsed_time, "s",
269 (int)warn_time, warn_time, 266 (int)warn_time, warn_time,
270 (int)crit_time, crit_time, 267 (int)crit_time, crit_time,
271 TRUE, 0, FALSE, 0)); 268 true, 0, false, 0));
272 } 269 }
273 270
274 return status; 271 return status;
@@ -316,7 +313,7 @@ process_arguments (int argc, char **argv)
316 strcpy (argv[c], "-t"); 313 strcpy (argv[c], "-t");
317 } 314 }
318 315
319 while (1) { 316 while (true) {
320 c = getopt_long (argc, argv, "hvV234TS6t:c:w:H:b:p:a:D:P:C:W:", longopts, &option); 317 c = getopt_long (argc, argv, "hvV234TS6t:c:w:H:b:p:a:D:P:C:W:", longopts, &option);
321 318
322 if (c == -1 || c == EOF) 319 if (c == -1 || c == EOF)
@@ -377,17 +374,17 @@ process_arguments (int argc, char **argv)
377 address_family = AF_INET; 374 address_family = AF_INET;
378 break; 375 break;
379 case 'v': 376 case 'v':
380 verbose++; 377 verbose = true;
381 break; 378 break;
382 case 'T': 379 case 'T':
383 if (! ssl_on_connect) 380 if (! ssl_on_connect)
384 starttls = TRUE; 381 starttls = true;
385 else 382 else
386 usage_va(_("%s cannot be combined with %s"), "-T/--starttls", "-S/--ssl"); 383 usage_va(_("%s cannot be combined with %s"), "-T/--starttls", "-S/--ssl");
387 break; 384 break;
388 case 'S': 385 case 'S':
389 if (! starttls) { 386 if (! starttls) {
390 ssl_on_connect = TRUE; 387 ssl_on_connect = true;
391 if (ld_port == -1) 388 if (ld_port == -1)
392 ld_port = LDAPS_PORT; 389 ld_port = LDAPS_PORT;
393 } else 390 } else