diff options
author | rofl0r <rofl0r@users.noreply.github.com> | 2020-10-28 13:46:23 +0300 |
---|---|---|
committer | rofl0r <rofl0r@users.noreply.github.com> | 2020-10-28 14:12:17 +0300 |
commit | 59e8d1710a8f03a95513557b3feef20db2a2bd34 (patch) | |
tree | e0dc2a29129b1bd1bdb67c7ca24286620f73869a | |
parent | 452830283c081ac9a677a3e823d28575295626d9 (diff) |
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
-rw-r--r-- | src/core.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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)) { |