aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Jan Wagner <waja@cyconet.org> 2013-07-11 14:11:09 +0200
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2013-08-06 10:55:49 +0200
commitb6f0e755fda5d95ccc7312fd4c99e1e707210d6c (patch)
tree45a6297814e976a20e3a6da236517a201025ce4d /plugins
parentbfe68d84f78c12f55e996e43201d280802de7984 (diff)
downloadmonitoring-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
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_smtp.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 79fa4824..d477a51e 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -99,9 +99,9 @@ char **responses = NULL;
char *authtype = NULL;
char *authuser = NULL;
char *authpass = NULL;
-int warning_time = 0;
+double warning_time = 0;
int check_warning_time = FALSE;
-int critical_time = 0;
+double critical_time = 0;
int check_critical_time = FALSE;
int verbose = 0;
int use_ssl = FALSE;
@@ -417,9 +417,9 @@ main (int argc, char **argv)
elapsed_time = (double)microsec / 1.0e6;
if (result == STATE_OK) {
- if (check_critical_time && elapsed_time > (double) critical_time)
+ if (check_critical_time && elapsed_time > critical_time)
result = STATE_CRITICAL;
- else if (check_warning_time && elapsed_time > (double) warning_time)
+ else if (check_warning_time && elapsed_time > warning_time)
result = STATE_WARNING;
}
@@ -552,21 +552,19 @@ process_arguments (int argc, char **argv)
nresponses++;
break;
case 'c': /* critical time threshold */
- if (is_intnonneg (optarg)) {
- critical_time = atoi (optarg);
- check_critical_time = TRUE;
- }
+ if (!is_nonnegative (optarg))
+ usage4 (_("Critical time must be a positive"));
else {
- usage4 (_("Critical time must be a positive integer"));
+ critical_time = strtod (optarg, NULL);
+ check_critical_time = TRUE;
}
break;
case 'w': /* warning time threshold */
- if (is_intnonneg (optarg)) {
- warning_time = atoi (optarg);
- check_warning_time = TRUE;
- }
+ if (!is_nonnegative (optarg))
+ usage4 (_("Warning time must be a positive"));
else {
- usage4 (_("Warning time must be a positive integer"));
+ warning_time = strtod (optarg, NULL);
+ check_warning_time = TRUE;
}
break;
case 'v': /* verbose */