[nagios-plugins] Fix for SSL Versioning when multiple options are ...
Git Repository
git at nagios-plugins.org
Fri Dec 20 17:50:06 CET 2013
Module: nagios-plugins
Branch: maint
Commit: cadf0d7ba866e004b409d165f4ac2391fe8b6b7c
Author: Joseph Gooch <mrwizard at k12system.com>
Committer: Holger Weiss <holger at zedat.fu-berlin.de>
Date: Fri Dec 20 07:46:20 2013 -0500
URL: https://www.nagios-plugins.org/repositories/nagios-plugins/commit/?id=cadf0d7
Fix for SSL Versioning when multiple options are used.
If you specify -S1 -C 30... The -C option will reset the ssl_version to 0. This is not a good thing.
Instead we set the default to 0 and retain the version when later args are passed.
---
plugins/check_http.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 1595a59..4eba4b6 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -57,7 +57,7 @@ enum {
#ifdef HAVE_SSL
int check_cert = FALSE;
-int ssl_version;
+int ssl_version = 0;
int days_till_exp_warn, days_till_exp_crit;
char *randbuff;
X509 *server_cert;
@@ -339,10 +339,10 @@ process_arguments (int argc, char **argv)
case 'S': /* use SSL */
#ifdef HAVE_SSL
enable_ssl:
+ /* ssl_version initialized to 0 as a default. Only set if it's non-zero. This helps when we include multiple
+ parameters, like -S and -C combinations */
use_ssl = TRUE;
- if (optarg == NULL || c != 'S')
- ssl_version = 0;
- else {
+ if (c=='S' && optarg != NULL) {
ssl_version = atoi(optarg);
if (ssl_version < 1 || ssl_version > 3)
usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)"));
More information about the Commits
mailing list