diff options
author | Matthias Eble <psychotrahe@gmx.de> | 2009-05-01 11:16:37 +0200 |
---|---|---|
committer | Matthias Eble <psychotrahe@gmx.de> | 2009-05-01 11:16:37 +0200 |
commit | 8e4c885ee1a8f057fbe550e2d5b85cc8079564df (patch) | |
tree | 2de4062cd40fb0eb506dc22091d58e263de47ff3 | |
parent | dd52d7e5e7acfd42243bc1ce173a0bf5d62fe347 (diff) | |
download | monitoring-plugins-8e4c885ee1a8f057fbe550e2d5b85cc8079564df.tar.gz |
Fixed crash from check_nt when -H unspecified or given multiple times (sf.net #2731755, debian #521097)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | plugins/check_nt.c | 3 | ||||
-rwxr-xr-x | plugins/tests/check_nt.t | 5 |
3 files changed, 7 insertions, 2 deletions
@@ -23,6 +23,7 @@ This file documents the major additions and syntax changes between releases. | |||
23 | check_http --onredirect=sticky follows using the same IP address (sf.net #2550208) | 23 | check_http --onredirect=sticky follows using the same IP address (sf.net #2550208) |
24 | check_http --onredirect=stickyport also follows the same port | 24 | check_http --onredirect=stickyport also follows the same port |
25 | Fixed coredump from check_nt when invalid drive is specified (#2179754 - Olli Hauer) | 25 | Fixed coredump from check_nt when invalid drive is specified (#2179754 - Olli Hauer) |
26 | Fixed crash from check_nt when -H unspecified or given multiple times (sf.net #2731755, debian #521097) | ||
26 | Fixed passing of quotes in OID for check_snmp (#1985230 - Jan Wagner, patch by John Barbuto) | 27 | Fixed passing of quotes in OID for check_snmp (#1985230 - Jan Wagner, patch by John Barbuto) |
27 | Fixed check_http sending HTTP/1.0 with v1.1 headers (#2638765) | 28 | Fixed check_http sending HTTP/1.0 with v1.1 headers (#2638765) |
28 | Fixed check_http not timing-out on redirects | 29 | 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){ | |||
522 | print_revision(progname, NP_VERSION); | 522 | print_revision(progname, NP_VERSION); |
523 | exit(STATE_OK); | 523 | exit(STATE_OK); |
524 | case 'H': /* hostname */ | 524 | case 'H': /* hostname */ |
525 | if (server_address) free(server_address); | ||
526 | server_address = optarg; | 525 | server_address = optarg; |
527 | break; | 526 | break; |
528 | case 's': /* password */ | 527 | case 's': /* password */ |
@@ -585,6 +584,8 @@ int process_arguments(int argc, char **argv){ | |||
585 | } | 584 | } |
586 | 585 | ||
587 | } | 586 | } |
587 | if (server_address == NULL) | ||
588 | usage4 (_("You must provide a server address or host name")); | ||
588 | 589 | ||
589 | if (vars_to_check==CHECK_NONE) | 590 | if (vars_to_check==CHECK_NONE) |
590 | return ERROR; | 591 | 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") { | |||
59 | } | 59 | } |
60 | 60 | ||
61 | if (-x "./check_nt") { | 61 | if (-x "./check_nt") { |
62 | plan tests => 4; | 62 | plan tests => 5; |
63 | } else { | 63 | } else { |
64 | plan skip_all => "No check_nt compiled"; | 64 | plan skip_all => "No check_nt compiled"; |
65 | } | 65 | } |
@@ -75,3 +75,6 @@ $result = NPTest->testCmd( "$command -v USEDDISKSPACE -l d" ); | |||
75 | is( $result->return_code, 3, "USEDDISKSPACE d - invalid"); | 75 | is( $result->return_code, 3, "USEDDISKSPACE d - invalid"); |
76 | is( $result->output, "Free disk space : Invalid drive", "Output right" ); | 76 | is( $result->output, "Free disk space : Invalid drive", "Output right" ); |
77 | 77 | ||
78 | $result = NPTest->testCmd( "./check_nt -v USEDDISKSPACE -l d" ); | ||
79 | is( $result->return_code, 3, "Fail if -H missing"); | ||
80 | |||