SMTP: send EHLO only after reading the server's banner
commit78f609093709c8307b1a3a900398149b5c220576
authorJan Kundrát <jkt@kde.org>
Wed, 5 Apr 2017 13:19:03 +0000 (5 15:19 +0200)
committerJan Kundrát <jkt@kde.org>
Wed, 5 Apr 2017 14:35:09 +0000 (5 16:35 +0200)
tree26785397e02d95e8b74898c3fa8435f52e4272c1
parent34940466b2a6d496f866ae3c8e1071e4d3e1d334
SMTP: send EHLO only after reading the server's banner

There's a difference between connectin in a TLS mode from the very
beginning (aka connectToHostEncrypted()) and activating TLS on the fly
(STARTTLS). In the first case, the socket's encrypted() signal is
largely irrelevant, whereas it is actually important when using STARTTLS
upgrading. The EHLO should indeed be re-sent when STARTTLSing, but not
when the encrypted() signal gets fired just because we're finally
connected.

TL;DR: it's evil to send an EHLO prior to seeing the server's banner.

This is a bug in qwwsmtpclient.

Thanks to robn and to ctOS for reporting this.

Change-Id: Id981ed7a525715436063a6435635905b22b0df55
src/qwwsmtpclient/qwwsmtpclient.cpp