Merge branch 'fixes'

This commit is contained in:
Roger A. Light 2020-08-19 14:47:27 +01:00
commit 0bdf630c27
23 changed files with 339 additions and 94 deletions

View File

@ -11,7 +11,7 @@ project(mosquitto)
cmake_minimum_required(VERSION 2.8)
# Only for version 3 and up. cmake_policy(SET CMP0042 NEW)
set (VERSION 1.6.11)
set (VERSION 1.6.12)
add_definitions (-DCMAKE -DVERSION=\"${VERSION}\")

View File

@ -1,3 +1,24 @@
1.6.12 - 2020-08-19
===================
Security:
- In some circumstances, Mosquitto could leak memory when handling PUBLISH
messages. This is limited to incoming QoS 2 messages, and is related
to the combination of the broker having persistence enabled, a clean
session=false client, which was connected prior to the broker restarting,
then has reconnected and has now sent messages at a sufficiently high rate
that the incoming queue at the broker has filled up and hence messages are
being dropped. This is more likely to have an effect where
max_queued_messages is a small value. This has now been fixed. Closes #1793.
Broker:
- Build warning fixes when building with WITH_BRIDGE=no and WITH_TLS=no.
Clients:
- All clients exit with an error exit code on CONNACK failure. Closes #1778.
- Don't busy loop with `mosquitto_pub -l` on a slow connection.
1.6.11 - 2020-08-11
===================

View File

@ -46,6 +46,7 @@ static bool disconnect_sent = false;
static int publish_count = 0;
static bool ready_for_repeat = false;
static volatile int status = STATUS_CONNECTING;
static int connack_result = 0;
#ifdef WIN32
static uint64_t next_publish_tv;
@ -129,6 +130,8 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
UNUSED(flags);
UNUSED(properties);
connack_result = result;
if(!result){
switch(cfg.pub_mode){
case MSGMODE_CMD:
@ -232,6 +235,17 @@ int pub_stdin_line_loop(struct mosquitto *mosq)
mosquitto_loop_start(mosq);
stdin_finished = false;
do{
if(status == STATUS_CONNECTING){
#ifdef WIN32
Sleep(100);
#else
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 100000000;
nanosleep(&ts, NULL);
#endif
}
if(status == STATUS_CONNACK_RECVD){
pos = 0;
read_len = line_buf_len;
@ -555,7 +569,11 @@ int main(int argc, char *argv[])
if(rc){
err_printf(&cfg, "Error: %s\n", mosquitto_strerror(rc));
}
return rc;
if(connack_result){
return connack_result;
}else{
return rc;
}
cleanup:
mosquitto_lib_cleanup();

View File

@ -52,6 +52,7 @@ extern struct mosq_config cfg;
bool process_messages = true;
int msg_count = 0;
struct mosquitto *mosq = NULL;
static int connack_result = 0;
#ifndef WIN32
void my_signal_handler(int signum)
@ -117,6 +118,7 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit
void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flags, const mosquitto_property *properties)
{
connack_result = result;
if(!result){
client_state = rr_s_connected;
mosquitto_subscribe_v5(mosq, NULL, cfg.response_topic, cfg.qos, 0, cfg.subscribe_props);
@ -363,7 +365,11 @@ int main(int argc, char *argv[])
if(rc){
err_printf(&cfg, "Error: %s\n", mosquitto_strerror(rc));
}
return rc;
if(connack_result){
return connack_result;
}else{
return rc;
}
cleanup:
mosquitto_lib_cleanup();

View File

@ -40,6 +40,7 @@ bool process_messages = true;
int msg_count = 0;
struct mosquitto *mosq = NULL;
int last_mid = 0;
static int connack_result = 0;
#ifndef WIN32
void my_signal_handler(int signum)
@ -117,6 +118,7 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
UNUSED(flags);
UNUSED(properties);
connack_result = result;
if(!result){
mosquitto_subscribe_multiple(mosq, NULL, cfg.topic_count, cfg.topics, cfg.qos, cfg.sub_opts, cfg.subscribe_props);
@ -371,7 +373,11 @@ int main(int argc, char *argv[])
if(rc){
err_printf(&cfg, "Error: %s\n", mosquitto_strerror(rc));
}
return rc;
if(connack_result){
return connack_result;
}else{
return rc;
}
cleanup:
mosquitto_destroy(mosq);

View File

@ -109,7 +109,7 @@ WITH_COVERAGE:=no
# Also bump lib/mosquitto.h, CMakeLists.txt,
# installer/mosquitto.nsi, installer/mosquitto64.nsi
VERSION=1.6.11
VERSION=1.6.12
# Client library SO version. Bump if incompatible API/ABI changes are made.
SOVERSION=1

View File

@ -9,7 +9,7 @@
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
Name "Eclipse Mosquitto"
!define VERSION 1.6.11
!define VERSION 1.6.12
OutFile "mosquitto-${VERSION}-install-windows-x86.exe"
InstallDir "$PROGRAMFILES\mosquitto"

View File

@ -9,7 +9,7 @@
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
Name "Eclipse Mosquitto"
!define VERSION 1.6.11
!define VERSION 1.6.12
OutFile "mosquitto-${VERSION}-install-windows-x64.exe"
!include "x64.nsh"

View File

@ -48,7 +48,7 @@ extern "C" {
#define LIBMOSQUITTO_MAJOR 1
#define LIBMOSQUITTO_MINOR 6
#define LIBMOSQUITTO_REVISION 11
#define LIBMOSQUITTO_REVISION 12
/* 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)
@ -1511,6 +1511,39 @@ libmosq_EXPORT int mosquitto_int_option(struct mosquitto *mosq, enum mosq_opt_t
*/
libmosq_EXPORT int mosquitto_void_option(struct mosquitto *mosq, enum mosq_opt_t option, void *value);
/*
* Function: mosquitto_string_option
*
* Used to set const char* options for the client.
*
* Parameters:
* mosq - a valid mosquitto instance.
* option - the option to set.
* value - the option specific value.
*
* Options:
* MOSQ_OPT_TLS_ENGINE
* Configure the client for TLS Engine support. Pass a TLS Engine ID
* to be used when creating TLS connections.
* Must be set before <mosquitto_connect>.
* MOSQ_OPT_TLS_KEYFORM
* Configure the client to treat the keyfile differently depending
* on its type. Must be set before <mosquitto_connect>.
* Set as either "pem" or "engine", to determine from where the
* private key for a TLS connection will be obtained. Defaults to
* "pem", a normal private key file.
* MOSQ_OPT_TLS_KPASS_SHA1
* Where the TLS Engine requires the use of a password to be
* accessed, this option allows a hex encoded SHA1 hash of the
* private key password to be passed to the engine directly.
* Must be set before <mosquitto_connect>.
* MOSQ_OPT_TLS_ALPN
* If the broker being connected to has multiple services available
* on a single TLS port, such as both MQTT and WebSockets, use this
* option to configure the ALPN option for the connection.
*/
libmosq_EXPORT int mosquitto_string_option(struct mosquitto *mosq, enum mosq_opt_t option, const char *value);
/*
* Function: mosquitto_reconnect_delay_set
@ -2063,77 +2096,6 @@ libmosq_EXPORT void mosquitto_unsubscribe_v5_callback_set(struct mosquitto *mosq
*/
libmosq_EXPORT void mosquitto_log_callback_set(struct mosquitto *mosq, void (*on_log)(struct mosquitto *, void *, int, const char *));
/*
* Function: mosquitto_string_option
*
* Used to set const char* options for the client.
*
* Parameters:
* mosq - a valid mosquitto instance.
* option - the option to set.
* value - the option specific value.
*
* Options:
* MOSQ_OPT_TLS_ENGINE
* Configure the client for TLS Engine support. Pass a TLS Engine ID
* to be used when creating TLS connections.
* Must be set before <mosquitto_connect>.
* MOSQ_OPT_TLS_KEYFORM
* Configure the client to treat the keyfile differently depending
* on its type. Must be set before <mosquitto_connect>.
* Set as either "pem" or "engine", to determine from where the
* private key for a TLS connection will be obtained. Defaults to
* "pem", a normal private key file.
* MOSQ_OPT_TLS_KPASS_SHA1
* Where the TLS Engine requires the use of a password to be
* accessed, this option allows a hex encoded SHA1 hash of the
* private key password to be passed to the engine directly.
* Must be set before <mosquitto_connect>.
* MOSQ_OPT_TLS_ALPN
* If the broker being connected to has multiple services available
* on a single TLS port, such as both MQTT and WebSockets, use this
* option to configure the ALPN option for the connection.
*/
libmosq_EXPORT int mosquitto_string_option(struct mosquitto *mosq, enum mosq_opt_t option, const char *value);
/*
* Function: mosquitto_reconnect_delay_set
*
* Control the behaviour of the client when it has unexpectedly disconnected in
* <mosquitto_loop_forever> or after <mosquitto_loop_start>. The default
* behaviour if this function is not used is to repeatedly attempt to reconnect
* with a delay of 1 second until the connection succeeds.
*
* Use reconnect_delay parameter to change the delay between successive
* reconnection attempts. You may also enable exponential backoff of the time
* between reconnections by setting reconnect_exponential_backoff to true and
* set an upper bound on the delay with reconnect_delay_max.
*
* Example 1:
* delay=2, delay_max=10, exponential_backoff=False
* Delays would be: 2, 4, 6, 8, 10, 10, ...
*
* Example 2:
* delay=3, delay_max=30, exponential_backoff=True
* Delays would be: 3, 6, 12, 24, 30, 30, ...
*
* Parameters:
* mosq - a valid mosquitto instance.
* reconnect_delay - the number of seconds to wait between
* reconnects.
* reconnect_delay_max - the maximum number of seconds to wait
* between reconnects.
* reconnect_exponential_backoff - use exponential backoff between
* reconnect attempts. Set to true to enable
* exponential backoff.
*
* Returns:
* MOSQ_ERR_SUCCESS - on success.
* MOSQ_ERR_INVAL - if the input parameters were invalid.
*/
libmosq_EXPORT int mosquitto_reconnect_delay_set(struct mosquitto *mosq, unsigned int reconnect_delay, unsigned int reconnect_delay_max, bool reconnect_exponential_backoff);
/* =============================================================================
*

View File

@ -20,11 +20,13 @@ Contributors:
#include <time.h>
#endif
#if defined(WITH_THREADING)
#if defined(__linux__) || defined(__NetBSD__)
# include <pthread.h>
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
# include <pthread_np.h>
#endif
#endif
#include "mosquitto_internal.h"
#include "net_mosq.h"

View File

@ -109,6 +109,64 @@
</refsect1>
<refsect1>
<title>Exit Status</title>
<para>
mosquitto_sub returns zero on success, or non-zero on error. If
the connection is refused by the broker at the MQTT level, then
the exit code is the CONNACK reason code. If another error
occurs, the exit code is a libmosquitto return value.
</para>
<para>MQTT v3.1.1 CONNACK codes:</para>
<itemizedlist mark="circle">
<listitem><para><option>0</option> Success</para></listitem>
<listitem><para><option>1</option> Connection refused: Bad protocol version</para></listitem>
<listitem><para><option>2</option> Connection refused: Identifier rejected</para></listitem>
<listitem><para><option>3</option> Connection refused: Server unavailable</para></listitem>
<listitem><para><option>4</option> Connection refused: Bad username/password</para></listitem>
<listitem><para><option>5</option> Connection refused: Not authorized</para></listitem>
</itemizedlist>
<para>MQTT v5 CONNACK codes:</para>
<itemizedlist>
<listitem><para><option>0</option> Success</para></listitem>
<listitem><para><option>128</option> Unspecified error</para></listitem>
<listitem><para><option>129</option> Malformed packet</para></listitem>
<listitem><para><option>130</option> Protocol error</para></listitem>
<listitem><para><option>131</option> Implementation specific error</para></listitem>
<listitem><para><option>132</option> Unsupported protocol version</para></listitem>
<listitem><para><option>133</option> Client ID not valid</para></listitem>
<listitem><para><option>134</option> Bad username or password</para></listitem>
<listitem><para><option>135</option> Not authorized</para></listitem>
<listitem><para><option>136</option> Server unavailable</para></listitem>
<listitem><para><option>137</option> Server busy</para></listitem>
<listitem><para><option>138</option> Banned</para></listitem>
<listitem><para><option>139</option> Server shutting down</para></listitem>
<listitem><para><option>140</option> Bad authentication method</para></listitem>
<listitem><para><option>141</option> Keep alive timeout</para></listitem>
<listitem><para><option>142</option> Session taken over</para></listitem>
<listitem><para><option>143</option> Topic filter invalid</para></listitem>
<listitem><para><option>144</option> Topic name invalid</para></listitem>
<listitem><para><option>147</option> Receive maximum exceeded</para></listitem>
<listitem><para><option>148</option> Topic alias invalid</para></listitem>
<listitem><para><option>149</option> Packet too large</para></listitem>
<listitem><para><option>148</option> Message rate too high</para></listitem>
<listitem><para><option>151</option> Quota exceeded</para></listitem>
<listitem><para><option>152</option> Administrative action</para></listitem>
<listitem><para><option>153</option> Payload format invalid</para></listitem>
<listitem><para><option>154</option> Retain not supported</para></listitem>
<listitem><para><option>155</option> QoS not supported</para></listitem>
<listitem><para><option>156</option> Use another server</para></listitem>
<listitem><para><option>157</option> Server moved</para></listitem>
<listitem><para><option>158</option> Shared subscriptions not supported</para></listitem>
<listitem><para><option>159</option> Connection rate exceeded</para></listitem>
<listitem><para><option>160</option> Maximum connect time</para></listitem>
<listitem><para><option>161</option> Subscription IDs not supported</para></listitem>
<listitem><para><option>162</option> Wildcard subscriptions not supported</para></listitem>
</itemizedlist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>Add a user to a new password file:</para>

View File

@ -654,6 +654,64 @@
</refsect2>
</refsect1>
<refsect1>
<title>Exit Status</title>
<para>
mosquitto_sub returns zero on success, or non-zero on error. If
the connection is refused by the broker at the MQTT level, then
the exit code is the CONNACK reason code. If another error
occurs, the exit code is a libmosquitto return value.
</para>
<para>MQTT v3.1.1 CONNACK codes:</para>
<itemizedlist mark="circle">
<listitem><para><option>0</option> Success</para></listitem>
<listitem><para><option>1</option> Connection refused: Bad protocol version</para></listitem>
<listitem><para><option>2</option> Connection refused: Identifier rejected</para></listitem>
<listitem><para><option>3</option> Connection refused: Server unavailable</para></listitem>
<listitem><para><option>4</option> Connection refused: Bad username/password</para></listitem>
<listitem><para><option>5</option> Connection refused: Not authorized</para></listitem>
</itemizedlist>
<para>MQTT v5 CONNACK codes:</para>
<itemizedlist>
<listitem><para><option>0</option> Success</para></listitem>
<listitem><para><option>128</option> Unspecified error</para></listitem>
<listitem><para><option>129</option> Malformed packet</para></listitem>
<listitem><para><option>130</option> Protocol error</para></listitem>
<listitem><para><option>131</option> Implementation specific error</para></listitem>
<listitem><para><option>132</option> Unsupported protocol version</para></listitem>
<listitem><para><option>133</option> Client ID not valid</para></listitem>
<listitem><para><option>134</option> Bad username or password</para></listitem>
<listitem><para><option>135</option> Not authorized</para></listitem>
<listitem><para><option>136</option> Server unavailable</para></listitem>
<listitem><para><option>137</option> Server busy</para></listitem>
<listitem><para><option>138</option> Banned</para></listitem>
<listitem><para><option>139</option> Server shutting down</para></listitem>
<listitem><para><option>140</option> Bad authentication method</para></listitem>
<listitem><para><option>141</option> Keep alive timeout</para></listitem>
<listitem><para><option>142</option> Session taken over</para></listitem>
<listitem><para><option>143</option> Topic filter invalid</para></listitem>
<listitem><para><option>144</option> Topic name invalid</para></listitem>
<listitem><para><option>147</option> Receive maximum exceeded</para></listitem>
<listitem><para><option>148</option> Topic alias invalid</para></listitem>
<listitem><para><option>149</option> Packet too large</para></listitem>
<listitem><para><option>148</option> Message rate too high</para></listitem>
<listitem><para><option>151</option> Quota exceeded</para></listitem>
<listitem><para><option>152</option> Administrative action</para></listitem>
<listitem><para><option>153</option> Payload format invalid</para></listitem>
<listitem><para><option>154</option> Retain not supported</para></listitem>
<listitem><para><option>155</option> QoS not supported</para></listitem>
<listitem><para><option>156</option> Use another server</para></listitem>
<listitem><para><option>157</option> Server moved</para></listitem>
<listitem><para><option>158</option> Shared subscriptions not supported</para></listitem>
<listitem><para><option>159</option> Connection rate exceeded</para></listitem>
<listitem><para><option>160</option> Maximum connect time</para></listitem>
<listitem><para><option>161</option> Subscription IDs not supported</para></listitem>
<listitem><para><option>162</option> Wildcard subscriptions not supported</para></listitem>
</itemizedlist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>Publish temperature information to localhost with QoS 1:</para>

View File

@ -893,6 +893,64 @@ mosquitto_sub -t 'bbc/#' -T bbc/bbc1 --remove-retained</programlisting>
</refsect2>
</refsect1>
<refsect1>
<title>Exit Status</title>
<para>
mosquitto_sub returns zero on success, or non-zero on error. If
the connection is refused by the broker at the MQTT level, then
the exit code is the CONNACK reason code. If another error
occurs, the exit code is a libmosquitto return value.
</para>
<para>MQTT v3.1.1 CONNACK codes:</para>
<itemizedlist mark="circle">
<listitem><para><option>0</option> Success</para></listitem>
<listitem><para><option>1</option> Connection refused: Bad protocol version</para></listitem>
<listitem><para><option>2</option> Connection refused: Identifier rejected</para></listitem>
<listitem><para><option>3</option> Connection refused: Server unavailable</para></listitem>
<listitem><para><option>4</option> Connection refused: Bad username/password</para></listitem>
<listitem><para><option>5</option> Connection refused: Not authorized</para></listitem>
</itemizedlist>
<para>MQTT v5 CONNACK codes:</para>
<itemizedlist>
<listitem><para><option>0</option> Success</para></listitem>
<listitem><para><option>128</option> Unspecified error</para></listitem>
<listitem><para><option>129</option> Malformed packet</para></listitem>
<listitem><para><option>130</option> Protocol error</para></listitem>
<listitem><para><option>131</option> Implementation specific error</para></listitem>
<listitem><para><option>132</option> Unsupported protocol version</para></listitem>
<listitem><para><option>133</option> Client ID not valid</para></listitem>
<listitem><para><option>134</option> Bad username or password</para></listitem>
<listitem><para><option>135</option> Not authorized</para></listitem>
<listitem><para><option>136</option> Server unavailable</para></listitem>
<listitem><para><option>137</option> Server busy</para></listitem>
<listitem><para><option>138</option> Banned</para></listitem>
<listitem><para><option>139</option> Server shutting down</para></listitem>
<listitem><para><option>140</option> Bad authentication method</para></listitem>
<listitem><para><option>141</option> Keep alive timeout</para></listitem>
<listitem><para><option>142</option> Session taken over</para></listitem>
<listitem><para><option>143</option> Topic filter invalid</para></listitem>
<listitem><para><option>144</option> Topic name invalid</para></listitem>
<listitem><para><option>147</option> Receive maximum exceeded</para></listitem>
<listitem><para><option>148</option> Topic alias invalid</para></listitem>
<listitem><para><option>149</option> Packet too large</para></listitem>
<listitem><para><option>148</option> Message rate too high</para></listitem>
<listitem><para><option>151</option> Quota exceeded</para></listitem>
<listitem><para><option>152</option> Administrative action</para></listitem>
<listitem><para><option>153</option> Payload format invalid</para></listitem>
<listitem><para><option>154</option> Retain not supported</para></listitem>
<listitem><para><option>155</option> QoS not supported</para></listitem>
<listitem><para><option>156</option> Use another server</para></listitem>
<listitem><para><option>157</option> Server moved</para></listitem>
<listitem><para><option>158</option> Shared subscriptions not supported</para></listitem>
<listitem><para><option>159</option> Connection rate exceeded</para></listitem>
<listitem><para><option>160</option> Maximum connect time</para></listitem>
<listitem><para><option>161</option> Subscription IDs not supported</para></listitem>
<listitem><para><option>162</option> Wildcard subscriptions not supported</para></listitem>
</itemizedlist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>Note that these really are examples - the subscriptions will work

View File

@ -2,7 +2,7 @@
MAJOR=1
MINOR=6
REVISION=11
REVISION=12
sed -i "s/^VERSION=.*/VERSION=${MAJOR}.${MINOR}.${REVISION}/" config.mk

View File

@ -1,5 +1,5 @@
name: mosquitto
version: 1.6.11
version: 1.6.12
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.

View File

@ -152,6 +152,8 @@ if (UNIX)
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
set (MOSQ_LIBS ${MOSQ_LIBS} m)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set (MOSQ_LIBS ${MOSQ_LIBS} m)
elseif(QNX)
set(MOSQ_LIBS ${MOSQ_LIBS} m socket)
else(APPLE)

View File

@ -760,6 +760,7 @@ int config__read(struct mosquitto_db *db, struct mosquitto__config *config, bool
}
#ifdef WITH_BRIDGE
static int config__create_bridge_remap_topic(const char *prefix, const char *topic, char **remap_topic)
{
int len;
@ -827,6 +828,7 @@ static int config__create_bridge_prefix(char **prefix, const char *topic, const
return MOSQ_ERR_SUCCESS;
}
#endif
int config__read_file_core(struct mosquitto__config *config, bool reload, struct config_recurse *cr, int level, int *lineno, FILE *fptr, char **buf, int *buflen)
@ -849,8 +851,10 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
int lineno_ext = 0;
char **files;
int file_count;
#ifdef WITH_TLS
char *kpass_sha = NULL, *kpass_sha_bin = NULL;
char *keyform ;
#endif
*lineno = 0;

View File

@ -37,7 +37,7 @@ static unsigned long max_queued_bytes = 0;
* @param qos qos for the packet of interest
* @return true if more in flight are allowed.
*/
static bool db__ready_for_flight(struct mosquitto_msg_data *msgs, int qos)
bool db__ready_for_flight(struct mosquitto_msg_data *msgs, int qos)
{
bool valid_bytes;
bool valid_count;
@ -68,7 +68,7 @@ static bool db__ready_for_flight(struct mosquitto_msg_data *msgs, int qos)
* @param qos destination qos for the packet of interest
* @return true if queuing is allowed, false if should be dropped
*/
static bool db__ready_for_queue(struct mosquitto *context, int qos, struct mosquitto_msg_data *msg_data)
bool db__ready_for_queue(struct mosquitto *context, int qos, struct mosquitto_msg_data *msg_data)
{
int source_count;
int adjust_count;

View File

@ -302,12 +302,21 @@ int handle__publish(struct mosquitto_db *db, struct mosquitto *context)
db__message_store_find(context, mid, &stored);
}
if(!stored){
dup = 0;
if(db__message_store(db, context, mid, topic, qos, payloadlen, &payload, retain, &stored, message_expiry_interval, msg_properties, 0, mosq_mo_client)){
mosquitto_property_free_all(&msg_properties);
return 1;
if(qos == 0
|| db__ready_for_flight(&context->msgs_in, qos)
|| db__ready_for_queue(context, qos, &context->msgs_in)){
dup = 0;
if(db__message_store(db, context, mid, topic, qos, payloadlen, &payload, retain, &stored, message_expiry_interval, msg_properties, 0, mosq_mo_client)){
mosquitto_property_free_all(&msg_properties);
return 1;
}
msg_properties = NULL; /* Now belongs to db__message_store() */
}else{
/* Client isn't allowed any more incoming messages, so fail early */
reason_code = MQTT_RC_QUOTA_EXCEEDED;
goto process_bad_message;
}
msg_properties = NULL; /* Now belongs to db__message_store() */
}else{
mosquitto__free(topic);
topic = stored->topic;
@ -340,6 +349,7 @@ int handle__publish(struct mosquitto_db *db, struct mosquitto *context)
}
/* db__message_insert() returns 2 to indicate dropped message
* due to queue. This isn't an error so don't disconnect them. */
/* FIXME - this is no longer necessary due to failing early above */
if(!res){
if(send__pubrec(context, mid, 0)) rc = 1;
}else if(res == 1){

View File

@ -629,6 +629,8 @@ void db__msg_store_ref_dec(struct mosquitto_db *db, struct mosquitto_msg_store *
void db__msg_store_clean(struct mosquitto_db *db);
void db__msg_store_compact(struct mosquitto_db *db);
int db__message_reconnect_reset(struct mosquitto_db *db, struct mosquitto *context);
bool db__ready_for_flight(struct mosquitto_msg_data *msgs, int qos);
bool db__ready_for_queue(struct mosquitto *context, int qos, struct mosquitto_msg_data *msg_data);
void sys_tree__init(struct mosquitto_db *db);
void sys_tree__update(struct mosquitto_db *db, int interval, time_t start_time);

View File

@ -115,7 +115,10 @@ int persist__chunk_client_msg_write_v6(FILE *db_fptr, struct P_client_msg *chunk
return MOSQ_ERR_NOMEM;
}
rc = property__write_all(&prop_packet, chunk->properties, true);
if(rc) return rc;
if(rc){
mosquitto__free(prop_packet.payload);
return rc;
}
write_e(db_fptr, prop_packet.payload, proplen);
mosquitto__free(prop_packet.payload);
@ -179,7 +182,10 @@ int persist__chunk_message_store_write_v6(FILE *db_fptr, struct P_msg_store *chu
return MOSQ_ERR_NOMEM;
}
rc = property__write_all(&prop_packet, chunk->properties, true);
if(rc) return rc;
if(rc){
mosquitto__free(prop_packet.payload);
return rc;
}
write_e(db_fptr, prop_packet.payload, proplen);
mosquitto__free(prop_packet.payload);

View File

@ -1,7 +1,7 @@
<!--
.. title: Download
.. slug: download
.. date: 2020-08-11 12:08:00 UTC+1
.. date: 2020-08-19 14:44:00 UTC+1
.. tags: tag
.. category: category
.. link: link
@ -11,7 +11,7 @@
# Source
* [mosquitto-1.6.11.tar.gz](https://mosquitto.org/files/source/mosquitto-1.6.11.tar.gz) (319kB) ([GPG signature](https://mosquitto.org/files/source/mosquitto-1.6.11.tar.gz.asc))
* [mosquitto-1.6.12.tar.gz](https://mosquitto.org/files/source/mosquitto-1.6.12.tar.gz) (319kB) ([GPG signature](https://mosquitto.org/files/source/mosquitto-1.6.12.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-1.6.11-install-windows-x64.exe](https://mosquitto.org/files/binary/win64/mosquitto-1.6.11-install-windows-x64.exe) (~1.4 MB) (64-bit build, Windows Vista and up, built with Visual Studio Community 2019)
* [mosquitto-1.6.11-install-windows-x32.exe](https://mosquitto.org/files/binary/win32/mosquitto-1.6.11-install-windows-x86.exe) (~1.4 MB) (32-bit build, Windows Vista and up, built with Visual Studio Community 2019)
* [mosquitto-1.6.12-install-windows-x64.exe](https://mosquitto.org/files/binary/win64/mosquitto-1.6.12-install-windows-x64.exe) (~1.4 MB) (64-bit build, Windows Vista and up, built with Visual Studio Community 2019)
* [mosquitto-1.6.12-install-windows-x32.exe](https://mosquitto.org/files/binary/win32/mosquitto-1.6.12-install-windows-x86.exe) (~1.4 MB) (32-bit build, Windows Vista and up, built with Visual Studio Community 2019)
See also readme-windows.txt after installing.

View File

@ -0,0 +1,32 @@
<!--
.. title: Version 1.6.12 released.
.. slug: version-1-6-12-released
.. date: 2020-08-19 14:44:13 UTC+01:00
.. tags: Releases
.. category:
.. link:
.. description:
.. type: text
-->
Mosquitto 1.6.12 has been released, this is a bugfix release.
# Security
- In some circumstances, Mosquitto could leak memory when handling PUBLISH
messages. This is limited to incoming QoS 2 messages, and is related
to the combination of the broker having persistence enabled, a clean
session=false client, which was connected prior to the broker restarting,
then has reconnected and has now sent messages at a sufficiently high rate
that the incoming queue at the broker has filled up and hence messages are
being dropped. This is more likely to have an effect where
`max_queued_messages` is a small value. This has now been fixed. Closes [#1793].
# Broker
- Build warning fixes when building with `WITH_BRIDGE=no` and `WITH_TLS=no`.
# Clients
- All clients exit with an error exit code on CONNACK failure. Closes [#1778].
- Don't busy loop with `mosquitto_pub -l` on a slow connection.
[#1778]: https://github.com/eclipse/mosquitto/issues/1778
[#1793]: https://github.com/eclipse/mosquitto/issues/1793