Currently, ProxySOCKS5 proposes unconditionally proposes 2 authentications modes to the Socks server:
buf[lIndex=index++] = 2;
buf[index++] = 0; // NO AUTHENTICATION REQUIRED
buf[index++] = 2; // USERNAME/PASSWORD
no matter whether a username and password has been set or not.
With most servers, this is not a problem, as they won't request username/password if no compulsory authentication has been configured on their side, even if the client proposes it.
However, https://f-droid.org/packages/pan.alexander.tordnscrypt.stable/ does take the client up on its offer,even though it would not otherwise need username and password.
With the result that the client fails a couple of lines later:
case 2: // USERNAME/PASSWORD
if (user == null || passwd == null)
break;
If I don't offer USERNAME/PASSWORD if none is supplied, all is ok:
int lIndex;
buf[lIndex=index++] = 2;
buf[index++] = 0; // NO AUTHENTICATION REQUIRED
if(user != null && passwd != null)
buf[index++] = 2; // USERNAME/PASSWORD
buf[lIndex] = (byte) (index - lIndex - 1);
out.write(buf, 0, index);
Other thing: the exception raised if the above condition happens just says "fail in SOCKS5 proxy", which is a little bit vague, and also ambiguous, because it might happen in 2 different circumstances:
- the one described above. => "SOCKS Server requires username/password, but none configured"
- if ever the server picks an authentication mechanism which hasn't been offered. => "SOCKS5: Auth mode "+((buf[1]) & 0xff)+" not supported"
Thanks,
Alain
Currently, ProxySOCKS5 proposes unconditionally proposes 2 authentications modes to the Socks server:
no matter whether a username and password has been set or not.
With most servers, this is not a problem, as they won't request username/password if no compulsory authentication has been configured on their side, even if the client proposes it.
However, https://f-droid.org/packages/pan.alexander.tordnscrypt.stable/ does take the client up on its offer,even though it would not otherwise need username and password.
With the result that the client fails a couple of lines later:
case 2: // USERNAME/PASSWORD
if (user == null || passwd == null)
break;
If I don't offer USERNAME/PASSWORD if none is supplied, all is ok:
Other thing: the exception raised if the above condition happens just says "fail in SOCKS5 proxy", which is a little bit vague, and also ambiguous, because it might happen in 2 different circumstances:
Thanks,
Alain