[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS

2018-01-26 Thread Matthew McGillis (JIRA)

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

Matthew McGillis edited comment on NET-650 at 1/26/18 11:56 PM:


> There may be no remote mapping, so you might want to add your own local 
> definition.

I would want to know that the remote does not know how to resolve the name.

> Also the code may not know that a proxy is being used.

But I do because I told it I wanted it to use the proxy. If I don't want to use 
the proxy I won't specify it.

> As it stands, the constructor new InetSocketAddress(host, port) will use the 
> local definition if there is one.
To force the use of the remote mapping, one would need to use 
InetSocketAddress. InetSocketAddress(host,port)

Not following the above you sure you wrote it correctly.


was (Author: msm):
> There may be no remote mapping, so you might want to add your own local 
> definition.

I would want to know that the remote does not know how to resolve the name.

> Also the code may not know that a proxy is being used.

But I do and because I told it I wanted it to use the proxy. If I don't want to 
use the proxy I won't specify it.

> As it stands, the constructor new InetSocketAddress(host, port) will use the 
> local definition if there is one.
To force the use of the remote mapping, one would need to use 
InetSocketAddress. InetSocketAddress(host,port)

Not following the above you sure you wrote it correctly.

> 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
>  LOGIN ***
>  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)


[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS

2018-01-26 Thread Matthew McGillis (JIRA)

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

Matthew McGillis edited comment on NET-650 at 1/26/18 11:55 PM:


> There may be no remote mapping, so you might want to add your own local 
> definition.

I would want to know that the remote does not know how to resolve the name.

> Also the code may not know that a proxy is being used.

But I do and because I told it I wanted it to use the proxy. If I don't want to 
use the proxy I won't specify it.

> As it stands, the constructor new InetSocketAddress(host, port) will use the 
> local definition if there is one.
To force the use of the remote mapping, one would need to use 
InetSocketAddress. InetSocketAddress(host,port)

Not following the above you sure you wrote it correctly.


was (Author: msm):
> There may be no remote mapping, so you might want to add your own local 
> definition.

I would want to know that the remote does not know haw to resolve the name.

> Also the code may not know that a proxy is being used.

But I do and because I told it I wanted it to use the proxy. If I don't want to 
use the proxy I won't specify it.

> As it stands, the constructor new InetSocketAddress(host, port) will use the 
> local definition if there is one.
To force the use of the remote mapping, one would need to use 
InetSocketAddress. InetSocketAddress(host,port)

Not following the above you sure you wrote it correctly.

> 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
>  LOGIN ***
>  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)


[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS

2018-01-26 Thread Sebb (JIRA)

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

Sebb edited comment on NET-650 at 1/26/18 11:55 PM:


bq.  if you have directed something to use a proxy then you want the remote 
mapping of the name and not the local one.

Not necessarily.
There may be no remote mapping, so you might want to add your own local 
definition.
Also the code may not know that a proxy is being used.

As it stands, the constructor new InetSocketAddress(host, port) will use the 
local definition if there is one.
To force the use of the remote mapping, one would need to use 
InetSocketAddress.createUnresolved(host,port)


was (Author: s...@apache.org):
bq.  if you have directed something to use a proxy then you want the remote 
mapping of the name and not the local one.

Not necessarily.
There may be no remote mapping, so you might want to add your own local 
definition.
Also the code may not know that a proxy is being used.

As it stands, the constructor new InetSocketAddress(host, port) will use the 
local definition if there is one.
To force the use of the remote mapping, one would need to use 
InetSocketAddress. InetSocketAddress(host,port)

> 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
>  LOGIN ***
>  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)


[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS

2018-01-26 Thread Matthew McGillis (JIRA)

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

Matthew McGillis edited comment on NET-650 at 1/26/18 10:49 PM:


InetSocketAddress should work regardless of proxy or not. So you should be able 
to test that you have found a working InetSocketAddress solution simply by 
connecting to anything you would normally.

{code}
$ java -cp .:./commons-net-3.6.jar socketproxy imap.comcast.net
* OK IMAP4 ready
{code}

Then once you are using InetSocketAddress locally fine it should continue to 
work for when -DsocksProxyHost and -DsocksProxyPort are specified.


was (Author: msm):
InetSocketAddress should work regardless of proxy or not. So you should be able 
to test that you have found a working InetSocketAddress solution simply by 
connecting to anything you would normally.

{code}
$ java -cp .:./commons-net-3.6.jar socketproximap.comcast.net
* OK IMAP4 ready
{code}

Then once you are using InetSocketAddress locally fine it should continue to 
work for when -DsocksProxyHost and -DsocksProxyPort are specified.

> 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
>  LOGIN ***
>  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)


