mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-02-06 11:12:09 +08:00
Merge branch 'master' into develop
This commit is contained in:
@@ -114,6 +114,18 @@ Clients:
|
||||
- The `--insecure` option now disables all server certificate verification.
|
||||
|
||||
|
||||
2.0.14 - 2021-11-17
|
||||
===================
|
||||
|
||||
Broker:
|
||||
- Fix bridge not respecting receive-maximum when reconnecting with MQTT v5.
|
||||
|
||||
Client library:
|
||||
- Fix mosquitto_topic_matches_sub2() not using the length parameters.
|
||||
Closes #2364.
|
||||
- Fix incorrect subscribe_callback in mosquittopp.h. Closes #2367.
|
||||
|
||||
|
||||
2.0.13 - 2021-10-27
|
||||
===================
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ WITH_LTO=yes
|
||||
|
||||
# Also bump lib/mosquitto.h, CMakeLists.txt,
|
||||
# installer/mosquitto.nsi, installer/mosquitto64.nsi
|
||||
VERSION=2.0.13
|
||||
VERSION=2.0.14
|
||||
|
||||
# Client library SO version. Bump if incompatible API/ABI changes are made.
|
||||
SOVERSION=1
|
||||
@@ -361,11 +361,6 @@ ifeq ($(WITH_WEBSOCKETS),lws)
|
||||
BROKER_LDADD:=$(BROKER_LDADD) -lwebsockets
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_WEBSOCKETS),static)
|
||||
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WEBSOCKET=WS_IS_LWS
|
||||
BROKER_LDADD:=$(BROKER_LDADD) -static -lwebsockets
|
||||
endif
|
||||
|
||||
INSTALL?=install
|
||||
prefix?=/usr/local
|
||||
incdir?=${prefix}/include
|
||||
|
||||
@@ -3,8 +3,8 @@ FROM alpine:3.14
|
||||
LABEL maintainer="Roger Light <roger@atchoo.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
ENV VERSION=2.0.12 \
|
||||
DOWNLOAD_SHA256=31cf0065cb431d6f4e57a5f4d56663e839c9d177362eff89582d7cfde191c933 \
|
||||
ENV VERSION=2.0.14 \
|
||||
DOWNLOAD_SHA256=d0dde8fdb12caf6e2426b4f28081919a2fce3448773bdb8af0d3cd5fe5776925 \
|
||||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \
|
||||
LWS_VERSION=4.2.1 \
|
||||
LWS_SHA256=842da21f73ccba2be59e680de10a8cce7928313048750eb6ad73b6fa50763c51
|
||||
|
||||
@@ -3,8 +3,8 @@ FROM alpine:3.14
|
||||
LABEL maintainer="Roger Light <roger@atchoo.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
ENV VERSION=2.0.12 \
|
||||
DOWNLOAD_SHA256=31cf0065cb431d6f4e57a5f4d56663e839c9d177362eff89582d7cfde191c933 \
|
||||
ENV VERSION=2.0.14 \
|
||||
DOWNLOAD_SHA256=d0dde8fdb12caf6e2426b4f28081919a2fce3448773bdb8af0d3cd5fe5776925 \
|
||||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \
|
||||
LWS_VERSION=4.2.1 \
|
||||
LWS_SHA256=842da21f73ccba2be59e680de10a8cce7928313048750eb6ad73b6fa50763c51
|
||||
|
||||
@@ -66,7 +66,7 @@ extern "C" {
|
||||
|
||||
#define LIBMOSQUITTO_MAJOR 2
|
||||
#define LIBMOSQUITTO_MINOR 0
|
||||
#define LIBMOSQUITTO_REVISION 13
|
||||
#define LIBMOSQUITTO_REVISION 14
|
||||
/* LIBMOSQUITTO_VERSION_NUMBER looks like 1002001 for e.g. version 1.2.1. */
|
||||
#define LIBMOSQUITTO_VERSION_NUMBER (LIBMOSQUITTO_MAJOR*1000000+LIBMOSQUITTO_MINOR*1000+LIBMOSQUITTO_REVISION)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ SetCompressor /SOLID lzma
|
||||
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
|
||||
Name "Eclipse Mosquitto"
|
||||
!define VERSION 2.0.13
|
||||
!define VERSION 2.0.14
|
||||
OutFile "mosquitto-${VERSION}-install-windows-x86.exe"
|
||||
|
||||
InstallDir "$PROGRAMFILES\Mosquitto"
|
||||
|
||||
@@ -11,7 +11,7 @@ SetCompressor /SOLID lzma
|
||||
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
|
||||
Name "Eclipse Mosquitto"
|
||||
!define VERSION 2.0.13
|
||||
!define VERSION 2.0.14
|
||||
OutFile "mosquitto-${VERSION}-install-windows-x64.exe"
|
||||
|
||||
!include "x64.nsh"
|
||||
|
||||
@@ -114,13 +114,12 @@ set_target_properties(libmosquitto PROPERTIES
|
||||
|
||||
install(TARGETS libmosquitto
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
|
||||
if(WITH_STATIC_LIBRARIES)
|
||||
add_library(libmosquitto_static STATIC
|
||||
${C_SRC}
|
||||
)
|
||||
add_library(libmosquitto_static STATIC ${C_SRC})
|
||||
if(WITH_PIC)
|
||||
set_target_properties(libmosquitto_static PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE 1
|
||||
|
||||
@@ -25,6 +25,7 @@ set_target_properties(mosquittopp PROPERTIES
|
||||
)
|
||||
install(TARGETS mosquittopp
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ mosqpp_EXPORT int subscribe_callback(
|
||||
void *userdata,
|
||||
const char *topic,
|
||||
int qos=0,
|
||||
bool retained=true,
|
||||
const char *host="localhost",
|
||||
int port=1883,
|
||||
const char *client_id=NULL,
|
||||
|
||||
@@ -36,7 +36,7 @@ int handle__auth(struct mosquitto *mosq)
|
||||
mosquitto_property *properties = NULL;
|
||||
|
||||
if(!mosq) return MOSQ_ERR_INVAL;
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received AUTH", mosq->id);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received AUTH", SAFE_PRINT(mosq->id));
|
||||
|
||||
if(mosq->protocol != mosq_p_mqtt5){
|
||||
return MOSQ_ERR_PROTOCOL;
|
||||
|
||||
@@ -49,7 +49,7 @@ int handle__pingreq(struct mosquitto *mosq)
|
||||
}
|
||||
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PINGREQ from %s", mosq->id);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PINGREQ from %s", SAFE_PRINT(mosq->id));
|
||||
#else
|
||||
return MOSQ_ERR_PROTOCOL;
|
||||
#endif
|
||||
@@ -69,9 +69,9 @@ int handle__pingresp(struct mosquitto *mosq)
|
||||
if(mosq->bridge == NULL){
|
||||
return MOSQ_ERR_PROTOCOL;
|
||||
}
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PINGRESP from %s", mosq->id);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PINGRESP from %s", SAFE_PRINT(mosq->id));
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PINGRESP", mosq->id);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PINGRESP", SAFE_PRINT(mosq->id));
|
||||
#endif
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -120,20 +120,20 @@ int handle__pubackcomp(struct mosquitto *mosq, const char *type)
|
||||
}
|
||||
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received %s from %s (Mid: %d, RC:%d)", type, mosq->id, mid, reason_code);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received %s from %s (Mid: %d, RC:%d)", type, SAFE_PRINT(mosq->id), mid, reason_code);
|
||||
|
||||
/* Immediately free, we don't do anything with Reason String or User Property at the moment */
|
||||
mosquitto_property_free_all(&properties);
|
||||
|
||||
rc = db__message_delete_outgoing(mosq, mid, mosq_ms_wait_for_pubcomp, qos);
|
||||
if(rc == MOSQ_ERR_NOT_FOUND){
|
||||
log__printf(mosq, MOSQ_LOG_WARNING, "Warning: Received %s from %s for an unknown packet identifier %d.", type, mosq->id, mid);
|
||||
log__printf(mosq, MOSQ_LOG_WARNING, "Warning: Received %s from %s for an unknown packet identifier %d.", type, SAFE_PRINT(mosq->id), mid);
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}else{
|
||||
return rc;
|
||||
}
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received %s (Mid: %d, RC:%d)", mosq->id, type, mid, reason_code);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received %s (Mid: %d, RC:%d)", SAFE_PRINT(mosq->id), type, mid, reason_code);
|
||||
|
||||
rc = message__delete(mosq, mid, mosq_md_out, qos);
|
||||
if(rc == MOSQ_ERR_SUCCESS){
|
||||
|
||||
@@ -144,7 +144,7 @@ int handle__publish(struct mosquitto *mosq)
|
||||
}
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG,
|
||||
"Client %s received PUBLISH (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))",
|
||||
mosq->id, message->dup, message->msg.qos, message->msg.retain,
|
||||
SAFE_PRINT(mosq->id), message->dup, message->msg.qos, message->msg.retain,
|
||||
message->msg.mid, message->msg.topic,
|
||||
(long)message->msg.payloadlen);
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ int handle__pubrec(struct mosquitto *mosq)
|
||||
}
|
||||
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PUBREC from %s (Mid: %d)", mosq->id, mid);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PUBREC from %s (Mid: %d)", SAFE_PRINT(mosq->id), mid);
|
||||
|
||||
if(reason_code < 0x80){
|
||||
rc = db__message_update_outgoing(mosq, mid, mosq_ms_wait_for_pubcomp, 2);
|
||||
@@ -100,7 +100,7 @@ int handle__pubrec(struct mosquitto *mosq)
|
||||
}
|
||||
#else
|
||||
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREC (Mid: %d)", mosq->id, mid);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREC (Mid: %d)", SAFE_PRINT(mosq->id), mid);
|
||||
|
||||
if(reason_code < 0x80 || mosq->protocol != mosq_p_mqtt5){
|
||||
rc = message__out_update(mosq, mid, mosq_ms_wait_for_pubcomp, 2);
|
||||
@@ -117,7 +117,7 @@ int handle__pubrec(struct mosquitto *mosq)
|
||||
}
|
||||
#endif
|
||||
if(rc == MOSQ_ERR_NOT_FOUND){
|
||||
log__printf(mosq, MOSQ_LOG_WARNING, "Warning: Received PUBREC from %s for an unknown packet identifier %d.", mosq->id, mid);
|
||||
log__printf(mosq, MOSQ_LOG_WARNING, "Warning: Received PUBREC from %s for an unknown packet identifier %d.", SAFE_PRINT(mosq->id), mid);
|
||||
}else if(rc != MOSQ_ERR_SUCCESS){
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ int handle__pubrel(struct mosquitto *mosq)
|
||||
}
|
||||
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PUBREL from %s (Mid: %d)", mosq->id, mid);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received PUBREL from %s (Mid: %d)", SAFE_PRINT(mosq->id), mid);
|
||||
|
||||
/* Immediately free, we don't do anything with Reason String or User Property at the moment */
|
||||
mosquitto_property_free_all(&properties);
|
||||
@@ -105,7 +105,7 @@ int handle__pubrel(struct mosquitto *mosq)
|
||||
rc = send__pubcomp(mosq, mid, NULL);
|
||||
if(rc) return rc;
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREL (Mid: %d)", mosq->id, mid);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREL (Mid: %d)", SAFE_PRINT(mosq->id), mid);
|
||||
|
||||
rc = send__pubcomp(mosq, mid, NULL);
|
||||
if(rc){
|
||||
|
||||
@@ -60,9 +60,9 @@ int handle__suback(struct mosquitto *mosq)
|
||||
/* Client is not a bridge, so shouldn't be sending SUBACK */
|
||||
return MOSQ_ERR_PROTOCOL;
|
||||
}
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received SUBACK from %s", mosq->id);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received SUBACK from %s", SAFE_PRINT(mosq->id));
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received SUBACK", mosq->id);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received SUBACK", SAFE_PRINT(mosq->id));
|
||||
#endif
|
||||
rc = packet__read_uint16(&mosq->in_packet, &mid);
|
||||
if(rc) return rc;
|
||||
|
||||
@@ -60,9 +60,9 @@ int handle__unsuback(struct mosquitto *mosq)
|
||||
/* Client is not a bridge, so shouldn't be sending SUBACK */
|
||||
return MOSQ_ERR_PROTOCOL;
|
||||
}
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received UNSUBACK from %s", mosq->id);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Received UNSUBACK from %s", SAFE_PRINT(mosq->id));
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received UNSUBACK", mosq->id);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received UNSUBACK", SAFE_PRINT(mosq->id));
|
||||
#endif
|
||||
rc = packet__read_uint16(&mosq->in_packet, &mid);
|
||||
if(rc) return rc;
|
||||
|
||||
@@ -82,6 +82,8 @@ typedef SOCKET mosq_sock_t;
|
||||
typedef int mosq_sock_t;
|
||||
#endif
|
||||
|
||||
#define SAFE_PRINT(A) (A)?(A):"null"
|
||||
|
||||
enum mosquitto_msg_direction {
|
||||
mosq_md_in = 0,
|
||||
mosq_md_out = 1
|
||||
|
||||
@@ -198,10 +198,10 @@ int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session
|
||||
mosq->keepalive = keepalive;
|
||||
#ifdef WITH_BROKER
|
||||
# ifdef WITH_BRIDGE
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending CONNECT", clientid);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending CONNECT", SAFE_PRINT(clientid));
|
||||
# endif
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending CONNECT", clientid);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending CONNECT", SAFE_PRINT(clientid));
|
||||
#endif
|
||||
return packet__queue(mosq, packet);
|
||||
}
|
||||
|
||||
@@ -44,15 +44,15 @@ int send__disconnect(struct mosquitto *mosq, uint8_t reason_code, const mosquitt
|
||||
#ifdef WITH_BROKER
|
||||
# ifdef WITH_BRIDGE
|
||||
if(mosq->bridge){
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending DISCONNECT", mosq->id);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending DISCONNECT", SAFE_PRINT(mosq->id));
|
||||
}else
|
||||
# else
|
||||
{
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Sending DISCONNECT to %s (rc%d)", mosq->id, reason_code);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Sending DISCONNECT to %s (rc%d)", SAFE_PRINT(mosq->id), reason_code);
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending DISCONNECT", mosq->id);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending DISCONNECT", SAFE_PRINT(mosq->id));
|
||||
#endif
|
||||
assert(mosq);
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@ int send__pingreq(struct mosquitto *mosq)
|
||||
int rc;
|
||||
assert(mosq);
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PINGREQ to %s", mosq->id);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PINGREQ to %s", SAFE_PRINT(mosq->id));
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PINGREQ", mosq->id);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PINGREQ", SAFE_PRINT(mosq->id));
|
||||
#endif
|
||||
rc = send__simple_command(mosq, CMD_PINGREQ);
|
||||
if(rc == MOSQ_ERR_SUCCESS){
|
||||
@@ -60,9 +60,9 @@ int send__pingreq(struct mosquitto *mosq)
|
||||
int send__pingresp(struct mosquitto *mosq)
|
||||
{
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PINGRESP to %s", mosq->id);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PINGRESP to %s", SAFE_PRINT(mosq->id));
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PINGRESP", mosq->id);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PINGRESP", SAFE_PRINT(mosq->id));
|
||||
#endif
|
||||
return send__simple_command(mosq, CMD_PINGRESP);
|
||||
}
|
||||
@@ -70,9 +70,9 @@ int send__pingresp(struct mosquitto *mosq)
|
||||
int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties)
|
||||
{
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBACK to %s (m%d, rc%d)", mosq->id, mid, reason_code);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBACK to %s (m%d, rc%d)", SAFE_PRINT(mosq->id), mid, reason_code);
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBACK (m%d, rc%d)", mosq->id, mid, reason_code);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBACK (m%d, rc%d)", SAFE_PRINT(mosq->id), mid, reason_code);
|
||||
#endif
|
||||
util__increment_receive_quota(mosq);
|
||||
/* We don't use Reason String or User Property yet. */
|
||||
@@ -82,9 +82,9 @@ int send__puback(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, cons
|
||||
int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
|
||||
{
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBCOMP to %s (m%d)", mosq->id, mid);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBCOMP to %s (m%d)", SAFE_PRINT(mosq->id), mid);
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBCOMP (m%d)", mosq->id, mid);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBCOMP (m%d)", SAFE_PRINT(mosq->id), mid);
|
||||
#endif
|
||||
util__increment_receive_quota(mosq);
|
||||
/* We don't use Reason String or User Property yet. */
|
||||
@@ -95,9 +95,9 @@ int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property
|
||||
int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties)
|
||||
{
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREC to %s (m%d, rc%d)", mosq->id, mid, reason_code);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREC to %s (m%d, rc%d)", SAFE_PRINT(mosq->id), mid, reason_code);
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBREC (m%d, rc%d)", mosq->id, mid, reason_code);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBREC (m%d, rc%d)", SAFE_PRINT(mosq->id), mid, reason_code);
|
||||
#endif
|
||||
if(reason_code >= 0x80 && mosq->protocol == mosq_p_mqtt5){
|
||||
util__increment_receive_quota(mosq);
|
||||
@@ -109,9 +109,9 @@ int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, cons
|
||||
int send__pubrel(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
|
||||
{
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREL to %s (m%d)", mosq->id, mid);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBREL to %s (m%d)", SAFE_PRINT(mosq->id), mid);
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBREL (m%d)", mosq->id, mid);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBREL (m%d)", SAFE_PRINT(mosq->id), mid);
|
||||
#endif
|
||||
/* We don't use Reason String or User Property yet. */
|
||||
return send__command_with_mid(mosq, CMD_PUBREL|2, mid, false, 0, properties);
|
||||
|
||||
@@ -109,7 +109,7 @@ int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint3
|
||||
mosquitto__free(mapped_topic);
|
||||
mapped_topic = topic_temp;
|
||||
}
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBLISH to %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", mosq->id, dup, qos, retain, mid, mapped_topic, (long)payloadlen);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBLISH to %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", SAFE_PRINT(mosq->id), dup, qos, retain, mid, mapped_topic, (long)payloadlen);
|
||||
G_PUB_BYTES_SENT_INC(payloadlen);
|
||||
rc = send__real_publish(mosq, mid, mapped_topic, payloadlen, payload, qos, retain, dup, subscription_identifier, store_props, expiry_interval);
|
||||
mosquitto__free(mapped_topic);
|
||||
@@ -119,10 +119,10 @@ int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint3
|
||||
}
|
||||
}
|
||||
#endif
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBLISH to %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", mosq->id, dup, qos, retain, mid, topic, (long)payloadlen);
|
||||
log__printf(NULL, MOSQ_LOG_DEBUG, "Sending PUBLISH to %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", SAFE_PRINT(mosq->id), dup, qos, retain, mid, topic, (long)payloadlen);
|
||||
G_PUB_BYTES_SENT_INC(payloadlen);
|
||||
#else
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBLISH (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", mosq->id, dup, qos, retain, mid, topic, (long)payloadlen);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending PUBLISH (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", SAFE_PRINT(mosq->id), dup, qos, retain, mid, topic, (long)payloadlen);
|
||||
#endif
|
||||
|
||||
return send__real_publish(mosq, mid, topic, payloadlen, payload, qos, retain, dup, subscription_identifier, store_props, expiry_interval);
|
||||
@@ -209,7 +209,7 @@ int send__real_publish(struct mosquitto *mosq, uint16_t mid, const char *topic,
|
||||
}
|
||||
if(packet__check_oversize(mosq, packetlen)){
|
||||
#ifdef WITH_BROKER
|
||||
log__printf(NULL, MOSQ_LOG_NOTICE, "Dropping too large outgoing PUBLISH for %s (%d bytes)", mosq->id, packetlen);
|
||||
log__printf(NULL, MOSQ_LOG_NOTICE, "Dropping too large outgoing PUBLISH for %s (%d bytes)", SAFE_PRINT(mosq->id), packetlen);
|
||||
#else
|
||||
log__printf(NULL, MOSQ_LOG_NOTICE, "Dropping too large outgoing PUBLISH (%d bytes)", packetlen);
|
||||
#endif
|
||||
|
||||
@@ -83,11 +83,11 @@ int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, char *con
|
||||
|
||||
#ifdef WITH_BROKER
|
||||
# ifdef WITH_BRIDGE
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending SUBSCRIBE (Mid: %d, Topic: %s, QoS: %d, Options: 0x%02x)", mosq->id, local_mid, topic[0], topic_qos&0x03, topic_qos&0xFC);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending SUBSCRIBE (Mid: %d, Topic: %s, QoS: %d, Options: 0x%02x)", SAFE_PRINT(mosq->id), local_mid, topic[0], topic_qos&0x03, topic_qos&0xFC);
|
||||
# endif
|
||||
#else
|
||||
for(i=0; i<topic_count; i++){
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending SUBSCRIBE (Mid: %d, Topic: %s, QoS: %d, Options: 0x%02x)", mosq->id, local_mid, topic[i], topic_qos&0x03, topic_qos&0xFC);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending SUBSCRIBE (Mid: %d, Topic: %s, QoS: %d, Options: 0x%02x)", SAFE_PRINT(mosq->id), local_mid, topic[i], topic_qos&0x03, topic_qos&0xFC);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -83,12 +83,12 @@ int send__unsubscribe(struct mosquitto *mosq, int *mid, int topic_count, char *c
|
||||
#ifdef WITH_BROKER
|
||||
# ifdef WITH_BRIDGE
|
||||
for(i=0; i<topic_count; i++){
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", mosq->id, local_mid, topic[i]);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Bridge %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", SAFE_PRINT(mosq->id), local_mid, topic[i]);
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
for(i=0; i<topic_count; i++){
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", mosq->id, local_mid, topic[i]);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s sending UNSUBSCRIBE (Mid: %d, Topic: %s)", SAFE_PRINT(mosq->id), local_mid, topic[i]);
|
||||
}
|
||||
#endif
|
||||
return packet__queue(mosq, packet);
|
||||
|
||||
137
lib/util_topic.c
137
lib/util_topic.c
@@ -538,17 +538,134 @@ int mosquitto_topic_matches_sub(const char *sub, const char *topic, bool *result
|
||||
return topic_matches_sub(sub, topic, NULL, NULL, false, result);
|
||||
}
|
||||
|
||||
/* Does a topic match a subscription? */
|
||||
int mosquitto_topic_matches_sub2(const char *sub, size_t sublen, const char *topic, size_t topiclen, bool *result)
|
||||
{
|
||||
UNUSED(sublen);
|
||||
UNUSED(topiclen);
|
||||
|
||||
return topic_matches_sub(sub, topic, NULL, NULL, false, result);
|
||||
}
|
||||
|
||||
|
||||
int mosquitto_topic_matches_sub_with_pattern(const char *sub, const char *topic, const char *clientid, const char *username, bool *result)
|
||||
{
|
||||
return topic_matches_sub(sub, topic, clientid, username, true, result);
|
||||
}
|
||||
|
||||
/* Does a topic match a subscription? */
|
||||
int mosquitto_topic_matches_sub2(const char *sub, size_t sublen, const char *topic, size_t topiclen, bool *result)
|
||||
{
|
||||
size_t spos, tpos;
|
||||
|
||||
if(!result) return MOSQ_ERR_INVAL;
|
||||
*result = false;
|
||||
|
||||
if(!sub || !topic || !sublen || !topiclen){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
|
||||
if((sub[0] == '$' && topic[0] != '$')
|
||||
|| (topic[0] == '$' && sub[0] != '$')){
|
||||
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
spos = 0;
|
||||
tpos = 0;
|
||||
|
||||
while(spos < sublen){
|
||||
if(tpos < topiclen && (topic[tpos] == '+' || topic[tpos] == '#')){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
if(tpos == topiclen || sub[spos] != topic[tpos]){
|
||||
if(sub[spos] == '+'){
|
||||
/* Check for bad "+foo" or "a/+foo" subscription */
|
||||
if(spos > 0 && sub[spos-1] != '/'){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
/* Check for bad "foo+" or "foo+/a" subscription */
|
||||
if(spos+1 < sublen && sub[spos+1] != '/'){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
spos++;
|
||||
while(tpos < topiclen && topic[tpos] != '/'){
|
||||
if(topic[tpos] == '+' || topic[tpos] == '#'){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
tpos++;
|
||||
}
|
||||
if(tpos == topiclen && spos == sublen){
|
||||
*result = true;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
}else if(sub[spos] == '#'){
|
||||
/* Check for bad "foo#" subscription */
|
||||
if(spos > 0 && sub[spos-1] != '/'){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
/* Check for # not the final character of the sub, e.g. "#foo" */
|
||||
if(spos+1 < sublen){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}else{
|
||||
while(tpos < topiclen){
|
||||
if(topic[tpos] == '+' || topic[tpos] == '#'){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
tpos++;
|
||||
}
|
||||
*result = true;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
}else{
|
||||
/* Check for e.g. foo/bar matching foo/+/# */
|
||||
if(tpos == topiclen
|
||||
&& spos > 0
|
||||
&& sub[spos-1] == '+'
|
||||
&& sub[spos] == '/'
|
||||
&& spos+1 < sublen
|
||||
&& sub[spos+1] == '#')
|
||||
{
|
||||
*result = true;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/* There is no match at this point, but is the sub invalid? */
|
||||
while(spos < sublen){
|
||||
if(sub[spos] == '#' && spos+1 < sublen){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
spos++;
|
||||
}
|
||||
|
||||
/* Valid input, but no match */
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
}else{
|
||||
/* sub[spos] == topic[tpos] */
|
||||
if(tpos+1 == topiclen){
|
||||
/* Check for e.g. foo matching foo/# */
|
||||
if(spos+3 == sublen
|
||||
&& sub[spos+1] == '/'
|
||||
&& sub[spos+2] == '#'){
|
||||
*result = true;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
}
|
||||
spos++;
|
||||
tpos++;
|
||||
if(spos == sublen && tpos == topiclen){
|
||||
*result = true;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}else if(tpos == topiclen && sub[spos] == '+' && spos+1 == sublen){
|
||||
if(spos > 0 && sub[spos-1] != '/'){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
spos++;
|
||||
*result = true;
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tpos < topiclen || spos < sublen){
|
||||
*result = false;
|
||||
}
|
||||
while(tpos < topiclen){
|
||||
if(topic[tpos] == '+' || topic[tpos] == '#'){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
tpos++;
|
||||
}
|
||||
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -54,10 +54,12 @@ if(CJSON_FOUND AND WITH_TLS)
|
||||
target_link_libraries(mosquitto_dynamic_security ${CJSON_LIBRARIES} ${OPENSSL_LIBRARIES})
|
||||
if(WIN32)
|
||||
target_link_libraries(mosquitto_dynamic_security mosquitto)
|
||||
install(TARGETS mosquitto_dynamic_security
|
||||
DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
else()
|
||||
install(TARGETS mosquitto_dynamic_security
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
|
||||
install(TARGETS mosquitto_dynamic_security
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
MAJOR=2
|
||||
MINOR=0
|
||||
REVISION=13
|
||||
REVISION=14
|
||||
|
||||
sed -i "s/^VERSION=.*/VERSION=${MAJOR}.${MINOR}.${REVISION}/" config.mk
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: mosquitto
|
||||
version: 2.0.13
|
||||
version: 2.0.14
|
||||
summary: Eclipse Mosquitto MQTT broker
|
||||
description: This is a message broker that supports version 5.0, 3.1.1, and 3.1 of the MQTT
|
||||
protocol.
|
||||
|
||||
@@ -38,6 +38,7 @@ int handle__connack(struct mosquitto *context)
|
||||
uint16_t server_keepalive;
|
||||
uint16_t max_topic_alias;
|
||||
uint8_t retain_available;
|
||||
uint16_t inflight_maximum;
|
||||
uint8_t max_qos = 255;
|
||||
|
||||
if(context == NULL){
|
||||
@@ -84,9 +85,12 @@ int handle__connack(struct mosquitto *context)
|
||||
}
|
||||
|
||||
/* receive-maximum */
|
||||
mosquitto_property_read_int16(properties, MQTT_PROP_RECEIVE_MAXIMUM,
|
||||
&context->msgs_out.inflight_maximum, false);
|
||||
context->msgs_out.inflight_quota = context->msgs_out.inflight_maximum;
|
||||
inflight_maximum = context->msgs_out.inflight_maximum;
|
||||
mosquitto_property_read_int16(properties, MQTT_PROP_RECEIVE_MAXIMUM, &inflight_maximum, false);
|
||||
if(context->msgs_out.inflight_maximum != inflight_maximum){
|
||||
context->msgs_out.inflight_maximum = inflight_maximum;
|
||||
db__message_reconnect_reset(context);
|
||||
}
|
||||
|
||||
/* retain-available */
|
||||
if(mosquitto_property_read_byte(properties, MQTT_PROP_RETAIN_AVAILABLE,
|
||||
|
||||
@@ -11,6 +11,16 @@ static void match_helper(const char *sub, const char *topic)
|
||||
rc = mosquitto_topic_matches_sub(sub, topic, &match);
|
||||
CU_ASSERT_EQUAL(rc, MOSQ_ERR_SUCCESS);
|
||||
CU_ASSERT_EQUAL(match, true);
|
||||
if(match == false){
|
||||
printf("1: %s:%s\n", sub, topic);
|
||||
}
|
||||
|
||||
rc = mosquitto_topic_matches_sub2(sub, strlen(sub), topic, strlen(topic), &match);
|
||||
CU_ASSERT_EQUAL(rc, MOSQ_ERR_SUCCESS);
|
||||
CU_ASSERT_EQUAL(match, true);
|
||||
if(match == false){
|
||||
printf("2: %s:%s\n", sub, topic);
|
||||
}
|
||||
}
|
||||
|
||||
static void no_match_helper(int rc_expected, const char *sub, const char *topic)
|
||||
@@ -24,6 +34,13 @@ static void no_match_helper(int rc_expected, const char *sub, const char *topic)
|
||||
printf("%d:%d %s:%s\n", rc, rc_expected, sub, topic);
|
||||
}
|
||||
CU_ASSERT_EQUAL(match, false);
|
||||
|
||||
rc = mosquitto_topic_matches_sub2(sub, strlen(sub), topic, strlen(topic), &match);
|
||||
CU_ASSERT_EQUAL(rc, rc_expected);
|
||||
if(rc != rc_expected){
|
||||
printf("%d:%d %s:%s\n", rc, rc_expected, sub, topic);
|
||||
}
|
||||
CU_ASSERT_EQUAL(match, false);
|
||||
}
|
||||
|
||||
/* ========================================================================
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
# Source
|
||||
|
||||
* [mosquitto-2.0.13.tar.gz](https://mosquitto.org/files/source/mosquitto-2.0.13.tar.gz) ([GPG signature](https://mosquitto.org/files/source/mosquitto-2.0.13.tar.gz.asc))
|
||||
* [mosquitto-2.0.14.tar.gz](https://mosquitto.org/files/source/mosquitto-2.0.14.tar.gz) ([GPG signature](https://mosquitto.org/files/source/mosquitto-2.0.14.tar.gz.asc))
|
||||
* [Git source code repository](https://github.com/eclipse/mosquitto) (github.com)
|
||||
|
||||
Older downloads are available at [https://mosquitto.org/files/](../files/)
|
||||
@@ -24,8 +24,8 @@ distributions.
|
||||
|
||||
## Windows
|
||||
|
||||
* [mosquitto-2.0.13-install-windows-x64.exe](https://mosquitto.org/files/binary/win64/mosquitto-2.0.13-install-windows-x64.exe) (64-bit build, Windows Vista and up, built with Visual Studio Community 2019)
|
||||
* [mosquitto-2.0.13-install-windows-x32.exe](https://mosquitto.org/files/binary/win32/mosquitto-2.0.13-install-windows-x86.exe) (32-bit build, Windows Vista and up, built with Visual Studio Community 2019)
|
||||
* [mosquitto-2.0.14-install-windows-x64.exe](https://mosquitto.org/files/binary/win64/mosquitto-2.0.14-install-windows-x64.exe) (64-bit build, Windows Vista and up, built with Visual Studio Community 2019)
|
||||
* [mosquitto-2.0.14-install-windows-x32.exe](https://mosquitto.org/files/binary/win32/mosquitto-2.0.14-install-windows-x86.exe) (32-bit build, Windows Vista and up, built with Visual Studio Community 2019)
|
||||
|
||||
Older installers can be found at [https://mosquitto.org/files/binary/](https://mosquitto.org/files/binary/).
|
||||
|
||||
|
||||
@@ -9,10 +9,7 @@
|
||||
.. type: text
|
||||
-->
|
||||
|
||||
Versions 2.0.13 of Mosquitto has been released. This is a and bugfix release.
|
||||
|
||||
2.0.13 - 2021-10-27
|
||||
===================
|
||||
Version 2.0.13 of Mosquitto has been released. This is a bugfix release.
|
||||
|
||||
# Broker
|
||||
- Fix `max_keepalive` option not being able to be set to 0.
|
||||
|
||||
23
www/posts/2021/11/version-2-0-14-released.md
Normal file
23
www/posts/2021/11/version-2-0-14-released.md
Normal file
@@ -0,0 +1,23 @@
|
||||
<!--
|
||||
.. title: Version 2.0.14 released.
|
||||
.. slug: version-2-0-14-released
|
||||
.. date: 2021-11-17 00:25:38 UTC
|
||||
.. tags: Releases
|
||||
.. category:
|
||||
.. link:
|
||||
.. description:
|
||||
.. type: text
|
||||
-->
|
||||
|
||||
Versions 2.0.14 of Mosquitto has been released. This is a bugfix release.
|
||||
|
||||
# Broker
|
||||
- Fix bridge not respecting receive-maximum when reconnecting with MQTT v5.
|
||||
|
||||
# Client library
|
||||
- Fix `mosquitto_topic_matches_sub2()` not using the length parameters.
|
||||
Closes [#2364].
|
||||
- Fix incorrect `subscribe_callback` in mosquittopp.h. Closes [#2367].
|
||||
|
||||
[#2364]: https://github.com/eclipse/mosquitto/issues/2364
|
||||
[#2367]: https://github.com/eclipse/mosquitto/issues/2367
|
||||
Reference in New Issue
Block a user