Fix STARTTLS detection.

The previous code was not an impressive demonstration of clear thinking
and could reject cases where STARTTLS was actually supported.

Change-Id: I27ce8b401447a49be93f58c9e4eb5c5d8e7b73d4
Reviewed-on: https://boringssl-review.googlesource.com/10241
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Adam Langley 2016-08-09 21:16:45 -07:00 committed by CQ bot account: commit-bot@chromium.org
parent 5a91503826
commit 505cf39af9

View File

@ -535,8 +535,7 @@ bool DoSMTPStartTLS(int sock) {
}
// https://tools.ietf.org/html/rfc1869#section-4.3
if (reply_250.find("\nSTARTTLS\n") == std::string::npos &&
reply_250.find("\nSTARTTLS") != reply_250.size() - 8) {
if (("\n" + reply_250 + "\n").find("\nSTARTTLS\n") == std::string::npos) {
fprintf(stderr, "Server does not support STARTTLS\n");
return false;
}