initialize allocator thread from get_chain_data if needed

since we caved in to demands that it should be possible to allow
hostnames in the proxy list section, we now got to deal with the
fallout. the code was calling at_get... assuming that the allocator
thread is always used.
pull/348/head
rofl0r 2020-09-20 18:18:31 +01:00
parent 3dfda493d8
commit 3a5050bec2
1 changed files with 4 additions and 1 deletions

View File

@ -126,7 +126,9 @@ static int close_fds[16];
static int close_fds_cnt = 0;
static void rdns_init(void) {
at_init();
static int init_done = 0;
if(!init_done) at_init();
init_done = 1;
}
static void do_init(void) {
@ -328,6 +330,7 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
if(1 != inet_pton(host_ip->is_v6 ? AF_INET6 : AF_INET, host, host_ip->addr.v6)) {
if(*ct == STRICT_TYPE && proxychains_resolver && count > 0) {
/* we can allow dns hostnames for all but the first proxy in the list if chaintype is strict, as remote lookup can be done */
rdns_init();
ip_type4 internal_ip = at_get_ip_for_host(host, strlen(host));
pd[count].ip.is_v6 = 0;
host_ip->addr.v4 = internal_ip;