From: Aki Tuomi Date: Tue, 29 Mar 2022 12:20:38 +0000 (+0300) Subject: lib: net - Remove is_ipv4_address() and is_ipv6_address() X-Git-Tag: 2.4.0~4135 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ff79606556217f98c26337be7248da2b95d416c;p=thirdparty%2Fdovecot%2Fcore.git lib: net - Remove is_ipv4_address() and is_ipv6_address() Nothing is using these anymore. --- diff --git a/src/lib/net.c b/src/lib/net.c index c318387cd6..981e690952 100644 --- a/src/lib/net.c +++ b/src/lib/net.c @@ -1169,37 +1169,6 @@ const char *net_getservbyport(in_port_t port) return entry == NULL ? NULL : entry->s_name; } -bool is_ipv4_address(const char *addr) -{ - while (*addr != '\0') { - if (*addr != '.' && !i_isdigit(*addr)) - return FALSE; - addr++; - } - - return TRUE; -} - -bool is_ipv6_address(const char *addr) -{ - bool have_prefix = FALSE; - - if (*addr == '[') { - have_prefix = TRUE; - addr++; - } - while (*addr != '\0') { - if (*addr != ':' && !i_isxdigit(*addr)) { - if (have_prefix && *addr == ']' && addr[1] == '\0') - break; - return FALSE; - } - addr++; - } - - return TRUE; -} - int net_parse_range(const char *network, struct ip_addr *ip_r, unsigned int *bits_r) { diff --git a/src/lib/net.h b/src/lib/net.h index 474cf5b432..9d7f768457 100644 --- a/src/lib/net.h +++ b/src/lib/net.h @@ -184,9 +184,6 @@ int net_geterror(int fd); /* Get name of TCP service */ const char *net_getservbyport(in_port_t port) ATTR_CONST; -bool is_ipv4_address(const char *addr) ATTR_PURE; -bool is_ipv6_address(const char *addr) ATTR_PURE; - /* Parse network as ip/bits. Returns 0 if successful, -1 if invalid input. */ int net_parse_range(const char *network, struct ip_addr *ip_r, unsigned int *bits_r);