[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS

2018-01-11 Thread Matthew McGillis (JIRA)

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

Matthew McGillis edited comment on NET-650 at 1/12/18 3:08 AM:
---

Well this is the details of the exception:

{noformat}
java.net.UnknownHostException: imap.server.test.com
at java.net.InetAddress.getAllByName0(InetAddress.java:1280)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at java.net.InetAddress.getByName(InetAddress.java:1076)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:202)
at imapproxy.main(imapproxy.java:45)
{noformat}

So it looks like your connect code calls InetAddress directly to resolve the 
name which will happen on the server that code is run from. Which is not what 
we need.

I have attached a new program that works at a socket level in both cases:

{noformat}
$ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
.:./commons-net-3.6.jar socketproxy imap.server.test.com user1 userpass
* OK IMAP4rev1 proxy server ready
$ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
.:./commons-net-3.6.jar socketproxy 10.250.3.127 user1 userpass
* OK IMAP4rev1 proxy server ready
{noformat}

Let me know if that doesn't help I'm not going to have time to work out a patch 
but hopefully the above should turn into a simple replacement in the 
appropriate place.



was (Author: msm):
Well this is the details of the exception:

{noformat}
java.net.UnknownHostException: zimbra07.loadtest.synacor.com
at java.net.InetAddress.getAllByName0(InetAddress.java:1280)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at java.net.InetAddress.getByName(InetAddress.java:1076)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:202)
at imapproxy.main(imapproxy.java:45)
{noformat}

So it looks like your connect code calls InetAddress directly to resolve the 
name which will happen on the server that code is run from. Which is not what 
we need.

I have attached a new program that works at a socket level in both cases:

{noformat}
$ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
.:./commons-net-3.6.jar socketproxy imap.server.test.com user1 userpass
* OK IMAP4rev1 proxy server ready
$ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
.:./commons-net-3.6.jar socketproxy 10.250.3.127 user1 userpass
* OK IMAP4rev1 proxy server ready
{noformat}

Let me know if that doesn't help I'm not going to have time to work out a patch 
but hopefully the above should turn into a simple replacement in the 
appropriate place.


> 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
> Attachments: imapproxy.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
>  LOGIN ***
>  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
(v6.4.14#64029)


[jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS

2018-01-11 Thread Matthew McGillis (JIRA)

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

Matthew McGillis edited comment on NET-650 at 1/12/18 2:53 AM:
---

Well this is the details of the exception:

{noformat}
java.net.UnknownHostException: zimbra07.loadtest.synacor.com
at java.net.InetAddress.getAllByName0(InetAddress.java:1280)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at java.net.InetAddress.getByName(InetAddress.java:1076)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:202)
at imapproxy.main(imapproxy.java:45)
{noformat}

So it looks like your connect code calls InetAddress directly to resolve the 
name which will happen on the server that code is run from. Which is not what 
we need.

I have attached a new program that works at a socket level in both cases:

{noformat}
$ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
.:./commons-net-3.6.jar socketproxy imap.server.test.com user1 userpass
* OK IMAP4rev1 proxy server ready
$ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
.:./commons-net-3.6.jar socketproxy 10.250.3.127 user1 userpass
* OK IMAP4rev1 proxy server ready
{noformat}

Let me know if that doesn't help I'm not going to have time to work out a patch 
but hopefully the above should turn into a simple replacement in the 
appropriate place.



was (Author: msm):
Well this is the details of the exception:

{noformat}
java.net.UnknownHostException: zimbra07.loadtest.synacor.com
at java.net.InetAddress.getAllByName0(InetAddress.java:1280)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at java.net.InetAddress.getByName(InetAddress.java:1076)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:202)
at imapproxy.main(imapproxy.java:45)
{noformat}

So it looks like your connect code calls InetAddress directly to resolve the 
name which will happen on the server that code is run from. Which is not what 
we need.

I have attached a new program that works at a socket level in both cases:

{noformat}
$ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
.:./commons-net-3.6.jar socketproxy imap.server.test.com user1 userpass
* OK IMAP4rev1 proxy server ready
palladium:commons-net-3.6 matthew$ java -DsocksProxyHost=localhost 
-DsocksProxyPort=16003 -cp .:./commons-net-3.6.jar socketproxy 10.250.3.127 
user1 userpass
* OK IMAP4rev1 proxy server ready
{noformat}

Let me know if that doesn't help I'm not going to have time to work out a patch 
but hopefully the above should turn into a simple replacement in the 
appropriate place.


> 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
> Attachments: imapproxy.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
>  LOGIN ***
>  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
(v6.4.14#64029)