diff options
author | Jan Wagner <waja@cyconet.org> | 2013-07-11 12:11:09 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-06 08:55:49 (GMT) |
commit | b6f0e755fda5d95ccc7312fd4c99e1e707210d6c (patch) | |
tree | 45a6297814e976a20e3a6da236517a201025ce4d | |
parent | bfe68d84f78c12f55e996e43201d280802de7984 (diff) | |
download | monitoring-plugins-b6f0e755fda5d95ccc7312fd4c99e1e707210d6c.tar.gz |
Fixed SF.net bug 2555775, threshold can be double for check_smtp
Thanks to Roman Fiedler for reporting the issue and providing a fix
-rw-r--r-- | THANKS.in | 1 | ||||
-rw-r--r-- | plugins/check_smtp.c | 26 |
2 files changed, 13 insertions, 14 deletions
@@ -281,3 +281,4 @@ Brian De Wolf | |||
281 | Richard Leitner | 281 | Richard Leitner |
282 | Diego Elio Pettenò | 282 | Diego Elio Pettenò |
283 | Vaclav Ovsik | 283 | Vaclav Ovsik |
284 | Roman Fiedler | ||
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 79fa482..d477a51 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
@@ -99,9 +99,9 @@ char **responses = NULL; | |||
99 | char *authtype = NULL; | 99 | char *authtype = NULL; |
100 | char *authuser = NULL; | 100 | char *authuser = NULL; |
101 | char *authpass = NULL; | 101 | char *authpass = NULL; |
102 | int warning_time = 0; | 102 | double warning_time = 0; |
103 | int check_warning_time = FALSE; | 103 | int check_warning_time = FALSE; |
104 | int critical_time = 0; | 104 | double critical_time = 0; |
105 | int check_critical_time = FALSE; | 105 | int check_critical_time = FALSE; |
106 | int verbose = 0; | 106 | int verbose = 0; |
107 | int use_ssl = FALSE; | 107 | int use_ssl = FALSE; |
@@ -417,9 +417,9 @@ main (int argc, char **argv) | |||
417 | elapsed_time = (double)microsec / 1.0e6; | 417 | elapsed_time = (double)microsec / 1.0e6; |
418 | 418 | ||
419 | if (result == STATE_OK) { | 419 | if (result == STATE_OK) { |
420 | if (check_critical_time && elapsed_time > (double) critical_time) | 420 | if (check_critical_time && elapsed_time > critical_time) |
421 | result = STATE_CRITICAL; | 421 | result = STATE_CRITICAL; |
422 | else if (check_warning_time && elapsed_time > (double) warning_time) | 422 | else if (check_warning_time && elapsed_time > warning_time) |
423 | result = STATE_WARNING; | 423 | result = STATE_WARNING; |
424 | } | 424 | } |
425 | 425 | ||
@@ -552,21 +552,19 @@ process_arguments (int argc, char **argv) | |||
552 | nresponses++; | 552 | nresponses++; |
553 | break; | 553 | break; |
554 | case 'c': /* critical time threshold */ | 554 | case 'c': /* critical time threshold */ |
555 | if (is_intnonneg (optarg)) { | 555 | if (!is_nonnegative (optarg)) |
556 | critical_time = atoi (optarg); | 556 | usage4 (_("Critical time must be a positive")); |
557 | check_critical_time = TRUE; | ||
558 | } | ||
559 | else { | 557 | else { |
560 | usage4 (_("Critical time must be a positive integer")); | 558 | critical_time = strtod (optarg, NULL); |
559 | check_critical_time = TRUE; | ||
561 | } | 560 | } |
562 | break; | 561 | break; |
563 | case 'w': /* warning time threshold */ | 562 | case 'w': /* warning time threshold */ |
564 | if (is_intnonneg (optarg)) { | 563 | if (!is_nonnegative (optarg)) |
565 | warning_time = atoi (optarg); | 564 | usage4 (_("Warning time must be a positive")); |
566 | check_warning_time = TRUE; | ||
567 | } | ||
568 | else { | 565 | else { |
569 | usage4 (_("Warning time must be a positive integer")); | 566 | warning_time = strtod (optarg, NULL); |
567 | check_warning_time = TRUE; | ||
570 | } | 568 | } |
571 | break; | 569 | break; |
572 | case 'v': /* verbose */ | 570 | case 'v': /* verbose */ |