From 59e8d1710a8f03a95513557b3feef20db2a2bd34 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Wed, 28 Oct 2020 10:46:23 +0000 Subject: [PATCH] proxy_gethostbyname(): fix failure to omit DNS lookup for ipv4 addrs gethostbyname() is specified to transform simple numeric ipv4 addresses into their binary form. since proxy_gethostbyname() was used as a backend for all resolver functions, somehow we assumed the check for an ipv4 was done from another site, however this didn't hold true when the caller used gethostbyname() directly. fixes #347 --- src/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core.c b/src/core.c index 4226a7e..59d07de 100644 --- a/src/core.c +++ b/src/core.c @@ -849,6 +849,11 @@ struct hostent *proxy_gethostbyname(const char *name, struct gethostbyname_data* data->hostent_space.h_addrtype = AF_INET; data->hostent_space.h_length = sizeof(in_addr_t); + if(pc_isnumericipv4(name)) { + data->resolved_addr = inet_addr(name); + goto retname; + } + gethostname(buff, sizeof(buff)); if(!strcmp(buff, name)) {