diff options
author | Vincent Richard <[email protected]> | 2007-04-24 09:06:41 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2007-04-24 09:06:41 +0000 |
commit | e801eac8847180f47572d59f27853e4b574c82f0 (patch) | |
tree | 10039f550ba2a5fa2a7e2f6da1160bafa0dc2b1a | |
parent | Better parsing of ESMTP extensions. (diff) | |
download | vmime-e801eac8847180f47572d59f27853e4b574c82f0.tar.gz vmime-e801eac8847180f47572d59f27853e4b574c82f0.zip |
Allow more than one mechanism after AUTH=.
-rw-r--r-- | src/net/smtp/SMTPTransport.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp index 1233b0b7..672dac9e 100644 --- a/src/net/smtp/SMTPTransport.cpp +++ b/src/net/smtp/SMTPTransport.cpp @@ -223,6 +223,7 @@ void SMTPTransport::helo() m_extensions.clear(); // Get supported extensions from SMTP response + // One extension per line, format is: EXT PARAM1 PARAM2... for (int i = 1, n = resp->getLineCount() ; i < n ; ++i) { const string line = resp->getLineAt(i).getText(); @@ -231,22 +232,20 @@ void SMTPTransport::helo() string ext; iss >> ext; - // Special case: some servers send "AUTH=LOGIN" - if (ext.length() == 10 && utility::stringUtils::toUpper(ext) == "AUTH=LOGIN") + std::vector <string> params; + string param; + + // Special case: some servers send "AUTH=MECH [MECH MECH...]" + if (ext.length() >= 5 && utility::stringUtils::toUpper(ext.substr(0, 5)) == "AUTH=") { - m_extensions["AUTH"].push_back("LOGIN"); + params.push_back(utility::stringUtils::toUpper(ext.substr(5))); + ext = "AUTH"; } - // Default case: EXT PARAM1 PARAM2... - else - { - std::vector <string> params; - string param; - while (iss >> param) - params.push_back(utility::stringUtils::toUpper(param)); + while (iss >> param) + params.push_back(utility::stringUtils::toUpper(param)); - m_extensions[ext] = params; - } + m_extensions[ext] = params; } } } |