auth-once mode: prevent same addr from being added multiple times
usually socks5 clients always put the 0 (no-auth) authentication
first, which will automatically make the address pass auth without
checking credentials, however it's possible that the client sends
only username auth method or puts it first in the list, in which
case the old code would add the same ip over and over to the list.
example change for proxychains-ng to trigger the unwanted behaviour:
--- a/src/core.c
+++ b/src/core.c
@@ -314,8 +314,8 @@ static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt, c
int n_methods = ulen ? 2 : 1;
buff[0] = 5; // version
buff[1] = n_methods ; // number of methods
- buff[2] = 0; // no auth method
- if(ulen) buff[3] = 2; /// auth method -> username / password
+ buff[2] = 2;
+ buff[3] = 0;
if(2+n_methods != write_n_bytes(sock, (char *) buff, 2+n_methods))
goto err;
this testing patch requires that user&pass are supplied in the
proxychains-ng config, otherwise bad things may happen.