Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0607E8C1A for ; Tue, 30 Aug 2011 14:54:03 +0000 (UTC) Received: (qmail 58377 invoked by uid 500); 30 Aug 2011 14:54:02 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 57949 invoked by uid 500); 30 Aug 2011 14:54:02 -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 57887 invoked by uid 99); 30 Aug 2011 14:54:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Aug 2011 14:54:01 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Aug 2011 14:53:58 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id E9958D7317 for ; Tue, 30 Aug 2011 14:53:37 +0000 (UTC) Date: Tue, 30 Aug 2011 14:53:37 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: <1459582943.7720.1314716017950.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <666602303.3154.1314625178272.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (NET-421) Problem connecting to TLS/SSL SMTP server using explicit mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/NET-421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sebb resolved NET-421. ---------------------- Resolution: Fixed > Problem connecting to TLS/SSL SMTP server using explicit mode > ------------------------------------------------------------- > > Key: NET-421 > URL: https://issues.apache.org/jira/browse/NET-421 > Project: Commons Net > Issue Type: Bug > Components: SMTP > Affects Versions: 3.0, 3.0.1 > Reporter: Oliver Saggau > Priority: Critical > Fix For: 3.1 > > > Just tried to send an email through gmail servers by doing the following: > {code}AuthenticatingSMTPClient client = new AuthenticatingSMTPClient(); > client.connect("smtp.gmail.com", 587); // reply: 220 220 mx.google.com ESMTP > client.login(); // reply: 250 250 mx.google.com at your service > client.execTLS(); // reply: 220 2.0.0 Ready to start TLS > client.auth(AUTH_METHOD.PLAIN, username, password); // exception > ...{code} > Unfortunality after execTLS() I get a MalformedServerReplyException. I looked at the SMTPSClient source code and found out that the reader/writer are wrong after execTLS() got called. The performSSLNegotiation() method sets _input_ and _output_ to the new input/output streams from SSLSocket, but the reader/writer are still pointing to the values set inside _connectAction_(). > Possible fix for this issue: > {code}public boolean execTLS() throws SSLException, IOException > { > if (!SMTPReply.isPositiveCompletion(sendCommand("STARTTLS"))) > { > return false; > //throw new SSLException(getReplyString()); > } > performSSLNegotiation(); > _reader = new CRLFLineReader(new InputStreamReader(_input_, encoding)); > _writer = new BufferedWriter(new OutputStreamWriter(_output_, encoding)); > return true; > }{code} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira