diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2020-02-27 05:23:39 +0300 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2020-03-31 12:50:42 +0300 |
commit | 9750e33b22d76a0fc9e7c4e6925b85b66beb8122 (patch) | |
tree | d868aee10b0c19dda157803f7c4927cf0bd14dcf | |
parent | 37ffdcb55f9567e09bee3f230c07d02d1b7ddfa7 (diff) |
Prohibit sending MQTT 5 AUTH while connecting to the Broker
the QMqttConnection's m_internalState distinguishes between Connecting
and WaitForConnectAck, whilst QMqttClient's state doesn't
Change-Id: Ic5c963aa07a8165e22b52baf36d98ac186cb6c58
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
-rw-r--r-- | src/mqtt/qmqttconnection.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mqtt/qmqttconnection.cpp b/src/mqtt/qmqttconnection.cpp index acae99f..a236797 100644 --- a/src/mqtt/qmqttconnection.cpp +++ b/src/mqtt/qmqttconnection.cpp @@ -314,15 +314,16 @@ bool QMqttConnection::sendControlAuthenticate(const QMqttAuthenticationPropertie QMqttControlPacket packet(QMqttControlPacket::AUTH); - switch (m_clientPrivate->m_state) { - case QMqttClient::Disconnected: + switch (m_internalState) { + case BrokerDisconnected: + case BrokerConnecting: qCDebug(lcMqttConnection) << "Using AUTH while disconnected."; return false; - case QMqttClient::Connecting: + case BrokerWaitForConnectAck: qCDebug(lcMqttConnection) << "AUTH while connecting, set continuation flag."; packet.append(char(0x18)); break; - case QMqttClient::Connected: + case BrokerConnected: qCDebug(lcMqttConnection) << "AUTH while connected, initiate re-authentication."; packet.append(char(0x19)); break; |