[Dnssec-trigger] [PATCH] Allow strings longer than 2 characters for the HTTP probe
Tomas Hozza
thozza at redhat.com
Tue Jul 4 12:50:00 UTC 2017
Hello.
Is there any chance that some will review this change and ideally merge it?
Thank you.
Regards,
Tomas
On 06.03.2017 12:11, Tomas Hozza wrote:
> Previously only content of lenght 2 or less characters was allowed for
> the HTTP probe. The length was hardcoded and even if the strings from
> the configuration and from the probe matched, the result was failure.
>
> This could be reproduced e.g. with using the following line in the
> configuration:
>
> url: "http://httpstat.us/200 200 OK"
>
> Signed-off-by: Tomas Hozza <thozza at redhat.com>
> ---
> riggerd/http.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/riggerd/http.c b/riggerd/http.c
> index a08d629..b68e898 100644
> --- a/riggerd/http.c
> +++ b/riggerd/http.c
> @@ -767,11 +767,17 @@ static int
> hg_check_data(ldns_buffer* data, char* result)
> {
> char* s = (char*)ldns_buffer_begin(data);
> + size_t result_len = strlen(result);
> +
> while(isspace(*s))
> s++;
> - if(strncmp(s, result, strlen(result)) != 0)
> + if(strncmp(s, result, result_len) != 0)
> return 0;
> - s += 2;
> + /*
> + * check that there is nothing else
> + * than whitespaces after the expected string
> + */
> + s += result_len;
> while(isspace(*s))
> s++;
> if(*s != 0)
>
--
Tomas Hozza
Associate Manager, Software Engineering - EMEA ENG Mainstream RHEL
PGP: 1D9F3C2D
UTC+2 (CEST)
Red Hat Inc. http://cz.redhat.com
More information about the dnssec-trigger
mailing list