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
pull/356/head
rofl0r 2020-10-28 10:46:23 +00:00
parent 452830283c
commit 59e8d1710a
1 changed files with 5 additions and 0 deletions

View File

@ -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)) {