aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--plugins/check_nt.c3
-rwxr-xr-xplugins/tests/check_nt.t5
3 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index e9e24a78..932b2174 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ This file documents the major additions and syntax changes between releases.
check_http --onredirect=sticky follows using the same IP address (sf.net #2550208)
check_http --onredirect=stickyport also follows the same port
Fixed coredump from check_nt when invalid drive is specified (#2179754 - Olli Hauer)
+ Fixed crash from check_nt when -H unspecified or given multiple times (sf.net #2731755, debian #521097)
Fixed passing of quotes in OID for check_snmp (#1985230 - Jan Wagner, patch by John Barbuto)
Fixed check_http sending HTTP/1.0 with v1.1 headers (#2638765)
Fixed check_http not timing-out on redirects
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index ec944e4c..d038efe7 100644
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
@@ -522,7 +522,6 @@ int process_arguments(int argc, char **argv){
print_revision(progname, NP_VERSION);
exit(STATE_OK);
case 'H': /* hostname */
- if (server_address) free(server_address);
server_address = optarg;
break;
case 's': /* password */
@@ -585,6 +584,8 @@ int process_arguments(int argc, char **argv){
}
}
+ if (server_address == NULL)
+ usage4 (_("You must provide a server address or host name"));
if (vars_to_check==CHECK_NONE)
return ERROR;
diff --git a/plugins/tests/check_nt.t b/plugins/tests/check_nt.t
index d1600c77..223d4933 100755
--- a/plugins/tests/check_nt.t
+++ b/plugins/tests/check_nt.t
@@ -59,7 +59,7 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
}
if (-x "./check_nt") {
- plan tests => 4;
+ plan tests => 5;
} else {
plan skip_all => "No check_nt compiled";
}
@@ -75,3 +75,6 @@ $result = NPTest->testCmd( "$command -v USEDDISKSPACE -l d" );
is( $result->return_code, 3, "USEDDISKSPACE d - invalid");
is( $result->output, "Free disk space : Invalid drive", "Output right" );
+$result = NPTest->testCmd( "./check_nt -v USEDDISKSPACE -l d" );
+is( $result->return_code, 3, "Fail if -H missing");
+