[nagiosplug] Fixed SF.net bug 2555775, threshold can be double ...
"Nagios Plugin Development" <[email protected]> Tue, 6 Aug 2013 09:00:39 +0000
| Newsgroups | gmane.network.nagios.plugins.cvs |
|---|---|
| Message-ID | <[email protected]> |
Module: nagiosplug
Branch: master
Commit: b6f0e755fda5d95ccc7312fd4c99e1e707210d6c
Author: Jan Wagner <[email protected]>
Committer: Holger Weiss <[email protected]>
Date: Thu Jul 11 14:11:09 2013 +0200
URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=b6f0e75
Fixed SF.net bug 2555775, threshold can be double for check_smtp
Thanks to Roman Fiedler for reporting the issue and providing a fix
---
THANKS.in | 1 +
plugins/check_smtp.c | 26 ++++++++++++--------------
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/THANKS.in b/THANKS.in
index ae4ea94..9fdd882 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -281,3 +281,4 @@ Brian De Wolf
Richard Leitner
Diego Elio Pettenò
Vaclav Ovsik
+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;
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 */
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Nagiosplug-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagiosplug-checkins