Displaying 1 result from an estimated 1 matches for "likely_address".
2003 Jul 05
2
Unhelpful error message when matching hosts in access list [PATCH]
...quot;malformed address %s\n", tok);
+ rprintf(FERROR,
+ "error matching address %s: %s\n",
+ tok,
+ gai_strerror(gai));
freeaddrinfo(resa);
return 0;
}
@@ -192,6 +195,18 @@
return ret;
}
+/* Test if a string is likely to be an (IPv4 or IPv6) address */
+static int likely_address(char *s)
+{
+ size_t len = strlen(s);
+
+ return ((strspn(s, ".0123456789") == len)
+#ifdef INET6
+ || (strspn(s, ":0123456789ABCDEFabcdef") == len)
+#endif
+ );
+}
+
static int access_match(char *list, char *addr, char *host)
{
char *tok;
@@ -203,7 +218,9 @@
if (h...