summaryrefslogtreecommitdiffstats
path: root/lib/hostcheck.c
diff options
context:
space:
mode:
authorCurl Upstream <curl-library@cool.haxx.se>2021-09-14 07:02:52 (GMT)
committerBrad King <brad.king@kitware.com>2021-09-15 19:28:31 (GMT)
commit386467c9dc939cd20711c451dd7d60341fd0e802 (patch)
tree73d1b75e65ec941fff25153f1a10b88dee1e6c2c /lib/hostcheck.c
parent18b2a8d7604f3aced9c93220806851f96e231f36 (diff)
downloadCMake-386467c9dc939cd20711c451dd7d60341fd0e802.zip
CMake-386467c9dc939cd20711c451dd7d60341fd0e802.tar.gz
CMake-386467c9dc939cd20711c451dd7d60341fd0e802.tar.bz2
curl 2021-09-14 (8e82f2a0)
Code extracted from: https://github.com/curl/curl.git at commit 8e82f2a04a238c54ba91e553e9a8452e6d405965 (curl-7_79_0).
Diffstat (limited to 'lib/hostcheck.c')
-rw-r--r--lib/hostcheck.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/hostcheck.c b/lib/hostcheck.c
index 49dbab3..cf267a7 100644
--- a/lib/hostcheck.c
+++ b/lib/hostcheck.c
@@ -36,7 +36,7 @@
#include "hostcheck.h"
#include "strcase.h"
-#include "inet_pton.h"
+#include "hostip.h"
#include "curl_memory.h"
/* The last #include file should be: */
@@ -67,10 +67,6 @@ static int hostmatch(char *hostname, char *pattern)
const char *pattern_label_end, *pattern_wildcard, *hostname_label_end;
int wildcard_enabled;
size_t prefixlen, suffixlen;
- struct in_addr ignored;
-#ifdef ENABLE_IPV6
- struct sockaddr_in6 si6;
-#endif
/* normalize pattern and hostname by stripping off trailing dots */
size_t len = strlen(hostname);
@@ -86,12 +82,8 @@ static int hostmatch(char *hostname, char *pattern)
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
/* detect IP address as hostname and fail the match if so */
- if(Curl_inet_pton(AF_INET, hostname, &ignored) > 0)
- return CURL_HOST_NOMATCH;
-#ifdef ENABLE_IPV6
- if(Curl_inet_pton(AF_INET6, hostname, &si6.sin6_addr) > 0)
+ if(Curl_host_is_ipnum(hostname))
return CURL_HOST_NOMATCH;
-#endif
/* We require at least 2 dots in pattern to avoid too wide wildcard
match. */