[ 
https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341706#comment-16341706
 ] 

Matthew McGillis commented on NET-650:
--------------------------------------

This would be an outline of a test case you might want to setup up or figure 
out how to build in to a regression test:

1. Consider two hosts A and B
 2. Setup the host file on A so it only knows host B as say: test.domain.com
 3. Setup the host file on B so it only knows it self as say: proxy.domain.com
 4. Confirm ping proxy.domain.com from A fails on host lookup
 5. From A ssh to B creating a socks proxy
{code:java}
$ ssh -D localhost:16000 test.domain.com
{code}
6. now run the socketproxy.java on A
{code:java}
$ java -DsocksProxyHost=localhost -DsocksProxyPort=16000 socketproxy 
proxy.domain.com
{code}
As socketproxy is currently written you would need something listening on the 
imap port of host B so it returns something when connected to so you can see 
that the above works. But you can replace the port number in socketproxy to 
anything that will respond. In the above since ssh is on B to support the socks 
proxy you could use the ssh port which when you connect should return something 
like:

$ nc localhost 22
 SSH-2.0-OpenSSH_7.6

> IMAPClient over proxy doesn't properly resolve DNS
> --------------------------------------------------
>
>                 Key: NET-650
>                 URL: https://issues.apache.org/jira/browse/NET-650
>             Project: Commons Net
>          Issue Type: Bug
>          Components: IMAP
>    Affects Versions: 3.6
>            Reporter: Matthew McGillis
>            Priority: Major
>         Attachments: imapproxy.java, imapproxy2.java, socketproxy.java
>
>
> IMAPClient when configured to use a socks proxy is not able to resolve DNS 
> names through the proxy.
> See attached sample code, if I use it with:
> {noformat}
> $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
> .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass
> connect error: java.net.UnknownHostException: imap.server.test.com: unknown 
> error
> {noformat}
> vs if I use it with the appropriate IP:
> {noformat}
> $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
> .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass
> * OK IMAP4rev1 proxy server ready
> IMAP: 10.250.3.127 143
> AAAA LOGIN *******
> AAAA OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE 
> ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ 
> LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR 
> SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN 
> completed
> AAAB LOGOUT
> * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection
> AAAB OK LOGOUT completed
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to