BUG/MINOR: tools: make parse_time_err() more strict on the timer validity

First, an error is now reported if the first character is not a digit. Thus,
"timeout client s" triggers an error now. Then 'u' is also rejected
now. 'us' is valid and should be used set the timer in microseconds. However
'u' alone is not a valid unit. It was just ignored before (default to
milliseconds). Now, it is an error. Finally, a warning is reported if the
end of the text is not reached after the timer parsing. This warning will
probably be switched to an error in a futur version.

This patch must be backported to all stable versions.

(cherry picked from commit c20ad0d8dbd1bb5707bbfe23632415c3062e046c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/tools.c b/src/tools.c
index 75dfef1..0a71122 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -2216,6 +2216,10 @@
 	unsigned long long imult, idiv;
 	unsigned long long omult, odiv;
 	unsigned long long value, result;
+	const char *str = text;
+
+	if (!isdigit((unsigned char)*text))
+		return text;
 
 	omult = odiv = 1;
 
@@ -2246,7 +2250,7 @@
 	switch (*text) {
 	case '\0': /* no unit = default unit */
 		imult = omult = idiv = odiv = 1;
-		break;
+		goto end;
 	case 's': /* second = unscaled unit */
 		break;
 	case 'u': /* microsecond : "us" */
@@ -2254,7 +2258,7 @@
 			idiv = 1000000;
 			text++;
 		}
-		break;
+		return text;
 	case 'm': /* millisecond : "ms" or minute: "m" */
 		if (text[1] == 's') {
 			idiv = 1000;
@@ -2272,7 +2276,13 @@
 		return text;
 		break;
 	}
+	if (*(++text) != '\0') {
+		ha_warning("unexpected character '%c' after the timer value '%s', only "
+			   "(us=microseconds,ms=milliseconds,s=seconds,m=minutes,h=hours,d=days) are supported."
+			   " This will be reported as an error in next versions.\n", *text, str);
+	}
 
+  end:
 	if (omult % idiv == 0) { omult /= idiv; idiv = 1; }
 	if (idiv % omult == 0) { idiv /= omult; omult = 1; }
 	if (imult % odiv == 0) { imult /= odiv; odiv = 1; }