diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-11-28 12:21:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-28 12:21:08 +0100 |
| commit | db2983da7e8175ca3928998d4547acdf75d55dc0 (patch) | |
| tree | 45bbbb2e6f6cf17f8058cb5428a5f0fb43d94b94 /plugins/check_curl.d/check_curl_helpers.h | |
| parent | 2f96b82c9b67ca1aad6cd584a9c458d060bdd4bb (diff) | |
| download | monitoring-plugins-db2983da7e8175ca3928998d4547acdf75d55dc0.tar.gz | |
Fix/check curl sticky redir (#2188)
* check_curl: avoid freeing memory when we don't know where it came from
* check_curl: when using -f sticky conserve IPv6 addresses properly
When running the check on an ipv6 address with a sticky onredirect
policy like in this example:
check_curl -6 -H example.com -I ::1 -f sticky
It results in a getaddrinfo error:
HTTP CRITICAL - Unable to lookup IP address for '[::1]': getaddrinfo returned -3 - Temporary failure in name resolution
This happens because in check_http() if the content of server_addr is an
ipv6 address enclosing brackets are added and on redirection a
subsequent call to check_http() will pass this now bracketed value to
getaddrinfo resulting in the error.
To work around this, strip the brackets from the address prior to the
lookup_host() call.
* add Michael Jeanson to thanks
Diffstat (limited to 'plugins/check_curl.d/check_curl_helpers.h')
| -rw-r--r-- | plugins/check_curl.d/check_curl_helpers.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/check_curl.d/check_curl_helpers.h b/plugins/check_curl.d/check_curl_helpers.h index 87e45a9d..e7b80f7e 100644 --- a/plugins/check_curl.d/check_curl_helpers.h +++ b/plugins/check_curl.d/check_curl_helpers.h | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | # include <openssl/opensslv.h> | 7 | # include <openssl/opensslv.h> |
| 8 | #endif | 8 | #endif |
| 9 | 9 | ||
| 10 | enum { | ||
| 11 | MAX_IPV4_HOSTLENGTH = 255, | ||
| 12 | }; | ||
| 13 | |||
| 10 | /* for buffers for header and body */ | 14 | /* for buffers for header and body */ |
| 11 | typedef struct { | 15 | typedef struct { |
| 12 | size_t buflen; | 16 | size_t buflen; |
