[jira] [Created] (NET-421) Problem connecting to TLS/SSL SMTP server using explicit mode

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (NET-421) Problem connecting to TLS/SSL SMTP server using explicit mode

ASF GitHub Bot (Jira)
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
            Reporter: Oliver Saggau
            Priority: Critical


Just tried to send an email through gmail servers by doing the following:
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
...

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

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (NET-421) Problem connecting to TLS/SSL SMTP server using explicit mode

ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/NET-421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Saggau updated NET-421:
------------------------------

    Description:
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}

  was:
Just tried to send an email through gmail servers by doing the following:
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
...

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}


> 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
>            Reporter: Oliver Saggau
>            Priority: Critical
>
> 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

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (NET-421) Problem connecting to TLS/SSL SMTP server using explicit mode

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/NET-421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated NET-421:
---------------------

    Affects Version/s: 3.0.1
        Fix Version/s: 3.1

> 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

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (NET-421) Problem connecting to TLS/SSL SMTP server using explicit mode

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ 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