Skip to content

Commit adb5ec6

Browse files
l2063610646liujialiang
andauthored
MQTTv3.1 supports a zero-byte clientId during authentication (#900)
Thank's for the contribution, you are right. Co-authored-by: liujialiang <jialiang.liu@coolkit.cn>
1 parent ebd67ad commit adb5ec6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

broker/src/main/java/io/moquette/broker/MQTTConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ PostOffice.RouteResult processConnect(MqttConnectMessage msg) {
210210
final boolean cleanSession = msg.variableHeader().isCleanSession();
211211
final boolean serverGeneratedClientId;
212212
if (clientId == null || clientId.isEmpty()) {
213-
if (isNotProtocolVersion(msg, MqttVersion.MQTT_5)) {
213+
if (isNotProtocolVersion(msg, MqttVersion.MQTT_5) && isNotProtocolVersion(msg, MqttVersion.MQTT_3_1_1)) {
214214
if (!brokerConfig.isAllowZeroByteClientId()) {
215215
LOG.info("Broker doesn't permit MQTT empty client ID. Username: {}", username);
216216
abortConnection(CONNECTION_REFUSED_IDENTIFIER_REJECTED);

0 commit comments

Comments
 (0)