Reissue EHLO after successful STARTTLS.
This commit is contained in:
parent
7ed5c675a6
commit
b2d67de8a9
@ -4,6 +4,9 @@ VERSION 0.8.1cvs
|
|||||||
|
|
||||||
2006-10-02 Vincent Richard <vincent@vincent-richard.net>
|
2006-10-02 Vincent Richard <vincent@vincent-richard.net>
|
||||||
|
|
||||||
|
* SMTPTransport.cpp: reissue EHLO command after a successful STARTTLS
|
||||||
|
negociation.
|
||||||
|
|
||||||
* word, wordEncoder: fixed bug #1096610 which caused encoding of a
|
* word, wordEncoder: fixed bug #1096610 which caused encoding of a
|
||||||
non-integral number of characters (and then, generation of
|
non-integral number of characters (and then, generation of
|
||||||
incorrectly-formed words) with multi-bytes charsets.
|
incorrectly-formed words) with multi-bytes charsets.
|
||||||
|
@ -135,36 +135,7 @@ void SMTPTransport::connect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Identification
|
// Identification
|
||||||
// First, try Extended SMTP (ESMTP)
|
helo();
|
||||||
//
|
|
||||||
// eg: C: EHLO thismachine.ourdomain.com
|
|
||||||
// S: 250-smtp.theserver.com
|
|
||||||
// S: 250 AUTH CRAM-MD5 DIGEST-MD5
|
|
||||||
|
|
||||||
sendRequest("EHLO " + platformDependant::getHandler()->getHostName());
|
|
||||||
|
|
||||||
if ((resp = readResponse())->getCode() != 250)
|
|
||||||
{
|
|
||||||
// Next, try "Basic" SMTP
|
|
||||||
//
|
|
||||||
// eg: C: HELO thismachine.ourdomain.com
|
|
||||||
// S: 250 OK
|
|
||||||
|
|
||||||
sendRequest("HELO " + platformDependant::getHandler()->getHostName());
|
|
||||||
|
|
||||||
if ((resp = readResponse())->getCode() != 250)
|
|
||||||
{
|
|
||||||
internalDisconnect();
|
|
||||||
throw exceptions::connection_greeting_error(resp->getLastLine().getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
m_extendedSMTP = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_extendedSMTP = true;
|
|
||||||
m_extendedSMTPResponse = resp->getText();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if VMIME_HAVE_TLS_SUPPORT
|
#if VMIME_HAVE_TLS_SUPPORT
|
||||||
// Setup secured connection, if requested
|
// Setup secured connection, if requested
|
||||||
@ -196,6 +167,9 @@ void SMTPTransport::connect()
|
|||||||
{
|
{
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Must reissue a EHLO command [RFC-2487, 5.2]
|
||||||
|
helo();
|
||||||
}
|
}
|
||||||
#endif // VMIME_HAVE_TLS_SUPPORT
|
#endif // VMIME_HAVE_TLS_SUPPORT
|
||||||
|
|
||||||
@ -207,6 +181,44 @@ void SMTPTransport::connect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SMTPTransport::helo()
|
||||||
|
{
|
||||||
|
// First, try Extended SMTP (ESMTP)
|
||||||
|
//
|
||||||
|
// eg: C: EHLO thismachine.ourdomain.com
|
||||||
|
// S: 250-smtp.theserver.com
|
||||||
|
// S: 250 AUTH CRAM-MD5 DIGEST-MD5
|
||||||
|
|
||||||
|
sendRequest("EHLO " + platformDependant::getHandler()->getHostName());
|
||||||
|
|
||||||
|
ref <SMTPResponse> resp;
|
||||||
|
|
||||||
|
if ((resp = readResponse())->getCode() != 250)
|
||||||
|
{
|
||||||
|
// Next, try "Basic" SMTP
|
||||||
|
//
|
||||||
|
// eg: C: HELO thismachine.ourdomain.com
|
||||||
|
// S: 250 OK
|
||||||
|
|
||||||
|
sendRequest("HELO " + platformDependant::getHandler()->getHostName());
|
||||||
|
|
||||||
|
if ((resp = readResponse())->getCode() != 250)
|
||||||
|
{
|
||||||
|
internalDisconnect();
|
||||||
|
throw exceptions::connection_greeting_error(resp->getLastLine().getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_extendedSMTP = false;
|
||||||
|
m_extendedSMTPResponse.clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_extendedSMTP = true;
|
||||||
|
m_extendedSMTPResponse = resp->getText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SMTPTransport::authenticate()
|
void SMTPTransport::authenticate()
|
||||||
{
|
{
|
||||||
if (!m_extendedSMTP)
|
if (!m_extendedSMTP)
|
||||||
|
@ -75,6 +75,7 @@ private:
|
|||||||
|
|
||||||
void internalDisconnect();
|
void internalDisconnect();
|
||||||
|
|
||||||
|
void helo();
|
||||||
void authenticate();
|
void authenticate();
|
||||||
#if VMIME_HAVE_SASL_SUPPORT
|
#if VMIME_HAVE_SASL_SUPPORT
|
||||||
void authenticateSASL();
|
void authenticateSASL();
|
||||||
|
Loading…
Reference in New Issue
Block a user