diff options
author | rofl0r <rofl0r@users.noreply.github.com> | 2020-09-20 20:18:31 +0300 |
---|---|---|
committer | rofl0r <rofl0r@users.noreply.github.com> | 2020-09-20 20:18:31 +0300 |
commit | 3a5050bec2823554a348e86743b0cb76e13b46fb (patch) | |
tree | 7413e2ecb24caad99a943ab81a2eb220778704a3 | |
parent | 3dfda493d8adcc4e8dba104eaba418301fd18fd6 (diff) |
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.
-rw-r--r-- | src/libproxychains.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libproxychains.c b/src/libproxychains.c index ad4809b..513351e 100644 --- a/src/libproxychains.c +++ b/src/libproxychains.c @@ -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; |