[Dnssec-trigger] [PATCH] Allow strings longer than 2 characters for the HTTP probe

Tomas Hozza thozza at redhat.com
Mon Mar 6 11:11:55 UTC 2017


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)
-- 
2.7.4




More information about the dnssec-trigger mailing list