Hi,

Found a bug in Socks implementation. 

Current ICS implementation (v7 and v8) not allow to use socks server if they
configured to listen on IPv4 IP but send out from IPv6 IP !

Problem happens because ICS supply resolved IP of target host
(instead of their host name) in socks connect request.

So, we have "Host unreachable" error because IP resolved on ICS side
instead of socks server side.

In TCustomSocksWSocket.SocksDoConnect we have lines:

Buf[0] := #$05;            { Socks version }
Buf[1] := #$01;            { Connect command }
Buf[2] := #$00;            { Reserved, must be $00 }
Buf[3] := #$03;            { Address type is domain name }
Buf[4] := AnsiChar((Length(FAddrStr)));

We should supply { Address type is domain name } but instead we
always supply resolved IP ! It's not allow to resolve target host
on socks server side !

Problem happens because in TSmtpCli.Connect we call FWSocket.DnsLookup
and later connect to resolved IP in TCustomSmtpClient.WSocketDnsLookupDone !

At this point we lost original host name and TCustomSocksWSocket always
supply IP to Buf[4] := AnsiChar((Length(FAddrStr))) instead of host name !

To fix this problem we should always supply original host name to
TCustomSocksWSocket.SocksDoConnect OR add some additional property like
"ResolveIPOnSocksSide" for TCustomSocksWSocket class.

---
With best regards, Max Terentiev.
Business Software Products.
AMS Development Team.
supp...@bspdev.com


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to