Hi Willy,

Thanks Pieter.

Patch validated on my side.
I updated the patch with backport information.

Baptiste
From 83f908683a137b3e947e7d12b7e90f1b4a22db58 Mon Sep 17 00:00:00 2001
From: Pieter Baauw <piba.nl....@gmail.com>
Date: Sat, 13 Feb 2016 15:51:58 +0100
Subject: [PATCH 3/4] MEDIUM: dns: resolvers, cfgparse, do not allow 'timeout retry'
 to be misspelled

Backport: 1.6 and above

---
 src/cfgparse.c | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/cfgparse.c b/src/cfgparse.c
index 9dcae48..b6e3e2b 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -2366,23 +2366,37 @@ int cfg_parse_resolvers(const char *file, int linenum, char **args, int kwm)
 		curr_resolvers->resolve_retries = atoi(args[1]);
 	}
 	else if (strcmp(args[0], "timeout") == 0) {
-		const char *res;
-		unsigned int timeout_retry;
-
-		if (!*args[2]) {
+		if (!*args[1]) {
 			Alert("parsing [%s:%d] : '%s' expects 'retry' and <time> as arguments.\n",
 				file, linenum, args[0]);
 			err_code |= ERR_ALERT | ERR_FATAL;
 			goto out;
 		}
-		res = parse_time_err(args[2], &timeout_retry, TIME_UNIT_MS);
-		if (res) {
-			Alert("parsing [%s:%d]: unexpected character '%c' in argument to <%s>.\n",
-				file, linenum, *res, args[0]);
+		else if (strcmp(args[1], "retry") == 0) {
+			const char *res;
+			unsigned int timeout_retry;
+
+			if (!*args[2]) {
+				Alert("parsing [%s:%d] : '%s %s' expects <time> as argument.\n",
+					file, linenum, args[0], args[1]);
+				err_code |= ERR_ALERT | ERR_FATAL;
+				goto out;
+			}
+			res = parse_time_err(args[2], &timeout_retry, TIME_UNIT_MS);
+			if (res) {
+				Alert("parsing [%s:%d]: unexpected character '%c' in argument to <%s %s>.\n",
+					file, linenum, *res, args[0], args[1]);
+				err_code |= ERR_ALERT | ERR_FATAL;
+				goto out;
+			}
+			curr_resolvers->timeout.retry = timeout_retry;
+		}
+		else {
+			Alert("parsing [%s:%d] : '%s' expects 'retry' and <time> as arguments got '%s'.\n",
+				file, linenum, args[0], args[1]);
 			err_code |= ERR_ALERT | ERR_FATAL;
 			goto out;
 		}
-		curr_resolvers->timeout.retry = timeout_retry;
 	} /* neither "nameserver" nor "resolvers" */
 	else if (*args[0] != 0) {
 		Alert("parsing [%s:%d] : unknown keyword '%s' in '%s' section\n", file, linenum, args[0], cursection);
-- 
2.7.0.windows.1

Reply via email to