From 2283e2c14916c34e9bfea896066dffa62ebe90b1 Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Mon, 19 Sep 2022 19:22:21 +0200 Subject: [PATCH] Allow MQTT5 non-clean start empty client ID --- mqttpacket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mqttpacket.cpp b/mqttpacket.cpp index 42045c1..13e66a5 100644 --- a/mqttpacket.cpp +++ b/mqttpacket.cpp @@ -724,9 +724,9 @@ void MqttPacket::handleConnect() logger->logf(LOG_ERR, "ClientID '%s' has + or # in the id and 'allow_unsafe_clientid_chars' is false.", connectData.client_id.c_str()); validClientId = false; } - else if (!connectData.clean_start && connectData.client_id.empty()) + else if (protocolVersion < ProtocolVersion::Mqtt5 && !connectData.clean_start && connectData.client_id.empty()) { - logger->logf(LOG_ERR, "ClientID empty and clean start 0, which is incompatible"); + logger->logf(LOG_ERR, "ClientID empty and clean start 0, which is incompatible below MQTTv5."); validClientId = false; } else if (protocolVersion < ProtocolVersion::Mqtt311 && connectData.client_id.empty()) -- libgit2 0.21.4