From issues-return-65900-archive-asf-public=cust-asf.ponee.io@commons.apache.org Fri Jan 12 03:54:06 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id B11C6180656 for ; Fri, 12 Jan 2018 03:54:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A119D160C41; Fri, 12 Jan 2018 02:54:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E71B4160C13 for ; Fri, 12 Jan 2018 03:54:05 +0100 (CET) Received: (qmail 92775 invoked by uid 500); 12 Jan 2018 02:54:05 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 92764 invoked by uid 99); 12 Jan 2018 02:54:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jan 2018 02:54:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 7A19F1A0984 for ; Fri, 12 Jan 2018 02:54:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.911 X-Spam-Level: X-Spam-Status: No, score=-99.911 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id LqpNe0kUGO6y for ; Fri, 12 Jan 2018 02:54:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 450A45F250 for ; Fri, 12 Jan 2018 02:54:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5EDEAE0383 for ; Fri, 12 Jan 2018 02:54:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1BEDE240C6 for ; Fri, 12 Jan 2018 02:54:00 +0000 (UTC) Date: Fri, 12 Jan 2018 02:54:00 +0000 (UTC) From: "Matthew McGillis (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (NET-650) IMAPClient over proxy doesn't properly resolve DNS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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 > 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 (v6.4.14#64029)