summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 288b742)
raw | patch | inline | side by side (parent: 288b742)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Sat, 8 Nov 2008 02:32:03 +0000 (02:32 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Sat, 8 Nov 2008 02:32:03 +0000 (02:32 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2076 f882894a-f735-0410-b71e-b25c423dba1c
NEWS | patch | blob | history | |
THANKS.in | patch | blob | history | |
plugins/check_http.c | patch | blob | history | |
plugins/tests/check_http.t | patch | blob | history |
index 01e8663a69753806d3cf51d25d812ee0846bf1bb..670e47665cabbc6ebeae747ca8819e6ba66071f1 100644 (file)
--- a/NEWS
+++ b/NEWS
Fixed segfault in extra-opts under some circumstance when reading multiple sections
Fix long options parsing in check_tcp
check_icmp now reports min and max round trip time perfdata (Steve Rader)
+ Fixed bug where additional headers with redirection caused a segfault (Dieter Van de Walle - 2089159)
1.4.13 25th Sept 2008
Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)
diff --git a/THANKS.in b/THANKS.in
index b042f9e77b803b7ac4dbfacd908a0b85813233df..1835e614e5d184ed42afdf92ef541982e62e3dd6 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
Tilman Koschnick
Olivier 'Babar' Raginel
Steve Rader
+Dieter Van de Walle
diff --git a/plugins/check_http.c b/plugins/check_http.c
index df5daf2d99448e31533046d464adf68d57d3bc96..0746741c186d774837f3ec83c76896e619802696 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
for ((pos = strtok(http_opt_headers[i], INPUT_DELIMITER)); pos; (pos = strtok(NULL, INPUT_DELIMITER)))
asprintf (&buf, "%s%s\r\n", buf, pos);
}
- free(http_opt_headers);
+ /* This cannot be free'd here because a redirection will then try to access this and segfault */
+ /* Covered in a testcase in tests/check_http.t */
+ /* free(http_opt_headers); */
}
/* optionally send the authentication info */
index d54932e681e9b840ede388acc24a4ef1675251d6..c5f90803b04ada4ad2ed42a61df0e824eaf2ce40 100755 (executable)
#print "child\n";
my $d = HTTP::Daemon->new(
- LocalPort => $port
+ LocalPort => $port,
+ LocalAddr => "127.0.0.1",
) || die;
print "Please contact me at: <URL:", $d->url, ">\n";
while (my $c = $d->accept ) {
$c->send_basic_header;
$c->send_crlf;
$c->send_response($r->method.":".$r->content);
+ } elsif ($r->url->path eq "/redirect") {
+ $c->send_redirect( "/redirect2" );
+ } elsif ($r->url->path eq "/redirect2") {
+ $c->send_basic_header;
+ $c->send_crlf;
+ $c->send_response("redirected");
} else {
$c->send_error(RC_FORBIDDEN);
}
}
if (-x "./check_http") {
- plan tests => 39;
+ plan tests => 47;
} else {
plan skip_all => "No check_http compiled";
}
is( $result->return_code, 0, $cmd);
like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - ([\d\.]+) second/', "Output correct: ".$result->output );
+$cmd = "$command -u /redirect";
+$result = NPTest->testCmd( $cmd );
+is( $result->return_code, 0, $cmd);
+like( $result->output, '/^HTTP OK - HTTP/1.1 301 Moved Permanently - [\d\.]+ second/', "Output correct: ".$result->output );
+
+$cmd = "$command -f follow -u /redirect";
+$result = NPTest->testCmd( $cmd );
+is( $result->return_code, 0, $cmd);
+like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 183 bytes in [\d\.]+ second/', "Output correct: ".$result->output );
+
+$cmd = "$command -u /redirect -k 'follow: me'";
+$result = NPTest->testCmd( $cmd );
+is( $result->return_code, 0, $cmd);
+like( $result->output, '/^HTTP OK - HTTP/1.1 301 Moved Permanently - [\d\.]+ second/', "Output correct: ".$result->output );
+
+$cmd = "$command -f follow -u /redirect -k 'follow: me'";
+$result = NPTest->testCmd( $cmd );
+is( $result->return_code, 0, $cmd);
+like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 183 bytes in [\d\.]+ second/', "Output correct: ".$result->output );
+