From 45fa82098930dec666b0525482b5f2ed0af9d36f Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 13 Jul 2014 14:11:43 +0100 Subject: [PATCH 01/26] Anonymous clients are no longer accidently disconnected from the broker after a SIGHUP. --- ChangeLog.txt | 2 ++ src/security_default.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 172606a7..09ae8bcb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -15,6 +15,8 @@ Broker: clients that connect without a username. - Fix subscriptions being deleted when clients subscribed to a topic beginning with a $ but that is not $SYS. +- Anonymous clients are no longer accidently disconnected from the broker + after a SIGHUP. Client library: - Fix topic matching edge case. diff --git a/src/security_default.c b/src/security_default.c index 04bc3c70..c5590f59 100644 --- a/src/security_default.c +++ b/src/security_default.c @@ -624,8 +624,9 @@ int mosquitto_unpwd_check_default(struct mosquitto_db *db, const char *username, int rc; #endif - if(!db || !username) return MOSQ_ERR_INVAL; + if(!db) return MOSQ_ERR_INVAL; if(!db->unpwd) return MOSQ_ERR_SUCCESS; + if(!username) return MOSQ_ERR_INVAL; /* Check must be made only after checking db->unpwd. */ HASH_ITER(hh, db->unpwd, u, tmp){ if(!strcmp(u->username, username)){ From 885d8ca5dbaeb33e50f9b4bcb25e1e9ab2dbdf33 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 13 Jul 2014 14:18:08 +0100 Subject: [PATCH 02/26] When a durable client reconnects, its queued messages are now checked against ACLs in case of a change in username/ACL state since it last connected. Thanks to "web1". --- ChangeLog.txt | 3 +++ src/read_handle_server.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 09ae8bcb..53725b52 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -15,6 +15,9 @@ Broker: clients that connect without a username. - Fix subscriptions being deleted when clients subscribed to a topic beginning with a $ but that is not $SYS. +- When a durable client reconnects, its queued messages are now checked + against ACLs in case of a change in username/ACL state since it last + connected. - Anonymous clients are no longer accidently disconnected from the broker after a SIGHUP. diff --git a/src/read_handle_server.c b/src/read_handle_server.c index 5765007e..5488ac67 100644 --- a/src/read_handle_server.c +++ b/src/read_handle_server.c @@ -46,6 +46,7 @@ int mqtt3_handle_connect(struct mosquitto_db *db, struct mosquitto *context) int i; int rc; struct _mosquitto_acl_user *acl_tail; + struct mosquitto_client_msg *msg_tail, *msg_prev; int slen; #ifdef WITH_TLS X509 *client_cert; @@ -417,6 +418,34 @@ int mqtt3_handle_connect(struct mosquitto_db *db, struct mosquitto *context) context->is_bridge = true; } + /* Remove any queued messages that are no longer allowed through ACL, + * assuming a possible change of username. */ + + msg_tail = context->msgs; + msg_prev = NULL; + while(msg_tail){ + if(msg_tail->direction == mosq_md_out){ + if(mosquitto_acl_check(db, context, msg_tail->store->msg.topic, MOSQ_ACL_READ) == MOSQ_ERR_ACL_DENIED){ + msg_tail->store->ref_count--; + if(msg_prev){ + msg_prev->next = msg_tail->next; + _mosquitto_free(msg_tail); + msg_tail = msg_prev->next; + }else{ + context->msgs = context->msgs->next; + _mosquitto_free(msg_tail); + msg_tail = context->msgs; + } + }else{ + msg_prev = msg_tail; + msg_tail = msg_tail->next; + } + }else{ + msg_prev = msg_tail; + msg_tail = msg_tail->next; + } + } + // Add the client ID to the DB hash table here new_cih = _mosquitto_malloc(sizeof(struct _clientid_index_hash)); if(!new_cih){ From 8efb4f9334b509cd1303162b73808c92a6b3658a Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 13 Jul 2014 14:28:24 +0100 Subject: [PATCH 03/26] Fix bug #1324411 Thanks to chenzhenianqing. --- ChangeLog.txt | 2 ++ src/database.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 53725b52..bf07cb2a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -18,6 +18,8 @@ Broker: - When a durable client reconnects, its queued messages are now checked against ACLs in case of a change in username/ACL state since it last connected. +- Fix bug #1324411, which could have had unexpected consequences for delayed + messages in rare circumstances. - Anonymous clients are no longer accidently disconnected from the broker after a SIGHUP. diff --git a/src/database.c b/src/database.c index da3b1c81..efe77836 100644 --- a/src/database.c +++ b/src/database.c @@ -621,7 +621,7 @@ int mqtt3_db_message_timeout_check(struct mosquitto_db *db, unsigned int timeout { int i; time_t threshold; - enum mosquitto_msg_state new_state = mosq_ms_invalid; + enum mosquitto_msg_state new_state; struct mosquitto *context; struct mosquitto_client_msg *msg; @@ -633,6 +633,7 @@ int mqtt3_db_message_timeout_check(struct mosquitto_db *db, unsigned int timeout msg = context->msgs; while(msg){ + new_state = mosq_ms_invalid; if(msg->timestamp < threshold && msg->state != mosq_ms_queued){ switch(msg->state){ case mosq_ms_wait_for_puback: From e5aa843ec71cae7fba216dbb499cf44357bbdd2b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 13 Jul 2014 21:20:18 +0100 Subject: [PATCH 04/26] Don't allow access to clients when authenticating if a security plugin returns an application error. Fixes bug #1340782. Thanks to Charlie Davis. --- ChangeLog.txt | 2 ++ src/bridge.c | 16 ++++++++++++---- src/read_handle_server.c | 32 +++++++++++++++++++++++--------- src/subs.c | 4 ++-- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index bf07cb2a..312b3194 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,8 @@ Clients: ================ Broker: +- Don't allow access to clients when authenticating if a security plugin + returns an application error. Fixes bug #1340782. - Ensure that bridges verify certificates by default when using TLS. - Fix possible crash when using pattern ACLs that do not include a %u and clients that connect without a username. diff --git a/src/bridge.c b/src/bridge.c index 83048a2f..095a15ea 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -163,11 +163,19 @@ int mqtt3_bridge_connect(struct mosquitto_db *db, struct mosquitto *context) } rc = mosquitto_unpwd_check(db, context->bridge->local_username, context->bridge->local_password); - if(rc == MOSQ_ERR_AUTH){ - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s failed authentication on local broker.", context->id); - return rc; + switch(rc){ + case MOSQ_ERR_SUCCESS: + break; + case MOSQ_ERR_AUTH: + _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s failed authentication on local broker.", context->id); + return rc; + case MOSQ_ERR_UNKNOWN: + _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s returned application error in authorisation.", context->id); + return rc; + default: + _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Unknown error in authentication for bridge %s.", context->id); + return rc; } - rc = 0; /* Delete all local subscriptions even for clean_session==false. We don't * remove any messages and the next loop carries out the resubscription diff --git a/src/read_handle_server.c b/src/read_handle_server.c index 5488ac67..fc491d3a 100644 --- a/src/read_handle_server.c +++ b/src/read_handle_server.c @@ -344,13 +344,20 @@ int mqtt3_handle_connect(struct mosquitto_db *db, struct mosquitto *context) #endif /* WITH_TLS */ if(username_flag){ rc = mosquitto_unpwd_check(db, username, password); - if(rc == MOSQ_ERR_AUTH){ - _mosquitto_send_connack(context, CONNACK_REFUSED_BAD_USERNAME_PASSWORD); - mqtt3_context_disconnect(db, context); - rc = MOSQ_ERR_SUCCESS; - goto handle_connect_error; - }else if(rc == MOSQ_ERR_INVAL){ - goto handle_connect_error; + switch(rc){ + case MOSQ_ERR_SUCCESS: + break; + case MOSQ_ERR_AUTH: + _mosquitto_send_connack(context, CONNACK_REFUSED_BAD_USERNAME_PASSWORD); + mqtt3_context_disconnect(db, context); + rc = MOSQ_ERR_SUCCESS; + goto handle_connect_error; + break; + default: + mqtt3_context_disconnect(db, context); + rc = MOSQ_ERR_SUCCESS; + goto handle_connect_error; + break; } context->username = username; context->password = password; @@ -629,8 +636,15 @@ int mqtt3_handle_subscribe(struct mosquitto_db *db, struct mosquitto *context) if(context->protocol == mosq_p_mqtt311){ rc = mosquitto_acl_check(db, context, sub, MOSQ_ACL_READ); - if(rc == MOSQ_ERR_ACL_DENIED){ - qos = 0x80; + switch(rc){ + case MOSQ_ERR_SUCCESS: + break; + case MOSQ_ERR_ACL_DENIED: + qos = 0x80; + break; + default: + _mosquitto_free(sub); + return rc; } } diff --git a/src/subs.c b/src/subs.c index 6194059f..991d2856 100644 --- a/src/subs.c +++ b/src/subs.c @@ -92,7 +92,7 @@ static int _subs_process(struct mosquitto_db *db, struct _mosquitto_subhier *hie hier->retained = NULL; } } - while(source_id && leaf){ + while(source_id && leaf && ){ if(leaf->context->is_bridge && !strcmp(leaf->context->id, source_id)){ leaf = leaf->next; continue; @@ -131,7 +131,7 @@ static int _subs_process(struct mosquitto_db *db, struct _mosquitto_subhier *hie } if(mqtt3_db_message_insert(db, leaf->context, mid, mosq_md_out, msg_qos, client_retain, stored) == 1) rc = 1; }else{ - rc = 1; + return 1; /* Application error */ } leaf = leaf->next; } From 77999c7fd0cad827872675071cadbf1ae46ffedc Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 13 Jul 2014 21:48:33 +0100 Subject: [PATCH 05/26] Fix incorrect commit. --- src/subs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subs.c b/src/subs.c index 991d2856..31c9d7e0 100644 --- a/src/subs.c +++ b/src/subs.c @@ -92,7 +92,7 @@ static int _subs_process(struct mosquitto_db *db, struct _mosquitto_subhier *hie hier->retained = NULL; } } - while(source_id && leaf && ){ + while(source_id && leaf){ if(leaf->context->is_bridge && !strcmp(leaf->context->id, source_id)){ leaf = leaf->next; continue; From 7a5dc33d671f0f448b048ed35543296eb32178b9 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 13 Jul 2014 22:39:14 +0100 Subject: [PATCH 06/26] Windows fix. --- lib/net_mosq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net_mosq.c b/lib/net_mosq.c index a3977e25..09b354c8 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -972,7 +972,7 @@ int _mosquitto_socket_nonblock(int sock) return 1; } #else - opt = 1; + unsigned long opt = 1; if(ioctlsocket(sock, FIONBIO, &opt)){ COMPAT_CLOSE(sock); return 1; From 4d9477abc7c1066466c5287783dc9abc925f6128 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 13 Jul 2014 22:54:19 +0100 Subject: [PATCH 07/26] Version bump --- CMakeLists.txt | 2 +- ChangeLog.txt | 10 +--------- config.mk | 2 +- installer/mosquitto-cygwin.nsi | 2 +- installer/mosquitto.nsi | 2 +- lib/mosquitto.h | 2 +- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 30d6f598..df9c16da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ project(mosquitto) cmake_minimum_required(VERSION 2.6) -set (VERSION 1.3.1) +set (VERSION 1.3.2) if (WIN32) execute_process(COMMAND cmd /c echo %DATE% %TIME% OUTPUT_VARIABLE TIMESTAMP diff --git a/ChangeLog.txt b/ChangeLog.txt index 312b3194..fe735351 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,12 +1,4 @@ -Broker: -- Default TLS mode now accepts TLS v1.2, v1.1 and v1.0. -- Support for ECDHE-ECDSA family ciphers. - -Clients: -- Both clients can now load default configuration options from a file. -- Add -1 (oneshot) option to mosquitto_sub. - -1.3.2 - 2014xxxx +1.3.2 - 20140713 ================ Broker: diff --git a/config.mk b/config.mk index bd588fd5..2d5c36e9 100644 --- a/config.mk +++ b/config.mk @@ -83,7 +83,7 @@ WITH_DOCS:=yes # Also bump lib/mosquitto.h, lib/python/setup.py, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi -VERSION=1.3.1 +VERSION=1.3.2 TIMESTAMP:=$(shell date "+%F %T%z") # Client library SO version. Bump if incompatible API/ABI changes are made. diff --git a/installer/mosquitto-cygwin.nsi b/installer/mosquitto-cygwin.nsi index c79c3cd2..e45cdbf7 100644 --- a/installer/mosquitto-cygwin.nsi +++ b/installer/mosquitto-cygwin.nsi @@ -7,7 +7,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.3.1 +!define VERSION 1.3.2 OutFile "mosquitto-${VERSION}-install-cygwin.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 30db4e28..9ffe54b4 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -7,7 +7,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.3.1 +!define VERSION 1.3.2 OutFile "mosquitto-${VERSION}-install-win32.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/lib/mosquitto.h b/lib/mosquitto.h index 27535929..7ebb81eb 100644 --- a/lib/mosquitto.h +++ b/lib/mosquitto.h @@ -45,7 +45,7 @@ extern "C" { #define LIBMOSQUITTO_MAJOR 1 #define LIBMOSQUITTO_MINOR 3 -#define LIBMOSQUITTO_REVISION 1 +#define LIBMOSQUITTO_REVISION 2 /* 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) From 0d1cb339a84af74973b3e601dd5405fd4e686392 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 14 Jul 2014 00:19:21 +0100 Subject: [PATCH 08/26] Define STRIP. --- config.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/config.mk b/config.mk index 2d5c36e9..49a39955 100644 --- a/config.mk +++ b/config.mk @@ -230,3 +230,4 @@ INSTALL?=install prefix=/usr/local mandir=${prefix}/share/man localedir=${prefix}/share/locale +STRIP?=strip From 8e7736b78ee1f5d518b87bc206e9d23a454faef5 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 1 Aug 2014 21:34:21 +0100 Subject: [PATCH 09/26] Fix incorrect handling of anonymous bridges on the local broker. Thanks to Jan-Piet Mens. --- ChangeLog.txt | 7 +++++++ src/bridge.c | 31 ++++++++++++++++++------------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index fe735351..c797a3e3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,10 @@ +1.3.3 - 20140801 +================ + +Broker: +- Fix incorrect handling of anonymous bridges on the local broker. + + 1.3.2 - 20140713 ================ diff --git a/src/bridge.c b/src/bridge.c index 095a15ea..49cffbd7 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -162,19 +162,24 @@ int mqtt3_bridge_connect(struct mosquitto_db *db, struct mosquitto *context) mqtt3_db_messages_delete(context); } - rc = mosquitto_unpwd_check(db, context->bridge->local_username, context->bridge->local_password); - switch(rc){ - case MOSQ_ERR_SUCCESS: - break; - case MOSQ_ERR_AUTH: - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s failed authentication on local broker.", context->id); - return rc; - case MOSQ_ERR_UNKNOWN: - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s returned application error in authorisation.", context->id); - return rc; - default: - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Unknown error in authentication for bridge %s.", context->id); - return rc; + if(context->bridge->local_username){ + rc = mosquitto_unpwd_check(db, context->bridge->local_username, context->bridge->local_password); + switch(rc){ + case MOSQ_ERR_SUCCESS: + break; + case MOSQ_ERR_AUTH: + _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s failed authentication on local broker.", context->id); + return rc; + case MOSQ_ERR_UNKNOWN: + _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s returned application error in authorisation.", context->id); + return rc; + default: + _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Unknown error in authentication for bridge %s.", context->id); + return rc; + } + }else if(!db->config->allow_anonymous){ + _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s requires a username on local broker.", context->id); + return MOSQ_ERR_AUTH; } /* Delete all local subscriptions even for clean_session==false. We don't From 329301f084e4ff6b9865ba0b3ae00f933ca72318 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 1 Aug 2014 21:35:55 +0100 Subject: [PATCH 10/26] Bump version number. --- CMakeLists.txt | 2 +- config.mk | 2 +- installer/mosquitto-cygwin.nsi | 2 +- installer/mosquitto.nsi | 2 +- lib/mosquitto.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df9c16da..afc510e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ project(mosquitto) cmake_minimum_required(VERSION 2.6) -set (VERSION 1.3.2) +set (VERSION 1.3.3) if (WIN32) execute_process(COMMAND cmd /c echo %DATE% %TIME% OUTPUT_VARIABLE TIMESTAMP diff --git a/config.mk b/config.mk index 49a39955..b5f3c282 100644 --- a/config.mk +++ b/config.mk @@ -83,7 +83,7 @@ WITH_DOCS:=yes # Also bump lib/mosquitto.h, lib/python/setup.py, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi -VERSION=1.3.2 +VERSION=1.3.3 TIMESTAMP:=$(shell date "+%F %T%z") # Client library SO version. Bump if incompatible API/ABI changes are made. diff --git a/installer/mosquitto-cygwin.nsi b/installer/mosquitto-cygwin.nsi index e45cdbf7..56599e11 100644 --- a/installer/mosquitto-cygwin.nsi +++ b/installer/mosquitto-cygwin.nsi @@ -7,7 +7,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.3.2 +!define VERSION 1.3.3 OutFile "mosquitto-${VERSION}-install-cygwin.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 9ffe54b4..7f35227c 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -7,7 +7,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.3.2 +!define VERSION 1.3.3 OutFile "mosquitto-${VERSION}-install-win32.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/lib/mosquitto.h b/lib/mosquitto.h index 7ebb81eb..426a04b3 100644 --- a/lib/mosquitto.h +++ b/lib/mosquitto.h @@ -45,7 +45,7 @@ extern "C" { #define LIBMOSQUITTO_MAJOR 1 #define LIBMOSQUITTO_MINOR 3 -#define LIBMOSQUITTO_REVISION 2 +#define LIBMOSQUITTO_REVISION 3 /* 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) From c1ea95d2d4d0ad35140fbe9b626e3e97596e2230 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 2 Aug 2014 20:18:44 +0100 Subject: [PATCH 11/26] Supports 3.1.1 now. --- readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index 2412dddd..143ddecc 100644 --- a/readme.txt +++ b/readme.txt @@ -1,8 +1,8 @@ Mosquitto ========= -Mosquitto is an open source implementation of a server for version 3.1 of the -MQTT protocol. +Mosquitto is an open source implementation of a server for version 3.1 and +3.1.1 of the MQTT protocol. See the following links for more information on MQTT: From d8a3ab7d56df99fdac3ebd44d4aab67b95c9cad3 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 2 Aug 2014 21:40:54 +0100 Subject: [PATCH 12/26] Don't ask client for certificate when require_certificate is false. Thanks to Jan-Piet Mens. --- ChangeLog.txt | 7 +++++++ src/net.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index c797a3e3..73fbaa98 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,10 @@ +1.3.4 - 20140802 +================ + +Broker: +- Don't ask client for certificate when require_certificate is false. + + 1.3.3 - 20140801 ================ diff --git a/src/net.c b/src/net.c index e2858149..1d7e45dc 100644 --- a/src/net.c +++ b/src/net.c @@ -441,7 +441,7 @@ int mqtt3_socket_listen(struct _mqtt3_listener *listener) if(listener->require_certificate){ SSL_CTX_set_verify(listener->ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, client_certificate_verify); }else{ - SSL_CTX_set_verify(listener->ssl_ctx, SSL_VERIFY_PEER, client_certificate_verify); + SSL_CTX_set_verify(listener->ssl_ctx, SSL_VERIFY_NONE, client_certificate_verify); } rc = SSL_CTX_use_certificate_chain_file(listener->ssl_ctx, listener->certfile); if(rc != 1){ From 4752994d3b4dafd2c79d10caa1eb69944b0bc3df Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 2 Aug 2014 21:42:41 +0100 Subject: [PATCH 13/26] Backout changeset 818550be2d1ba200c14e9d63551982e50f4384f2. --- man/mosquitto.conf.5.xml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/man/mosquitto.conf.5.xml b/man/mosquitto.conf.5.xml index 27f88a3d..03ca0805 100644 --- a/man/mosquitto.conf.5.xml +++ b/man/mosquitto.conf.5.xml @@ -902,22 +902,6 @@ to 60 seconds. - - password - - Configure the password to be used when connecting - this bridge to the local broker. This may be important - when authentication and ACLs are being used. - - - - username - - Configure the username to be used when connecting - this bridge to the local broker. This may be important - when authentication and ACLs are being used. - - [ true | false ] From e6239e1b3c0b3f351e93bc94f13239400abcbc76 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 2 Aug 2014 21:43:04 +0100 Subject: [PATCH 14/26] Backout changeset 76f3a755c6548690f69f2256c8b83c7a0f0f9a95. --- src/security.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/security.c b/src/security.c index a019ada5..802c188b 100644 --- a/src/security.c +++ b/src/security.c @@ -197,15 +197,7 @@ int mosquitto_acl_check(struct mosquitto_db *db, struct mosquitto *context, cons if(!db->auth_plugin.lib){ return mosquitto_acl_check_default(db, context, topic, access); }else{ -#ifdef WITH_BRIDGE - if(context->bridge){ - return db->auth_plugin.acl_check(db->auth_plugin.user_data, context->id, context->bridge->local_username, topic, access); - }else{ -#endif - return db->auth_plugin.acl_check(db->auth_plugin.user_data, context->id, context->username, topic, access); -#ifdef WITH_BRIDGE - } -#endif + return db->auth_plugin.acl_check(db->auth_plugin.user_data, context->id, context->username, topic, access); } } From 56ff849c65d9a5b2a5079151859672af2ef5edae Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 2 Aug 2014 21:48:08 +0100 Subject: [PATCH 15/26] Backout changeset c7589b77956c5bac076ae23905fbfc8902d69dc5. --- mosquitto.conf | 7 ------ src/bridge.c | 20 ----------------- src/conf.c | 50 ------------------------------------------ src/mosquitto_broker.h | 2 -- 4 files changed, 79 deletions(-) diff --git a/mosquitto.conf b/mosquitto.conf index e22fd750..7c22e4f4 100644 --- a/mosquitto.conf +++ b/mosquitto.conf @@ -672,13 +672,6 @@ # username is also set. #password -# Set the username to use on the local broker. -#local_username - -# Set the password to use on the local broker. -# This option is only used if local_username is also set. -#local_password - # ----------------------------------------------------------------- # Certificate based SSL/TLS support # ----------------------------------------------------------------- diff --git a/src/bridge.c b/src/bridge.c index 49cffbd7..43e70b09 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -162,26 +162,6 @@ int mqtt3_bridge_connect(struct mosquitto_db *db, struct mosquitto *context) mqtt3_db_messages_delete(context); } - if(context->bridge->local_username){ - rc = mosquitto_unpwd_check(db, context->bridge->local_username, context->bridge->local_password); - switch(rc){ - case MOSQ_ERR_SUCCESS: - break; - case MOSQ_ERR_AUTH: - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s failed authentication on local broker.", context->id); - return rc; - case MOSQ_ERR_UNKNOWN: - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s returned application error in authorisation.", context->id); - return rc; - default: - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Unknown error in authentication for bridge %s.", context->id); - return rc; - } - }else if(!db->config->allow_anonymous){ - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Bridge %s requires a username on local broker.", context->id); - return MOSQ_ERR_AUTH; - } - /* Delete all local subscriptions even for clean_session==false. We don't * remove any messages and the next loop carries out the resubscription * anyway. This means any unwanted subs will be removed. diff --git a/src/conf.c b/src/conf.c index dd3f07d5..b603a933 100644 --- a/src/conf.c +++ b/src/conf.c @@ -250,8 +250,6 @@ void mqtt3_config_cleanup(struct mqtt3_config *config) if(config->bridges[i].clientid) _mosquitto_free(config->bridges[i].clientid); if(config->bridges[i].username) _mosquitto_free(config->bridges[i].username); if(config->bridges[i].password) _mosquitto_free(config->bridges[i].password); - if(config->bridges[i].local_username) _mosquitto_free(config->bridges[i].local_username); - if(config->bridges[i].local_password) _mosquitto_free(config->bridges[i].local_password); if(config->bridges[i].topics){ for(j=0; jbridges[i].topic_count; j++){ if(config->bridges[i].topics[j].topic) _mosquitto_free(config->bridges[i].topics[j].topic); @@ -1142,54 +1140,6 @@ int _config_read_file(struct mqtt3_config *config, bool reload, const char *file _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error: Empty listener value in configuration."); return MOSQ_ERR_INVAL; } - }else if(!strcmp(token, "local_password")){ -#ifdef WITH_BRIDGE - if(reload) continue; // FIXME - if(!cur_bridge){ - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration."); - return MOSQ_ERR_INVAL; - } - token = strtok_r(NULL, " ", &saveptr); - if(token){ - if(cur_bridge->local_password){ - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error: Duplicate local_password value in bridge configuration."); - return MOSQ_ERR_INVAL; - } - cur_bridge->local_password = _mosquitto_strdup(token); - if(!cur_bridge->local_password){ - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory"); - return MOSQ_ERR_NOMEM; - } - }else{ - cur_bridge->local_password = NULL; - } -#else - _mosquitto_log_printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available."); -#endif - }else if(!strcmp(token, "local_username")){ -#ifdef WITH_BRIDGE - if(reload) continue; // FIXME - if(!cur_bridge){ - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration."); - return MOSQ_ERR_INVAL; - } - token = strtok_r(NULL, " ", &saveptr); - if(token){ - if(cur_bridge->local_username){ - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error: Duplicate local_username value in bridge configuration."); - return MOSQ_ERR_INVAL; - } - cur_bridge->local_username = _mosquitto_strdup(token); - if(!cur_bridge->local_username){ - _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory"); - return MOSQ_ERR_NOMEM; - } - }else{ - cur_bridge->local_username = NULL; - } -#else - _mosquitto_log_printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available."); -#endif }else if(!strcmp(token, "log_dest")){ token = strtok_r(NULL, " ", &saveptr); if(token){ diff --git a/src/mosquitto_broker.h b/src/mosquitto_broker.h index ece47008..497f3d9a 100644 --- a/src/mosquitto_broker.h +++ b/src/mosquitto_broker.h @@ -258,8 +258,6 @@ struct _mqtt3_bridge{ time_t restart_t; char *username; char *password; - char *local_username; - char *local_password; bool notifications; char *notification_topic; enum mosquitto_bridge_start_type start_type; From b612c6bf22eee0f07fd5f786459a9c1d668ee9f8 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 2 Aug 2014 22:17:30 +0100 Subject: [PATCH 16/26] Fix test. --- test/broker/08-ssl-connect-identity.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/test/broker/08-ssl-connect-identity.conf b/test/broker/08-ssl-connect-identity.conf index 2b2640a8..0da7edb2 100644 --- a/test/broker/08-ssl-connect-identity.conf +++ b/test/broker/08-ssl-connect-identity.conf @@ -5,5 +5,6 @@ certfile ../ssl/server.crt keyfile ../ssl/server.key use_identity_as_username true +require_certificate true tls_version tlsv1 From b6eddea55b0e1024b7daececa5bd5bd3c536265b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 2 Aug 2014 22:19:01 +0100 Subject: [PATCH 17/26] Update changelog. --- ChangeLog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 73fbaa98..e64c9540 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,7 +3,7 @@ Broker: - Don't ask client for certificate when require_certificate is false. - +- Backout incomplete functionality that was incorrectly included in 1.3.2. 1.3.3 - 20140801 ================ From 57bb64aae153a1d856ccab6b5f18fda9176147b1 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 6 Aug 2014 00:28:15 +0100 Subject: [PATCH 18/26] Bump version number. --- CMakeLists.txt | 2 +- ChangeLog.txt | 2 +- config.mk | 2 +- installer/mosquitto-cygwin.nsi | 2 +- installer/mosquitto.nsi | 2 +- lib/mosquitto.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index afc510e8..bb6cc2e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ project(mosquitto) cmake_minimum_required(VERSION 2.6) -set (VERSION 1.3.3) +set (VERSION 1.3.4) if (WIN32) execute_process(COMMAND cmd /c echo %DATE% %TIME% OUTPUT_VARIABLE TIMESTAMP diff --git a/ChangeLog.txt b/ChangeLog.txt index e64c9540..86892189 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,4 @@ -1.3.4 - 20140802 +1.3.4 - 20140806 ================ Broker: diff --git a/config.mk b/config.mk index b5f3c282..82275479 100644 --- a/config.mk +++ b/config.mk @@ -83,7 +83,7 @@ WITH_DOCS:=yes # Also bump lib/mosquitto.h, lib/python/setup.py, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi -VERSION=1.3.3 +VERSION=1.3.4 TIMESTAMP:=$(shell date "+%F %T%z") # Client library SO version. Bump if incompatible API/ABI changes are made. diff --git a/installer/mosquitto-cygwin.nsi b/installer/mosquitto-cygwin.nsi index 56599e11..c9211da3 100644 --- a/installer/mosquitto-cygwin.nsi +++ b/installer/mosquitto-cygwin.nsi @@ -7,7 +7,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.3.3 +!define VERSION 1.3.4 OutFile "mosquitto-${VERSION}-install-cygwin.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 7f35227c..2d5f2122 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -7,7 +7,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.3.3 +!define VERSION 1.3.4 OutFile "mosquitto-${VERSION}-install-win32.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/lib/mosquitto.h b/lib/mosquitto.h index 426a04b3..712274b7 100644 --- a/lib/mosquitto.h +++ b/lib/mosquitto.h @@ -45,7 +45,7 @@ extern "C" { #define LIBMOSQUITTO_MAJOR 1 #define LIBMOSQUITTO_MINOR 3 -#define LIBMOSQUITTO_REVISION 3 +#define LIBMOSQUITTO_REVISION 4 /* 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) From 4a19d9ae3a398aca9b8e896824d00db18f836a22 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 5 Oct 2014 21:24:08 +0100 Subject: [PATCH 19/26] Fix possible memory leak when using a topic that has a leading slash. Fixes bug #1360986. --- ChangeLog.txt | 7 +++++++ src/subs.c | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 86892189..43d6ec4b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,10 @@ +1.3.5 - 20141005 +================ + +Broker: +- Fix possible memory leak when using a topic that has a leading slash. Fixes + bug #1360985. + 1.3.4 - 20140806 ================ diff --git a/src/subs.c b/src/subs.c index 31c9d7e0..a171ec82 100644 --- a/src/subs.c +++ b/src/subs.c @@ -155,8 +155,13 @@ static int _sub_topic_tokenise(const char *subtopic, struct _sub_token **topics) new_topic->topic = _mosquitto_strdup(""); if(!new_topic->topic) goto cleanup; - *topics = new_topic; - tail = new_topic; + if(tail){ + tail->next = new_topic; + tail = tail->next; + }else{ + *topics = new_topic; + tail = new_topic; + } } len = strlen(subtopic); @@ -168,8 +173,13 @@ static int _sub_topic_tokenise(const char *subtopic, struct _sub_token **topics) new_topic->topic = _mosquitto_strdup(""); if(!new_topic->topic) goto cleanup; - *topics = new_topic; - tail = new_topic; + if(tail){ + tail->next = new_topic; + tail = tail->next; + }else{ + *topics = new_topic; + tail = new_topic; + } start = 1; }else{ From 1e876973596ecb4582286ae641b34972d4cd2a31 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 5 Oct 2014 21:56:44 +0100 Subject: [PATCH 20/26] Fix mutex being incorrectly passed by value. Fixes bug #1373785. --- ChangeLog.txt | 3 +++ lib/messages_mosq.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 43d6ec4b..2e055ed6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,9 @@ Broker: - Fix possible memory leak when using a topic that has a leading slash. Fixes bug #1360985. +Client library: +- Fix mutex being incorrectly passed by value. Fixes bug #1373785. + 1.3.4 - 20140806 ================ diff --git a/lib/messages_mosq.c b/lib/messages_mosq.c index e3e8a190..84afda76 100644 --- a/lib/messages_mosq.c +++ b/lib/messages_mosq.c @@ -297,7 +297,7 @@ int _mosquitto_message_remove(struct mosquitto *mosq, uint16_t mid, enum mosquit } #ifdef WITH_THREADING -void _mosquitto_message_retry_check_actual(struct mosquitto *mosq, struct mosquitto_message_all *messages, pthread_mutex_t mutex) +void _mosquitto_message_retry_check_actual(struct mosquitto *mosq, struct mosquitto_message_all *messages, pthread_mutex_t *mutex) #else void _mosquitto_message_retry_check_actual(struct mosquitto *mosq, struct mosquitto_message_all *messages) #endif @@ -306,7 +306,7 @@ void _mosquitto_message_retry_check_actual(struct mosquitto *mosq, struct mosqui assert(mosq); #ifdef WITH_THREADING - pthread_mutex_lock(&mutex); + pthread_mutex_lock(mutex); #endif while(messages){ @@ -335,15 +335,15 @@ void _mosquitto_message_retry_check_actual(struct mosquitto *mosq, struct mosqui messages = messages->next; } #ifdef WITH_THREADING - pthread_mutex_unlock(&mutex); + pthread_mutex_unlock(mutex); #endif } void _mosquitto_message_retry_check(struct mosquitto *mosq) { #ifdef WITH_THREADING - _mosquitto_message_retry_check_actual(mosq, mosq->out_messages, mosq->out_message_mutex); - _mosquitto_message_retry_check_actual(mosq, mosq->in_messages, mosq->in_message_mutex); + _mosquitto_message_retry_check_actual(mosq, mosq->out_messages, &mosq->out_message_mutex); + _mosquitto_message_retry_check_actual(mosq, mosq->in_messages, &mosq->in_message_mutex); #else _mosquitto_message_retry_check_actual(mosq, mosq->out_messages); _mosquitto_message_retry_check_actual(mosq, mosq->in_messages); From 429c89255787ef67f55804de64bffc9b6d70cf1f Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 8 Oct 2014 20:51:17 +0100 Subject: [PATCH 21/26] Fix saving persistent database on Windows. Thanks to Daniel Degasperi. --- ChangeLog.txt | 1 + src/persist.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 2e055ed6..b668d145 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,7 @@ Broker: - Fix possible memory leak when using a topic that has a leading slash. Fixes bug #1360985. +- Fix saving persistent database on Windows. Client library: - Fix mutex being incorrectly passed by value. Fixes bug #1373785. diff --git a/src/persist.c b/src/persist.c index 01866060..f4e2c694 100644 --- a/src/persist.c +++ b/src/persist.c @@ -402,6 +402,12 @@ int mqtt3_db_backup(struct mosquitto_db *db, bool cleanup, bool shutdown) fclose(db_fptr); +#ifdef WIN32 + if(remove(db->config->persistence_filepath) != 0){ + goto error; + } +} +#endif if(rename(outfile, db->config->persistence_filepath) != 0){ goto error; } From bad7ec75f04484590b845862ca788dded0690e48 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 8 Oct 2014 21:16:34 +0100 Subject: [PATCH 22/26] Temporarily disable ACL checks on subscriptions when using MQTT v3.1.1. This is due to the complexity of checking wildcard ACLs against wildcard subscriptions. This does not have a negative impact on security because checks are still made before a message is sent to a client. Fixes bug Thanks to Jan-Piet Mens and Christoph Krey. --- ChangeLog.txt | 5 +++++ src/read_handle_server.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index b668d145..75e2bba8 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,11 @@ Broker: - Fix possible memory leak when using a topic that has a leading slash. Fixes bug #1360985. - Fix saving persistent database on Windows. +- Temporarily disable ACL checks on subscriptions when using MQTT v3.1.1. This + is due to the complexity of checking wildcard ACLs against wildcard + subscriptions. This does not have a negative impact on security because + checks are still made before a message is sent to a client. + Fixes bug #1374291. Client library: - Fix mutex being incorrectly passed by value. Fixes bug #1373785. diff --git a/src/read_handle_server.c b/src/read_handle_server.c index fc491d3a..da99a2ce 100644 --- a/src/read_handle_server.c +++ b/src/read_handle_server.c @@ -634,6 +634,19 @@ int mqtt3_handle_subscribe(struct mosquitto_db *db, struct mosquitto *context) } _mosquitto_log_printf(NULL, MOSQ_LOG_DEBUG, "\t%s (QoS %d)", sub, qos); +#if 0 + /* FIXME + * This section has been disabled temporarily. mosquitto_acl_check + * calls mosquitto_topic_matches_sub, which can't cope with + * checking subscriptions that have wildcards against ACLs that + * have wildcards. Bug #1374291 is related. + * + * It's a very difficult problem when an ACL looks like foo/+/bar + * and a subscription request to foo/# is made. + * + * This should be changed to using MOSQ_ACL_SUBSCRIPTION in the + * future anyway. + */ if(context->protocol == mosq_p_mqtt311){ rc = mosquitto_acl_check(db, context, sub, MOSQ_ACL_READ); switch(rc){ @@ -647,6 +660,7 @@ int mqtt3_handle_subscribe(struct mosquitto_db *db, struct mosquitto *context) return rc; } } +#endif if(qos != 0x80){ rc2 = mqtt3_sub_add(db, context, sub, qos, &db->subs); From 8cb9b195e5fbb79d979c982589494acd99f5c2c1 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 8 Oct 2014 21:38:01 +0100 Subject: [PATCH 23/26] When using -v and the broker receives a SIGHUP, verbose logging was being disabled. This has been fixed. --- ChangeLog.txt | 2 ++ src/conf.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 75e2bba8..56f9d69e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,8 @@ Broker: subscriptions. This does not have a negative impact on security because checks are still made before a message is sent to a client. Fixes bug #1374291. +- When using -v and the broker receives a SIGHUP, verbose logging was being + disabled. This has been fixed. Client library: - Fix mutex being incorrectly passed by value. Fixes bug #1373785. diff --git a/src/conf.c b/src/conf.c index b603a933..3463ee26 100644 --- a/src/conf.c +++ b/src/conf.c @@ -505,7 +505,7 @@ int mqtt3_config_read(struct mqtt3_config *config, bool reload) config->log_dest = cr.log_dest; } if(config->verbose){ - config->log_type = MOSQ_LOG_DEBUG | MOSQ_LOG_ERR | MOSQ_LOG_WARNING | MOSQ_LOG_NOTICE | MOSQ_LOG_INFO; + config->log_type = INT_MAX; }else if(cr.log_type_set){ config->log_type = cr.log_type; } From f44b66a331f84f2ad93e68941c47d926f29100f0 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 8 Oct 2014 22:29:07 +0100 Subject: [PATCH 24/26] Bump version number. --- CMakeLists.txt | 2 +- ChangeLog.txt | 2 +- config.mk | 2 +- installer/mosquitto-cygwin.nsi | 2 +- installer/mosquitto.nsi | 2 +- lib/mosquitto.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb6cc2e7..7ff00e6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ project(mosquitto) cmake_minimum_required(VERSION 2.6) -set (VERSION 1.3.4) +set (VERSION 1.3.5) if (WIN32) execute_process(COMMAND cmd /c echo %DATE% %TIME% OUTPUT_VARIABLE TIMESTAMP diff --git a/ChangeLog.txt b/ChangeLog.txt index 56f9d69e..fe902470 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,4 @@ -1.3.5 - 20141005 +1.3.5 - 20141008 ================ Broker: diff --git a/config.mk b/config.mk index 82275479..993e990b 100644 --- a/config.mk +++ b/config.mk @@ -83,7 +83,7 @@ WITH_DOCS:=yes # Also bump lib/mosquitto.h, lib/python/setup.py, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi -VERSION=1.3.4 +VERSION=1.3.5 TIMESTAMP:=$(shell date "+%F %T%z") # Client library SO version. Bump if incompatible API/ABI changes are made. diff --git a/installer/mosquitto-cygwin.nsi b/installer/mosquitto-cygwin.nsi index c9211da3..ea35812d 100644 --- a/installer/mosquitto-cygwin.nsi +++ b/installer/mosquitto-cygwin.nsi @@ -7,7 +7,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.3.4 +!define VERSION 1.3.5 OutFile "mosquitto-${VERSION}-install-cygwin.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 2d5f2122..a226fc76 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -7,7 +7,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "mosquitto" -!define VERSION 1.3.4 +!define VERSION 1.3.5 OutFile "mosquitto-${VERSION}-install-win32.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/lib/mosquitto.h b/lib/mosquitto.h index 712274b7..e68fe911 100644 --- a/lib/mosquitto.h +++ b/lib/mosquitto.h @@ -45,7 +45,7 @@ extern "C" { #define LIBMOSQUITTO_MAJOR 1 #define LIBMOSQUITTO_MINOR 3 -#define LIBMOSQUITTO_REVISION 4 +#define LIBMOSQUITTO_REVISION 5 /* 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) From 90b8ceb0df78dc018f5fd982d4fc644fc900feb6 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 8 Oct 2014 22:36:59 +0100 Subject: [PATCH 25/26] Update libmosquitto man page example. --- man/libmosquitto.3.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/man/libmosquitto.3.xml b/man/libmosquitto.3.xml index 2a7f3514..528b6beb 100644 --- a/man/libmosquitto.3.xml +++ b/man/libmosquitto.3.xml @@ -421,7 +421,6 @@ void my_log_callback(struct mosquitto *mosq, void *userdata, int level, const ch int main(int argc, char *argv[]) { - char id[30]; int i; char *host = "localhost"; int port = 1883; @@ -430,13 +429,12 @@ int main(int argc, char *argv[]) struct mosquitto *mosq = NULL; mosquitto_lib_init(); - mosq = mosquitto_new(id, clean_session, NULL); + mosq = mosquitto_new(NULL, clean_session, NULL); if(!mosq){ fprintf(stderr, "Error: Out of memory.\n"); return 1; } mosquitto_log_callback_set(mosq, my_log_callback); - mosquitto_connect_callback_set(mosq, my_connect_callback); mosquitto_message_callback_set(mosq, my_message_callback); mosquitto_subscribe_callback_set(mosq, my_subscribe_callback); @@ -446,7 +444,7 @@ int main(int argc, char *argv[]) return 1; } - while(!mosquitto_loop(mosq, -1)){ + while(!mosquitto_loop(mosq, -1, 1)){ } mosquitto_destroy(mosq); mosquitto_lib_cleanup(); From 1a47f86648b3cc84aaafb6cdddd68c5974d26631 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 8 Oct 2014 22:48:47 +0100 Subject: [PATCH 26/26] Typo fix. --- src/persist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/persist.c b/src/persist.c index f4e2c694..56634ebf 100644 --- a/src/persist.c +++ b/src/persist.c @@ -406,7 +406,6 @@ int mqtt3_db_backup(struct mosquitto_db *db, bool cleanup, bool shutdown) if(remove(db->config->persistence_filepath) != 0){ goto error; } -} #endif if(rename(outfile, db->config->persistence_filepath) != 0){ goto error;