From 4be32aefc6f4b21f1382b7814387d4e7375f413c Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 14 Jan 2021 00:04:29 +0000 Subject: [PATCH 01/51] Fix potential duplicate Will messages being sent. This could have occurred when a will delay interval had been set. --- ChangeLog.txt | 5 +++++ src/will_delay.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4e8bde1f..330bc252 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,8 @@ +Broker: +- Fix potential duplicate Will messages being sent when a will delay interval + has been set. + + 2.0.5 - 2021-01-11 ================== diff --git a/src/will_delay.c b/src/will_delay.c index 2fc6eb54..37af3997 100644 --- a/src/will_delay.c +++ b/src/will_delay.c @@ -40,6 +40,10 @@ int will_delay__add(struct mosquitto *context) { struct will_delay_list *item; + if(context->will_delay_entry){ + return MOSQ_ERR_SUCCESS; + } + item = mosquitto__calloc(1, sizeof(struct will_delay_list)); if(!item) return MOSQ_ERR_NOMEM; From b8c6f26995482d2b0874fc77e0e4137fd493f9d1 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 14 Jan 2021 15:38:51 +0000 Subject: [PATCH 02/51] Fix message expiry interval property not being honoured for plugins. This happened in `mosquitto_broker_publish` and `mosquitto_broker_publish_copy` only. --- ChangeLog.txt | 2 ++ src/loop.c | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 330bc252..9919c002 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,8 @@ Broker: - Fix potential duplicate Will messages being sent when a will delay interval has been set. +- Fix message expiry interval property not being honoured in + `mosquitto_broker_publish` and `mosquitto_broker_publish_copy`. 2.0.5 - 2021-01-11 diff --git a/src/loop.c b/src/loop.c index 14663c87..aa1367d8 100644 --- a/src/loop.c +++ b/src/loop.c @@ -48,6 +48,7 @@ Contributors: #include "mosquitto_broker_internal.h" #include "memory_mosq.h" +#include "mqtt_protocol.h" #include "packet_mosq.h" #include "send_mosq.h" #include "sys_tree.h" @@ -69,7 +70,7 @@ void lws__sul_callback(struct lws_sorted_usec_list *l) static struct lws_sorted_usec_list sul; #endif -static int single_publish(struct mosquitto *context, struct mosquitto_message_v5 *msg) +static int single_publish(struct mosquitto *context, struct mosquitto_message_v5 *msg, uint32_t message_expiry) { struct mosquitto_msg_store *stored; uint16_t mid; @@ -95,7 +96,7 @@ static int single_publish(struct mosquitto *context, struct mosquitto_message_v5 msg->properties = NULL; } - if(db__message_store(context, stored, 0, 0, mosq_mo_broker)) return 1; + if(db__message_store(context, stored, message_expiry, 0, mosq_mo_broker)) return 1; if(msg->qos){ mid = mosquitto__mid_generate(context); @@ -106,20 +107,50 @@ static int single_publish(struct mosquitto *context, struct mosquitto_message_v5 } +static void read_message_expiry_interval(mosquitto_property **proplist, uint32_t *message_expiry) +{ + mosquitto_property *p, *previous = NULL; + + *message_expiry = 0; + + if(!proplist) return; + + p = *proplist; + while(p){ + if(p->identifier == MQTT_PROP_MESSAGE_EXPIRY_INTERVAL){ + *message_expiry = p->value.i32; + if(p == *proplist){ + *proplist = p->next; + }else{ + previous->next = p->next; + } + property__free(&p); + return; + + } + previous = p; + p = p->next; + } +} + void queue_plugin_msgs(void) { struct mosquitto_message_v5 *msg, *tmp; struct mosquitto *context; + uint32_t message_expiry; DL_FOREACH_SAFE(db.plugin_msgs, msg, tmp){ DL_DELETE(db.plugin_msgs, msg); + + read_message_expiry_interval(&msg->properties, &message_expiry); + if(msg->clientid){ HASH_FIND(hh_id, db.contexts_by_id, msg->clientid, strlen(msg->clientid), context); if(context){ - single_publish(context, msg); + single_publish(context, msg, message_expiry); } }else{ - db__messages_easy_queue(NULL, msg->topic, (uint8_t)msg->qos, (uint32_t)msg->payloadlen, msg->payload, msg->retain, 0, &msg->properties); + db__messages_easy_queue(NULL, msg->topic, (uint8_t)msg->qos, (uint32_t)msg->payloadlen, msg->payload, msg->retain, message_expiry, &msg->properties); } mosquitto__free(msg->topic); mosquitto__free(msg->payload); From 00083623f0cda130ec490d4cf81c4d8fece61e3a Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 15 Jan 2021 09:53:45 +0000 Subject: [PATCH 03/51] Fix websockets listeners with TLS not responding. Closes #2020. Thanks to FozzTexx. --- ChangeLog.txt | 1 + src/websockets.c | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 9919c002..dbfe2afd 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,7 @@ Broker: has been set. - Fix message expiry interval property not being honoured in `mosquitto_broker_publish` and `mosquitto_broker_publish_copy`. +- Fix websockets listeners with TLS not responding. Closes #2020. 2.0.5 - 2021-01-11 diff --git a/src/websockets.c b/src/websockets.c index ac966876..82a3300d 100644 --- a/src/websockets.c +++ b/src/websockets.c @@ -625,8 +625,6 @@ static int callback_http( HASH_FIND(hh_sock, db.contexts_by_sock, &pollargs->fd, sizeof(pollargs->fd), mosq); if(mosq){ mux__delete(mosq); - }else{ - return 1; } break; @@ -641,8 +639,6 @@ static int callback_http( }else{ mux__remove_out(mosq); } - }else{ - return 1; } break; From 300dc54dad6e13cd099b881075518822bd314a72 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 15 Jan 2021 09:58:19 +0000 Subject: [PATCH 04/51] Add notes that libsystemd-dev or similar is needed. This is when building with systemd support on Linux. Closes #2019. Thanks to Mark Symmes. --- ChangeLog.txt | 2 ++ README-compiling.md | 1 + config.mk | 2 ++ 3 files changed, 5 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index dbfe2afd..509cd72c 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,8 @@ Broker: - Fix message expiry interval property not being honoured in `mosquitto_broker_publish` and `mosquitto_broker_publish_copy`. - Fix websockets listeners with TLS not responding. Closes #2020. +- Add notes that libsystemd-dev or similar is needed if building with systemd + support. Closes #2019. 2.0.5 - 2021-01-11 diff --git a/README-compiling.md b/README-compiling.md index f3be9d9a..eb1b11da 100644 --- a/README-compiling.md +++ b/README-compiling.md @@ -7,6 +7,7 @@ are optional. * libwebsockets (optional, disabled by default, version 2.4 and above) * cJSON (optional but recommended, for dynamic-security plugin support, and JSON output from mosquitto_sub/mosquitto_rr) +* libsystemd-dev (optional, if building with systemd support on Linux) * On Windows, a pthreads library is required if threading support is to be included. diff --git a/config.mk b/config.mk index 178c8baa..73c2c611 100644 --- a/config.mk +++ b/config.mk @@ -59,6 +59,8 @@ WITH_SYS_TREE:=yes # Build with systemd support. If enabled, mosquitto will notify systemd after # initialization. See README in service/systemd/ for more information. +# Setting to yes means the libsystemd-dev or similar package will need to be +# installed. WITH_SYSTEMD:=no # Build with SRV lookup support. From 26fbd0ec74ff6b2dea5833c67ab3b00d9a41e378 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 15 Jan 2021 12:19:20 +0000 Subject: [PATCH 05/51] ctrl: Allow command line arguments to override config file options. Closes #2010. Thanks to Willem Eradus. --- ChangeLog.txt | 3 +++ apps/mosquitto_ctrl/options.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 509cd72c..fc443ff1 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,9 @@ Broker: - Add notes that libsystemd-dev or similar is needed if building with systemd support. Closes #2019. +Apps: +- Allow command line arguments to override config file options in + mosquitto_ctrl. Closes #2010. 2.0.5 - 2021-01-11 ================== diff --git a/apps/mosquitto_ctrl/options.c b/apps/mosquitto_ctrl/options.c index 8d8d3bc9..20e4d2fb 100644 --- a/apps/mosquitto_ctrl/options.c +++ b/apps/mosquitto_ctrl/options.c @@ -89,11 +89,11 @@ int ctrl_config_parse(struct mosq_config *cfg, int *argc, char **argv[]) init_config(cfg); - /* Deal with real argc/argv */ - rc = client_config_line_proc(cfg, argc, argv); + rc = client_config_load(cfg); if(rc) return rc; - rc = client_config_load(cfg); + /* Deal with real argc/argv */ + rc = client_config_line_proc(cfg, argc, argv); if(rc) return rc; #ifdef WITH_TLS From 9c4b9a031173e4a8926235c36212324329b76932 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 15 Jan 2021 12:30:42 +0000 Subject: [PATCH 06/51] ctrl: Error if new passwords don't match. Produce an error when requesting a new password if both attempts do not match. Closes #2011. Thanks to Willem Eradus. --- ChangeLog.txt | 2 ++ apps/mosquitto_ctrl/dynsec.c | 3 +-- apps/mosquitto_ctrl/dynsec_client.c | 5 ++++- apps/mosquitto_passwd/get_password.c | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index fc443ff1..fa5c44b4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,8 @@ Broker: Apps: - Allow command line arguments to override config file options in mosquitto_ctrl. Closes #2010. +- mosquitto_ctrl: produce an error when requesting a new password if both + attempts do not match. Closes #2011. 2.0.5 - 2021-01-11 ================== diff --git a/apps/mosquitto_ctrl/dynsec.c b/apps/mosquitto_ctrl/dynsec.c index 796207e6..53968ab7 100644 --- a/apps/mosquitto_ctrl/dynsec.c +++ b/apps/mosquitto_ctrl/dynsec.c @@ -720,9 +720,8 @@ int dynsec_init(int argc, char *argv[]) snprintf(verify_prompt, sizeof(verify_prompt), "Reenter password for %s: ", admin_user); rc = get_password(prompt, verify_prompt, false, password, sizeof(password)); if(rc){ - fprintf(stderr, "Error getting password.\n"); mosquitto_lib_cleanup(); - return 1; + return -1; } admin_password = password; } diff --git a/apps/mosquitto_ctrl/dynsec_client.c b/apps/mosquitto_ctrl/dynsec_client.c index 45b6d6af..d6131553 100644 --- a/apps/mosquitto_ctrl/dynsec_client.c +++ b/apps/mosquitto_ctrl/dynsec_client.c @@ -65,6 +65,9 @@ int dynsec_client__create(int argc, char *argv[], cJSON *j_command) rc = get_password(prompt, verify_prompt, true, password_buf, sizeof(password_buf)); if(rc == 0){ password = password_buf; + }else if(rc == 2){ + fprintf(stderr, "Error: Passwords do not match.\n"); + return -1; }else{ password = NULL; printf("\n"); @@ -163,7 +166,7 @@ int dynsec_client__set_password(int argc, char *argv[], cJSON *j_command) snprintf(verify_prompt, sizeof(verify_prompt), "Reenter password for %s: ", username); rc = get_password(prompt, verify_prompt, false, password_buf, sizeof(password_buf)); if(rc){ - return MOSQ_ERR_INVAL; + return -1; } password = password_buf; }else{ diff --git a/apps/mosquitto_passwd/get_password.c b/apps/mosquitto_passwd/get_password.c index a3113d1a..aba55656 100644 --- a/apps/mosquitto_passwd/get_password.c +++ b/apps/mosquitto_passwd/get_password.c @@ -135,7 +135,7 @@ int get_password(const char *prompt, const char *verify_prompt, bool quiet, char if(!quiet){ fprintf(stderr, "Error: Passwords do not match.\n"); } - return 1; + return 2; } } From e2ebddfc543b72cc24f58a47dfd49f22a872e07b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 15 Jan 2021 13:54:14 +0000 Subject: [PATCH 07/51] Improve logging in obscure cases when a client disconnects. Closes #2017. Thanks to Craig Leres. --- ChangeLog.txt | 1 + src/loop.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index fa5c44b4..509a2fe4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -6,6 +6,7 @@ Broker: - Fix websockets listeners with TLS not responding. Closes #2020. - Add notes that libsystemd-dev or similar is needed if building with systemd support. Closes #2019. +- Improve logging in obscure cases when a client disconnects. Closes #2017. Apps: - Allow command line arguments to override config file options in diff --git a/src/loop.c b/src/loop.c index aa1367d8..ba146c25 100644 --- a/src/loop.c +++ b/src/loop.c @@ -353,8 +353,11 @@ void do_disconnect(struct mosquitto *context, int reason) case MOSQ_ERR_ADMINISTRATIVE_ACTION: log__printf(NULL, MOSQ_LOG_NOTICE, "Client %s been disconnected by administrative action.", id); break; + case MOSQ_ERR_ERRNO: + log__printf(NULL, MOSQ_LOG_NOTICE, "Client %s disconnected: %s.", id, strerror(errno)); + break; default: - log__printf(NULL, MOSQ_LOG_NOTICE, "Bad socket read/write on client %s, disconnecting.", id); + log__printf(NULL, MOSQ_LOG_NOTICE, "Bad socket read/write on client %s: %s.", id, mosquitto_strerror(reason)); break; } }else{ From c16514ca23d02af4b82b85ce3dcfd3cf97d77db0 Mon Sep 17 00:00:00 2001 From: Boris Feinstein Date: Sun, 17 Jan 2021 15:13:43 +0200 Subject: [PATCH 08/51] perform cjson discovery only if WITH_CJSON=ON When using cmake to build the project, cJson discovery should only be performed if WITH_CJSON=ON. Closes #2026. Signed-off-by: Boris Feinstein --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 327280ba..4650e34f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,12 +99,14 @@ if (WITH_DLT) add_definitions("-DWITH_DLT") endif (WITH_DLT) -FIND_PACKAGE(cJSON) -if (CJSON_FOUND) - message(STATUS ${CJSON_FOUND}) -else (CJSON_FOUND) - message(STATUS "Optional dependency cJSON not found. Some features will be disabled.") -endif(CJSON_FOUND) +if (WITH_CJSON) + FIND_PACKAGE(cJSON) + if (CJSON_FOUND) + message(STATUS ${CJSON_FOUND}) + else (CJSON_FOUND) + message(STATUS "Optional dependency cJSON not found. Some features will be disabled.") + endif(CJSON_FOUND) +endif() # ======================================== # Include projects From c9a4ef402e4a798ece3fb3dd2abaf71a7a805a5b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 19 Jan 2021 10:15:11 +0000 Subject: [PATCH 09/51] Update changelog. --- ChangeLog.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 509a2fe4..f818c003 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -14,6 +14,11 @@ Apps: - mosquitto_ctrl: produce an error when requesting a new password if both attempts do not match. Closes #2011. +Build: +- Fix cmake builds using `WITH_CJSON=no` not working if cJSON not found. + Closes #2026. + + 2.0.5 - 2021-01-11 ================== From 4165224885aebb9f78ac327a241753dcb3dfeba7 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 19 Jan 2021 10:16:06 +0000 Subject: [PATCH 10/51] Fix reloading of listeners where multiple listeners have the same port. This is only possible where they have different bind addresses. Closes #2029. Thanks to Simon Aldrich. --- ChangeLog.txt | 2 ++ src/conf.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f818c003..02ceae9a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,8 @@ Broker: - Add notes that libsystemd-dev or similar is needed if building with systemd support. Closes #2019. - Improve logging in obscure cases when a client disconnects. Closes #2017. +- Fix reloading of listeners where multiple listeners have been defined with + the same port but different bind addresses. Closes #2029. Apps: - Allow command line arguments to override config file options in diff --git a/src/conf.c b/src/conf.c index 611a6203..9c9de4f4 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1417,8 +1417,21 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct { for(i=0; ilistener_count; i++){ if(config->listeners[i].port == tmp_int){ - cur_listener = &config->listeners[i]; - break; + /* Now check we have a matching bind address, if defined */ + if(config->listeners[i].host){ + if(token && !strcmp(config->listeners[i].host, token)){ + /* They both have a bind address, and they match */ + cur_listener = &config->listeners[i]; + break; + } + }else{ + if(token == NULL){ + /* Neither this config nor the new config have a bind address, + * so they match. */ + cur_listener = &config->listeners[i]; + break; + } + } } } } From 3c58ac9308ccbb6af5248c2c9291f33f4dac3c1d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 19 Jan 2021 11:51:00 +0000 Subject: [PATCH 11/51] Fix `message_size_limit` not applying to the Will payload. Closes #2022. Thanks to Umberto Morelli. --- ChangeLog.txt | 1 + src/conf.c | 1 + src/handle_connect.c | 15 +++- src/handle_publish.c | 2 +- src/loop.c | 5 +- .../broker/02-subpub-qos0-oversize-payload.py | 75 +++++++++++++++++ .../broker/02-subpub-qos1-oversize-payload.py | 81 +++++++++++++++++++ test/broker/07-will-oversize-payload.py | 71 ++++++++++++++++ test/broker/Makefile | 3 + test/broker/test.py | 3 + test/mosq_test.py | 24 ++++-- 11 files changed, 271 insertions(+), 10 deletions(-) create mode 100755 test/broker/02-subpub-qos0-oversize-payload.py create mode 100755 test/broker/02-subpub-qos1-oversize-payload.py create mode 100755 test/broker/07-will-oversize-payload.py diff --git a/ChangeLog.txt b/ChangeLog.txt index 02ceae9a..e725203d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -9,6 +9,7 @@ Broker: - Improve logging in obscure cases when a client disconnects. Closes #2017. - Fix reloading of listeners where multiple listeners have been defined with the same port but different bind addresses. Closes #2029. +- Fix `message_size_limit` not applying to the Will payload. Closes #2022. Apps: - Allow command line arguments to override config file options in diff --git a/src/conf.c b/src/conf.c index 9c9de4f4..ba65fc00 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1696,6 +1696,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct } memory__set_limit((size_t)lim); }else if(!strcmp(token, "message_size_limit")){ + log__printf(NULL, MOSQ_LOG_NOTICE, "Note: It is recommended to replace `message_size_limit` with `max_packet_size`."); if(conf__parse_int(&token, "message_size_limit", (int *)&config->message_size_limit, saveptr)) return MOSQ_ERR_INVAL; if(config->message_size_limit > MQTT_MAX_PAYLOAD){ log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid message_size_limit value (%u).", config->message_size_limit); diff --git a/src/handle_connect.c b/src/handle_connect.c index 5a33fdde..fc6ebbd8 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -291,7 +291,7 @@ error: } -static int will__read(struct mosquitto *context, struct mosquitto_message_all **will, uint8_t will_qos, int will_retain) +static int will__read(struct mosquitto *context, const char *client_id, struct mosquitto_message_all **will, uint8_t will_qos, int will_retain) { int rc = MOSQ_ERR_SUCCESS; size_t slen; @@ -344,6 +344,17 @@ static int will__read(struct mosquitto *context, struct mosquitto_message_all ** will_struct->msg.payloadlen = payloadlen; if(will_struct->msg.payloadlen > 0){ + if(db.config->message_size_limit && will_struct->msg.payloadlen > db.config->message_size_limit){ + log__printf(NULL, MOSQ_LOG_DEBUG, "Client %s connected with too large Will payload", client_id); + if(context->protocol == mosq_p_mqtt5){ + send__connack(context, 0, MQTT_RC_PACKET_TOO_LARGE, NULL); + }else{ + send__connack(context, 0, CONNACK_REFUSED_NOT_AUTHORIZED, NULL); + } + context__disconnect(context); + rc = MOSQ_ERR_PAYLOAD_SIZE; + goto error_cleanup; + } will_struct->msg.payload = mosquitto__malloc((size_t)will_struct->msg.payloadlen); if(!will_struct->msg.payload){ rc = MOSQ_ERR_NOMEM; @@ -602,7 +613,7 @@ int handle__connect(struct mosquitto *context) } if(will){ - rc = will__read(context, &will_struct, will_qos, will_retain); + rc = will__read(context, client_id, &will_struct, will_qos, will_retain); if(rc) goto handle_connect_error; }else{ if(context->protocol == mosq_p_mqtt311 || context->protocol == mosq_p_mqtt5){ diff --git a/src/handle_publish.c b/src/handle_publish.c index c5843832..3f9a1627 100644 --- a/src/handle_publish.c +++ b/src/handle_publish.c @@ -224,7 +224,7 @@ int handle__publish(struct mosquitto *context) if(msg->payloadlen){ if(db.config->message_size_limit && msg->payloadlen > db.config->message_size_limit){ log__printf(NULL, MOSQ_LOG_DEBUG, "Dropped too large PUBLISH from %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))", context->id, dup, msg->qos, msg->retain, msg->source_mid, msg->topic, (long)msg->payloadlen); - reason_code = MQTT_RC_IMPLEMENTATION_SPECIFIC; + reason_code = MQTT_RC_PACKET_TOO_LARGE; goto process_bad_message; } msg->payload = mosquitto__malloc(msg->payloadlen+1); diff --git a/src/loop.c b/src/loop.c index ba146c25..ec8b80f8 100644 --- a/src/loop.c +++ b/src/loop.c @@ -344,6 +344,9 @@ void do_disconnect(struct mosquitto *context, int reason) case MOSQ_ERR_OVERSIZE_PACKET: log__printf(NULL, MOSQ_LOG_NOTICE, "Client %s disconnected due to oversize packet.", id); break; + case MOSQ_ERR_PAYLOAD_SIZE: + log__printf(NULL, MOSQ_LOG_NOTICE, "Client %s disconnected due to oversize payload.", id); + break; case MOSQ_ERR_NOMEM: log__printf(NULL, MOSQ_LOG_NOTICE, "Client %s disconnected due to out of memory.", id); break; @@ -357,7 +360,7 @@ void do_disconnect(struct mosquitto *context, int reason) log__printf(NULL, MOSQ_LOG_NOTICE, "Client %s disconnected: %s.", id, strerror(errno)); break; default: - log__printf(NULL, MOSQ_LOG_NOTICE, "Bad socket read/write on client %s: %s.", id, mosquitto_strerror(reason)); + log__printf(NULL, MOSQ_LOG_NOTICE, "Bad socket read/write on client %s: %s", id, mosquitto_strerror(reason)); break; } }else{ diff --git a/test/broker/02-subpub-qos0-oversize-payload.py b/test/broker/02-subpub-qos0-oversize-payload.py new file mode 100755 index 00000000..4e78dacf --- /dev/null +++ b/test/broker/02-subpub-qos0-oversize-payload.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 + +# Test whether message size limits apply. + +from mosq_test_helper import * + +def write_config(filename, port): + with open(filename, 'w') as f: + f.write("listener %d\n" % (port)) + f.write("allow_anonymous true\n") + f.write("message_size_limit 1\n") + +def do_test(proto_ver): + rc = 1 + mid = 53 + keepalive = 60 + connect_packet = mosq_test.gen_connect("subpub-qos0-test", keepalive=keepalive, proto_ver=proto_ver) + connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) + + subscribe_packet = mosq_test.gen_subscribe(mid, "subpub/qos0", 0, proto_ver=proto_ver) + suback_packet = mosq_test.gen_suback(mid, 0, proto_ver=proto_ver) + + connect2_packet = mosq_test.gen_connect("subpub-qos0-helper", keepalive=keepalive, proto_ver=proto_ver) + connack2_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) + + publish_packet_ok = mosq_test.gen_publish("subpub/qos0", qos=0, payload="A", proto_ver=proto_ver) + publish_packet_bad = mosq_test.gen_publish("subpub/qos0", qos=0, payload="AB", proto_ver=proto_ver) + + port = mosq_test.get_port() + conf_file = os.path.basename(__file__).replace('.py', '.conf') + write_config(conf_file, port) + + broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) + + try: + sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=20, port=port) + mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") + + sock2 = mosq_test.do_client_connect(connect2_packet, connack2_packet, timeout=20, port=port) + sock2.send(publish_packet_ok) + mosq_test.expect_packet(sock, "publish 1", publish_packet_ok) + + # Check all is still well on the publishing client + mosq_test.do_ping(sock2) + + sock2.send(publish_packet_bad) + + # Check all is still well on the publishing client + mosq_test.do_ping(sock2) + + # The subscribing client shouldn't have received a PUBLISH + mosq_test.do_ping(sock) + rc = 0 + + sock.close() + except SyntaxError: + raise + except TypeError: + raise + except mosq_test.TestError: + pass + finally: + os.remove(conf_file) + broker.terminate() + broker.wait() + (stdo, stde) = broker.communicate() + if rc: + print(stde.decode('utf-8')) + print("proto_ver=%d" % (proto_ver)) + exit(rc) + + +do_test(proto_ver=4) +do_test(proto_ver=5) +exit(0) diff --git a/test/broker/02-subpub-qos1-oversize-payload.py b/test/broker/02-subpub-qos1-oversize-payload.py new file mode 100755 index 00000000..17878004 --- /dev/null +++ b/test/broker/02-subpub-qos1-oversize-payload.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 + +# Test whether message size limits apply. + +from mosq_test_helper import * + +def write_config(filename, port): + with open(filename, 'w') as f: + f.write("listener %d\n" % (port)) + f.write("allow_anonymous true\n") + f.write("message_size_limit 1\n") + +def do_test(proto_ver): + rc = 1 + mid = 53 + keepalive = 60 + connect_packet = mosq_test.gen_connect("subpub-qos1-test", keepalive=keepalive, proto_ver=proto_ver) + connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) + + subscribe_packet = mosq_test.gen_subscribe(mid, "subpub/qos1", 1, proto_ver=proto_ver) + suback_packet = mosq_test.gen_suback(mid, 1, proto_ver=proto_ver) + + connect2_packet = mosq_test.gen_connect("subpub-qos1-helper", keepalive=keepalive, proto_ver=proto_ver) + connack2_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) + + mid = 1 + publish_packet_ok = mosq_test.gen_publish("subpub/qos1", mid=mid, qos=1, payload="A", proto_ver=proto_ver) + puback_packet_ok = mosq_test.gen_puback(mid=mid, proto_ver=proto_ver) + + mid = 2 + publish_packet_bad = mosq_test.gen_publish("subpub/qos1", mid=mid, qos=1, payload="AB", proto_ver=proto_ver) + if proto_ver == 5: + puback_packet_bad = mosq_test.gen_puback(reason_code=mqtt5_rc.MQTT_RC_PACKET_TOO_LARGE, mid=mid, proto_ver=proto_ver) + else: + puback_packet_bad = mosq_test.gen_puback(mid=mid, proto_ver=proto_ver) + + port = mosq_test.get_port() + conf_file = os.path.basename(__file__).replace('.py', '.conf') + write_config(conf_file, port) + + broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) + + try: + sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=20, port=port) + mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") + + sock2 = mosq_test.do_client_connect(connect2_packet, connack2_packet, timeout=20, port=port) + mosq_test.do_send_receive(sock2, publish_packet_ok, puback_packet_ok, "puback 1") + mosq_test.expect_packet(sock, "publish 1", publish_packet_ok) + sock.send(puback_packet_ok) + + # Check all is still well on the publishing client + mosq_test.do_ping(sock2) + + mosq_test.do_send_receive(sock2, publish_packet_bad, puback_packet_bad, "puback 2") + + # The subscribing client shouldn't have received a PUBLISH + mosq_test.do_ping(sock) + rc = 0 + + sock.close() + except SyntaxError: + raise + except TypeError: + raise + except mosq_test.TestError: + pass + finally: + os.remove(conf_file) + broker.terminate() + broker.wait() + (stdo, stde) = broker.communicate() + if rc: + print(stde.decode('utf-8')) + print("proto_ver=%d" % (proto_ver)) + exit(rc) + + +do_test(proto_ver=4) +do_test(proto_ver=5) +exit(0) diff --git a/test/broker/07-will-oversize-payload.py b/test/broker/07-will-oversize-payload.py new file mode 100755 index 00000000..319ec509 --- /dev/null +++ b/test/broker/07-will-oversize-payload.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 + +# Test whether a client will that is too large is handled + +from mosq_test_helper import * + +def write_config(filename, port): + with open(filename, 'w') as f: + f.write("listener %d\n" % (port)) + f.write("allow_anonymous true\n") + f.write("message_size_limit 1\n") + +def do_test(proto_ver, clean_session): + rc = 1 + mid = 53 + keepalive = 60 + connect_packet = mosq_test.gen_connect("will-test", keepalive=keepalive, proto_ver=proto_ver) + connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) + + connect_packet_ok = mosq_test.gen_connect("test-helper", keepalive=keepalive, will_topic="will/qos0/test", will_payload=b"A", clean_session=clean_session, proto_ver=proto_ver, session_expiry=60) + connack_packet_ok = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) + + connect_packet_bad = mosq_test.gen_connect("test-helper", keepalive=keepalive, will_topic="will/qos0/test", will_payload=b"AB", clean_session=clean_session, proto_ver=proto_ver, session_expiry=60) + if proto_ver == 5: + connack_packet_bad = mosq_test.gen_connack(rc=mqtt5_rc.MQTT_RC_PACKET_TOO_LARGE, proto_ver=proto_ver, property_helper=False) + else: + connack_packet_bad = mosq_test.gen_connack(rc=5, proto_ver=proto_ver) + + subscribe_packet = mosq_test.gen_subscribe(mid, "will/qos0/test", 0, proto_ver=proto_ver) + suback_packet = mosq_test.gen_suback(mid, 0, proto_ver=proto_ver) + + publish_packet = mosq_test.gen_publish("will/qos0/test", qos=0, payload="A", proto_ver=proto_ver) + + port = mosq_test.get_port() + conf_file = os.path.basename(__file__).replace('.py', '.conf') + write_config(conf_file, port) + + broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) + + try: + sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=5, port=port) + mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") + + sock2 = mosq_test.do_client_connect(connect_packet_bad, connack_packet_bad, port=port, timeout=5) + sock2.close() + + sock2 = mosq_test.do_client_connect(connect_packet_ok, connack_packet_ok, port=port, timeout=5) + sock2.close() + + mosq_test.expect_packet(sock, "publish", publish_packet) + # Check there are no more messages + mosq_test.do_ping(sock) + rc = 0 + + sock.close() + except mosq_test.TestError: + pass + finally: + os.remove(conf_file) + broker.terminate() + broker.wait() + (stdo, stde) = broker.communicate() + if rc: + print(stde.decode('utf-8')) + exit(rc) + +do_test(4, True) +do_test(4, False) +do_test(5, True) +do_test(5, False) +exit(0) diff --git a/test/broker/Makefile b/test/broker/Makefile index c139e1be..fcb6839d 100644 --- a/test/broker/Makefile +++ b/test/broker/Makefile @@ -44,6 +44,7 @@ test : test-compile 01 02 03 04 05 06 07 08 09 10 11 12 13 14 ./02-shared-qos0-v5.py ./02-subhier-crash.py ./02-subpub-qos0-long-topic.py + ./02-subpub-qos0-oversize-payload.py ./02-subpub-qos0-retain-as-publish.py ./02-subpub-qos0-send-retain.py ./02-subpub-qos0-subscription-id.py @@ -56,6 +57,7 @@ test : test-compile 01 02 03 04 05 06 07 08 09 10 11 12 13 14 ./02-subpub-qos1-message-expiry-will.py ./02-subpub-qos1-message-expiry.py ./02-subpub-qos1-nolocal.py + ./02-subpub-qos1-oversize-payload.py ./02-subpub-qos1.py ./02-subpub-qos2-1322.py ./02-subpub-qos2-bad-puback-1.py @@ -141,6 +143,7 @@ test : test-compile 01 02 03 04 05 06 07 08 09 10 11 12 13 14 ./07-will-no-flag.py ./07-will-null-topic.py ./07-will-null.py + ./07-will-oversize-payload.py ./07-will-properties.py ./07-will-qos0.py ./07-will-reconnect-1273.py diff --git a/test/broker/test.py b/test/broker/test.py index 28ecc92d..0514359a 100755 --- a/test/broker/test.py +++ b/test/broker/test.py @@ -27,6 +27,7 @@ tests = [ (1, './02-shared-qos0-v5.py'), (1, './02-subhier-crash.py'), (1, './02-subpub-qos0-long-topic.py'), + (1, './02-subpub-qos0-oversize-payload.py'), (1, './02-subpub-qos0-retain-as-publish.py'), (1, './02-subpub-qos0-send-retain.py'), (1, './02-subpub-qos0-subscription-id.py'), @@ -39,6 +40,7 @@ tests = [ (1, './02-subpub-qos1-message-expiry-will.py'), (1, './02-subpub-qos1-message-expiry.py'), (1, './02-subpub-qos1-nolocal.py'), + (1, './02-subpub-qos1-oversize-payload.py'), (1, './02-subpub-qos1.py'), (1, './02-subpub-qos2-1322.py'), (1, './02-subpub-qos2-bad-puback-1.py'), @@ -120,6 +122,7 @@ tests = [ (1, './07-will-no-flag.py'), (1, './07-will-null-topic.py'), (1, './07-will-null.py'), + (1, './07-will-oversize-payload.py'), (1, './07-will-properties.py'), (1, './07-will-qos0.py'), (1, './07-will-reconnect-1273.py'), diff --git a/test/mosq_test.py b/test/mosq_test.py index 901ece55..52dcca0c 100644 --- a/test/mosq_test.py +++ b/test/mosq_test.py @@ -284,12 +284,20 @@ def to_string(packet): return s elif cmd == 0x40: # PUBACK - (cmd, rl, mid) = struct.unpack('!BBH', packet) - return "PUBACK, rl="+str(rl)+", mid="+str(mid) + if len(packet) == 5: + (cmd, rl, mid, reason_code) = struct.unpack('!BBHB', packet) + return "PUBACK, rl="+str(rl)+", mid="+str(mid)+", reason_code="+str(reason_code) + else: + (cmd, rl, mid) = struct.unpack('!BBH', packet) + return "PUBACK, rl="+str(rl)+", mid="+str(mid) elif cmd == 0x50: # PUBREC - (cmd, rl, mid) = struct.unpack('!BBH', packet) - return "PUBREC, rl="+str(rl)+", mid="+str(mid) + if len(packet) == 5: + (cmd, rl, mid, reason_code) = struct.unpack('!BBHB', packet) + return "PUBREC, rl="+str(rl)+", mid="+str(mid)+", reason_code="+str(reason_code) + else: + (cmd, rl, mid) = struct.unpack('!BBH', packet) + return "PUBREC, rl="+str(rl)+", mid="+str(mid) elif cmd == 0x60: # PUBREL dup = (packet0 & 0x08)>>3 @@ -353,8 +361,12 @@ def to_string(packet): return "PINGRESP, rl="+str(rl) elif cmd == 0xE0: # DISCONNECT - (cmd, rl) = struct.unpack('!BB', packet) - return "DISCONNECT, rl="+str(rl) + if len(packet) == 3: + (cmd, rl, reason_code) = struct.unpack('!BBB', packet) + return "DISCONNECT, rl="+str(rl)+", reason_code="+str(reason_code) + else: + (cmd, rl) = struct.unpack('!BB', packet) + return "DISCONNECT, rl="+str(rl) elif cmd == 0xF0: # AUTH (cmd, rl) = struct.unpack('!BB', packet) From cf1098eff1d9b57b38601ef8b694bce6ef0c6501 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 20 Jan 2021 10:28:40 +0000 Subject: [PATCH 12/51] Send protocol error on topic alias not found. The error topic-alias-invalid was being sent if an MQTT v5 client published a message with empty topic and topic alias set, but the topic alias hadn't already been configured on the broker. This has been fixed to send a protocol error, as per section 3.3.4 of the specification. --- ChangeLog.txt | 4 ++++ src/handle_publish.c | 2 +- test/broker/02-subpub-qos0-topic-alias-unknown.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index e725203d..1178e908 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,10 @@ Broker: - Fix reloading of listeners where multiple listeners have been defined with the same port but different bind addresses. Closes #2029. - Fix `message_size_limit` not applying to the Will payload. Closes #2022. +- The error topic-alias-invalid was being sent if an MQTT v5 client published + a message with empty topic and topic alias set, but the topic alias hadn't + already been configured on the broker. This has been fixed to send a + protocol error, as per section 3.3.4 of the specification. Apps: - Allow command line arguments to override config file options in diff --git a/src/handle_publish.c b/src/handle_publish.c index 3f9a1627..1e3d9b4f 100644 --- a/src/handle_publish.c +++ b/src/handle_publish.c @@ -186,7 +186,7 @@ int handle__publish(struct mosquitto *context) rc = alias__find(context, &msg->topic, (uint16_t)topic_alias); if(rc){ db__msg_store_free(msg); - return MOSQ_ERR_TOPIC_ALIAS_INVALID; + return MOSQ_ERR_PROTOCOL; } } } diff --git a/test/broker/02-subpub-qos0-topic-alias-unknown.py b/test/broker/02-subpub-qos0-topic-alias-unknown.py index cdce33ce..62227127 100755 --- a/test/broker/02-subpub-qos0-topic-alias-unknown.py +++ b/test/broker/02-subpub-qos0-topic-alias-unknown.py @@ -14,7 +14,7 @@ def do_test(): props = mqtt5_props.gen_uint16_prop(mqtt5_props.PROP_TOPIC_ALIAS, 3) publish1_packet = mosq_test.gen_publish("", qos=0, payload="message", proto_ver=5, properties=props) - disconnect_packet = mosq_test.gen_disconnect(reason_code=148, proto_ver=5) + disconnect_packet = mosq_test.gen_disconnect(reason_code=mqtt5_rc.MQTT_RC_PROTOCOL_ERROR, proto_ver=5) port = mosq_test.get_port() broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) From a4389fc9ce9a21442b36a14305648be79febd91e Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 20 Jan 2021 11:46:18 +0000 Subject: [PATCH 13/51] Fix SPDX identifiers: EDL-1.0 -> BSD-3-Clause. The two licenses are the same. --- ChangeLog.txt | 4 ++++ apps/db_dump/db_dump.c | 2 +- apps/db_dump/db_dump.h | 2 +- apps/db_dump/print.c | 2 +- apps/mosquitto_ctrl/client.c | 2 +- apps/mosquitto_ctrl/dynsec.c | 2 +- apps/mosquitto_ctrl/dynsec_client.c | 2 +- apps/mosquitto_ctrl/dynsec_group.c | 2 +- apps/mosquitto_ctrl/dynsec_role.c | 2 +- apps/mosquitto_ctrl/example.c | 2 +- apps/mosquitto_ctrl/mosquitto_ctrl.c | 2 +- apps/mosquitto_ctrl/mosquitto_ctrl.h | 2 +- apps/mosquitto_ctrl/options.c | 2 +- apps/mosquitto_passwd/get_password.c | 2 +- apps/mosquitto_passwd/get_password.h | 2 +- apps/mosquitto_passwd/mosquitto_passwd.c | 2 +- client/client_props.c | 2 +- client/client_shared.c | 2 +- client/client_shared.h | 2 +- client/pub_client.c | 2 +- client/pub_shared.c | 2 +- client/pub_shared.h | 2 +- client/rr_client.c | 2 +- client/sub_client.c | 2 +- client/sub_client_output.c | 2 +- client/sub_client_output.h | 2 +- include/mosquitto.h | 2 +- include/mosquitto_broker.h | 2 +- include/mosquitto_plugin.h | 2 +- include/mqtt_protocol.h | 2 +- lib/actions.c | 2 +- lib/alias_mosq.c | 2 +- lib/alias_mosq.h | 2 +- lib/callbacks.c | 2 +- lib/connect.c | 2 +- lib/handle_auth.c | 2 +- lib/handle_connack.c | 2 +- lib/handle_disconnect.c | 2 +- lib/handle_ping.c | 2 +- lib/handle_pubackcomp.c | 2 +- lib/handle_publish.c | 2 +- lib/handle_pubrec.c | 2 +- lib/handle_pubrel.c | 2 +- lib/handle_suback.c | 2 +- lib/handle_unsuback.c | 2 +- lib/helpers.c | 2 +- lib/logging_mosq.c | 2 +- lib/logging_mosq.h | 2 +- lib/loop.c | 2 +- lib/memory_mosq.c | 2 +- lib/memory_mosq.h | 2 +- lib/messages_mosq.c | 2 +- lib/messages_mosq.h | 2 +- lib/misc_mosq.c | 2 +- lib/misc_mosq.h | 2 +- lib/mosquitto.c | 2 +- lib/mosquitto_internal.h | 2 +- lib/net_mosq.c | 2 +- lib/net_mosq.h | 2 +- lib/net_mosq_ocsp.c | 2 +- lib/options.c | 2 +- lib/packet_datatypes.c | 2 +- lib/packet_mosq.c | 2 +- lib/packet_mosq.h | 2 +- lib/property_mosq.c | 2 +- lib/property_mosq.h | 2 +- lib/read_handle.c | 2 +- lib/read_handle.h | 2 +- lib/send_connect.c | 2 +- lib/send_disconnect.c | 2 +- lib/send_mosq.c | 2 +- lib/send_mosq.h | 2 +- lib/send_publish.c | 2 +- lib/send_subscribe.c | 2 +- lib/send_unsubscribe.c | 2 +- lib/socks_mosq.c | 2 +- lib/socks_mosq.h | 2 +- lib/srv_mosq.c | 2 +- lib/strings_mosq.c | 2 +- lib/thread_mosq.c | 2 +- lib/time_mosq.c | 2 +- lib/time_mosq.h | 2 +- lib/tls_mosq.c | 2 +- lib/tls_mosq.h | 2 +- lib/utf8_mosq.c | 2 +- lib/util_mosq.c | 2 +- lib/util_mosq.h | 2 +- lib/util_topic.c | 2 +- lib/will_mosq.c | 2 +- lib/will_mosq.h | 2 +- plugins/dynamic-security/acl.c | 2 +- plugins/dynamic-security/auth.c | 2 +- plugins/dynamic-security/clientlist.c | 2 +- plugins/dynamic-security/clients.c | 2 +- plugins/dynamic-security/dynamic_security.h | 2 +- plugins/dynamic-security/grouplist.c | 2 +- plugins/dynamic-security/groups.c | 2 +- plugins/dynamic-security/json_help.c | 2 +- plugins/dynamic-security/json_help.h | 2 +- plugins/dynamic-security/plugin.c | 2 +- plugins/dynamic-security/rolelist.c | 2 +- plugins/dynamic-security/roles.c | 2 +- plugins/dynamic-security/sub_matches_sub.c | 2 +- plugins/message-timestamp/mosquitto_message_timestamp.c | 2 +- plugins/payload-modification/mosquitto_payload_modification.c | 2 +- src/bridge.c | 2 +- src/bridge_topic.c | 2 +- src/conf.c | 2 +- src/conf_includedir.c | 2 +- src/context.c | 2 +- src/control.c | 2 +- src/database.c | 2 +- src/handle_auth.c | 2 +- src/handle_connack.c | 2 +- src/handle_connect.c | 2 +- src/handle_disconnect.c | 2 +- src/handle_publish.c | 2 +- src/handle_subscribe.c | 2 +- src/handle_unsubscribe.c | 2 +- src/keepalive.c | 2 +- src/lib_load.h | 2 +- src/logging.c | 2 +- src/loop.c | 2 +- src/memory_public.c | 2 +- src/mosquitto.c | 2 +- src/mosquitto_broker_internal.h | 2 +- src/mux.c | 2 +- src/mux.h | 2 +- src/mux_epoll.c | 2 +- src/mux_poll.c | 2 +- src/net.c | 2 +- src/password_mosq.c | 2 +- src/password_mosq.h | 2 +- src/persist.h | 2 +- src/persist_read.c | 2 +- src/persist_read_v234.c | 2 +- src/persist_read_v5.c | 2 +- src/persist_write.c | 2 +- src/persist_write_v5.c | 2 +- src/plugin.c | 2 +- src/plugin_debug.c | 2 +- src/plugin_defer.c | 2 +- src/plugin_public.c | 2 +- src/property_broker.c | 2 +- src/read_handle.c | 2 +- src/retain.c | 2 +- src/security.c | 2 +- src/security_default.c | 2 +- src/send_auth.c | 2 +- src/send_connack.c | 2 +- src/send_suback.c | 2 +- src/send_unsuback.c | 2 +- src/service.c | 2 +- src/session_expiry.c | 2 +- src/signals.c | 2 +- src/subs.c | 2 +- src/sys_tree.c | 2 +- src/sys_tree.h | 2 +- src/topic_tok.c | 2 +- src/websockets.c | 2 +- src/will_delay.c | 2 +- src/xtreport.c | 2 +- 162 files changed, 165 insertions(+), 161 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 1178e908..402fc43d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -25,6 +25,10 @@ Build: - Fix cmake builds using `WITH_CJSON=no` not working if cJSON not found. Closes #2026. +Other: +- The SPDX identifiers for EDL-1.0 have been changed to BSD-3-Clause as per + The Eclipse legal documentation generator. The licenses are identical. + 2.0.5 - 2021-01-11 ================== diff --git a/apps/db_dump/db_dump.c b/apps/db_dump/db_dump.c index c0c1e056..ad6d2f7b 100644 --- a/apps/db_dump/db_dump.c +++ b/apps/db_dump/db_dump.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/db_dump/db_dump.h b/apps/db_dump/db_dump.h index 86294180..f6586aa7 100644 --- a/apps/db_dump/db_dump.h +++ b/apps/db_dump/db_dump.h @@ -12,7 +12,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/db_dump/print.c b/apps/db_dump/print.c index 10ab1d38..84ca2ef0 100644 --- a/apps/db_dump/print.c +++ b/apps/db_dump/print.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_ctrl/client.c b/apps/mosquitto_ctrl/client.c index ea04e2e3..4464ce16 100644 --- a/apps/mosquitto_ctrl/client.c +++ b/apps/mosquitto_ctrl/client.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_ctrl/dynsec.c b/apps/mosquitto_ctrl/dynsec.c index 53968ab7..3a0f9761 100644 --- a/apps/mosquitto_ctrl/dynsec.c +++ b/apps/mosquitto_ctrl/dynsec.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_ctrl/dynsec_client.c b/apps/mosquitto_ctrl/dynsec_client.c index d6131553..ed900eff 100644 --- a/apps/mosquitto_ctrl/dynsec_client.c +++ b/apps/mosquitto_ctrl/dynsec_client.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_ctrl/dynsec_group.c b/apps/mosquitto_ctrl/dynsec_group.c index 5fc31b84..742e9418 100644 --- a/apps/mosquitto_ctrl/dynsec_group.c +++ b/apps/mosquitto_ctrl/dynsec_group.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_ctrl/dynsec_role.c b/apps/mosquitto_ctrl/dynsec_role.c index 2bc5a03d..14eebcaa 100644 --- a/apps/mosquitto_ctrl/dynsec_role.c +++ b/apps/mosquitto_ctrl/dynsec_role.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_ctrl/example.c b/apps/mosquitto_ctrl/example.c index 1027fb60..4df53bc8 100644 --- a/apps/mosquitto_ctrl/example.c +++ b/apps/mosquitto_ctrl/example.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_ctrl/mosquitto_ctrl.c b/apps/mosquitto_ctrl/mosquitto_ctrl.c index 6ee729c2..bda95902 100644 --- a/apps/mosquitto_ctrl/mosquitto_ctrl.c +++ b/apps/mosquitto_ctrl/mosquitto_ctrl.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_ctrl/mosquitto_ctrl.h b/apps/mosquitto_ctrl/mosquitto_ctrl.h index 0c9c931a..fce2a78d 100644 --- a/apps/mosquitto_ctrl/mosquitto_ctrl.h +++ b/apps/mosquitto_ctrl/mosquitto_ctrl.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_ctrl/options.c b/apps/mosquitto_ctrl/options.c index 20e4d2fb..5c36e5db 100644 --- a/apps/mosquitto_ctrl/options.c +++ b/apps/mosquitto_ctrl/options.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_passwd/get_password.c b/apps/mosquitto_passwd/get_password.c index aba55656..a62a76cd 100644 --- a/apps/mosquitto_passwd/get_password.c +++ b/apps/mosquitto_passwd/get_password.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_passwd/get_password.h b/apps/mosquitto_passwd/get_password.h index f62afd0d..3cada7c6 100644 --- a/apps/mosquitto_passwd/get_password.h +++ b/apps/mosquitto_passwd/get_password.h @@ -12,7 +12,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/apps/mosquitto_passwd/mosquitto_passwd.c b/apps/mosquitto_passwd/mosquitto_passwd.c index 26846881..0b8cec9d 100644 --- a/apps/mosquitto_passwd/mosquitto_passwd.c +++ b/apps/mosquitto_passwd/mosquitto_passwd.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/client_props.c b/client/client_props.c index 0c34e3a5..45d5052d 100644 --- a/client/client_props.c +++ b/client/client_props.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/client_shared.c b/client/client_shared.c index 03d518c1..a4a9531c 100644 --- a/client/client_shared.c +++ b/client/client_shared.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/client_shared.h b/client/client_shared.h index 8fb9c624..156c7f68 100644 --- a/client/client_shared.h +++ b/client/client_shared.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/pub_client.c b/client/pub_client.c index 9f276c63..9153ebad 100644 --- a/client/pub_client.c +++ b/client/pub_client.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/pub_shared.c b/client/pub_shared.c index 2718c4eb..a7f6092e 100644 --- a/client/pub_shared.c +++ b/client/pub_shared.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/pub_shared.h b/client/pub_shared.h index 023d91a9..9f657de4 100644 --- a/client/pub_shared.h +++ b/client/pub_shared.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/rr_client.c b/client/rr_client.c index 464d735e..2331a4ed 100644 --- a/client/rr_client.c +++ b/client/rr_client.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/sub_client.c b/client/sub_client.c index 352c4694..e2cebcdc 100644 --- a/client/sub_client.c +++ b/client/sub_client.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/sub_client_output.c b/client/sub_client_output.c index 0163b0e2..c0270e8b 100644 --- a/client/sub_client_output.c +++ b/client/sub_client_output.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/client/sub_client_output.h b/client/sub_client_output.h index 17abb1dc..9bca8b67 100644 --- a/client/sub_client_output.h +++ b/client/sub_client_output.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/include/mosquitto.h b/include/mosquitto.h index cd10ea60..a517cf31 100644 --- a/include/mosquitto.h +++ b/include/mosquitto.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/include/mosquitto_broker.h b/include/mosquitto_broker.h index 9768975f..9653cab9 100644 --- a/include/mosquitto_broker.h +++ b/include/mosquitto_broker.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/include/mosquitto_plugin.h b/include/mosquitto_plugin.h index 4199c7b3..d8a6c72c 100644 --- a/include/mosquitto_plugin.h +++ b/include/mosquitto_plugin.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/include/mqtt_protocol.h b/include/mqtt_protocol.h index 86d7dc99..15c4c3ef 100644 --- a/include/mqtt_protocol.h +++ b/include/mqtt_protocol.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/actions.c b/lib/actions.c index 4f7ff012..9ea4aee8 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/alias_mosq.c b/lib/alias_mosq.c index 522a3650..95fbc969 100644 --- a/lib/alias_mosq.c +++ b/lib/alias_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/alias_mosq.h b/lib/alias_mosq.h index 67e2520c..7df41497 100644 --- a/lib/alias_mosq.h +++ b/lib/alias_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/callbacks.c b/lib/callbacks.c index ea770eee..5dc50e24 100644 --- a/lib/callbacks.c +++ b/lib/callbacks.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/connect.c b/lib/connect.c index f5669924..196fde47 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_auth.c b/lib/handle_auth.c index 33130ca3..e33d085d 100644 --- a/lib/handle_auth.c +++ b/lib/handle_auth.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_connack.c b/lib/handle_connack.c index 7cf50952..6dca1395 100644 --- a/lib/handle_connack.c +++ b/lib/handle_connack.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_disconnect.c b/lib/handle_disconnect.c index 4d1ac479..a0a638db 100644 --- a/lib/handle_disconnect.c +++ b/lib/handle_disconnect.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_ping.c b/lib/handle_ping.c index 9009b720..24a9e4e5 100644 --- a/lib/handle_ping.c +++ b/lib/handle_ping.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_pubackcomp.c b/lib/handle_pubackcomp.c index ed0c5dca..5755708e 100644 --- a/lib/handle_pubackcomp.c +++ b/lib/handle_pubackcomp.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_publish.c b/lib/handle_publish.c index 12cced6f..40644ef3 100644 --- a/lib/handle_publish.c +++ b/lib/handle_publish.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_pubrec.c b/lib/handle_pubrec.c index fc5b7cf4..b741a076 100644 --- a/lib/handle_pubrec.c +++ b/lib/handle_pubrec.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_pubrel.c b/lib/handle_pubrel.c index 1cd2864a..b52e631c 100644 --- a/lib/handle_pubrel.c +++ b/lib/handle_pubrel.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_suback.c b/lib/handle_suback.c index 93a64e8a..91a40e26 100644 --- a/lib/handle_suback.c +++ b/lib/handle_suback.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/handle_unsuback.c b/lib/handle_unsuback.c index fdd255c1..fd32d486 100644 --- a/lib/handle_unsuback.c +++ b/lib/handle_unsuback.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/helpers.c b/lib/helpers.c index 05149201..3f076925 100644 --- a/lib/helpers.c +++ b/lib/helpers.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/logging_mosq.c b/lib/logging_mosq.c index adddc28b..16e9e949 100644 --- a/lib/logging_mosq.c +++ b/lib/logging_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/logging_mosq.h b/lib/logging_mosq.h index 17b49a60..580edb8b 100644 --- a/lib/logging_mosq.h +++ b/lib/logging_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/loop.c b/lib/loop.c index 00b99ee3..bc2ba7f4 100644 --- a/lib/loop.c +++ b/lib/loop.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/memory_mosq.c b/lib/memory_mosq.c index 73f9901a..4367197e 100644 --- a/lib/memory_mosq.c +++ b/lib/memory_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/memory_mosq.h b/lib/memory_mosq.h index 85d77492..da149913 100644 --- a/lib/memory_mosq.h +++ b/lib/memory_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/messages_mosq.c b/lib/messages_mosq.c index e0dfb3f9..ff28a915 100644 --- a/lib/messages_mosq.c +++ b/lib/messages_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/messages_mosq.h b/lib/messages_mosq.h index 6a66a50c..5689b49e 100644 --- a/lib/messages_mosq.h +++ b/lib/messages_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/misc_mosq.c b/lib/misc_mosq.c index 75b2eaac..e7bf0784 100644 --- a/lib/misc_mosq.c +++ b/lib/misc_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/misc_mosq.h b/lib/misc_mosq.h index 6456c02b..233071e6 100644 --- a/lib/misc_mosq.h +++ b/lib/misc_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/mosquitto.c b/lib/mosquitto.c index 52fd30da..0dd4ac01 100644 --- a/lib/mosquitto.c +++ b/lib/mosquitto.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/mosquitto_internal.h b/lib/mosquitto_internal.h index 2d30f7e8..04bdf92a 100644 --- a/lib/mosquitto_internal.h +++ b/lib/mosquitto_internal.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/net_mosq.c b/lib/net_mosq.c index f1da60f8..cb5bf2ab 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/net_mosq.h b/lib/net_mosq.h index 6dc2a1a4..30342179 100644 --- a/lib/net_mosq.h +++ b/lib/net_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/net_mosq_ocsp.c b/lib/net_mosq_ocsp.c index 0f6c3002..84b818c8 100644 --- a/lib/net_mosq_ocsp.c +++ b/lib/net_mosq_ocsp.c @@ -11,7 +11,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Dr. Lars Voelker, BMW AG diff --git a/lib/options.c b/lib/options.c index 8fe1007d..c7f739aa 100644 --- a/lib/options.c +++ b/lib/options.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/packet_datatypes.c b/lib/packet_datatypes.c index 7a195d19..e13d9489 100644 --- a/lib/packet_datatypes.c +++ b/lib/packet_datatypes.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/packet_mosq.c b/lib/packet_mosq.c index e576c67c..ad2a3aae 100644 --- a/lib/packet_mosq.c +++ b/lib/packet_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/packet_mosq.h b/lib/packet_mosq.h index cbdbb68e..38921794 100644 --- a/lib/packet_mosq.h +++ b/lib/packet_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/property_mosq.c b/lib/property_mosq.c index ef8ffc80..8a77dbe6 100644 --- a/lib/property_mosq.c +++ b/lib/property_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/property_mosq.h b/lib/property_mosq.h index c0110909..c913c051 100644 --- a/lib/property_mosq.h +++ b/lib/property_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/read_handle.c b/lib/read_handle.c index 72ff7555..dd6a06bd 100644 --- a/lib/read_handle.c +++ b/lib/read_handle.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/read_handle.h b/lib/read_handle.h index b687fea3..3f97f90d 100644 --- a/lib/read_handle.h +++ b/lib/read_handle.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/send_connect.c b/lib/send_connect.c index 29b29c69..d35cd80e 100644 --- a/lib/send_connect.c +++ b/lib/send_connect.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/send_disconnect.c b/lib/send_disconnect.c index 2d2d7932..db2efe08 100644 --- a/lib/send_disconnect.c +++ b/lib/send_disconnect.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/send_mosq.c b/lib/send_mosq.c index da348c89..059e7604 100644 --- a/lib/send_mosq.c +++ b/lib/send_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/send_mosq.h b/lib/send_mosq.h index 90274c67..7ab48f11 100644 --- a/lib/send_mosq.h +++ b/lib/send_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/send_publish.c b/lib/send_publish.c index e2cec9cf..759accab 100644 --- a/lib/send_publish.c +++ b/lib/send_publish.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/send_subscribe.c b/lib/send_subscribe.c index c030ee10..a8e77545 100644 --- a/lib/send_subscribe.c +++ b/lib/send_subscribe.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/send_unsubscribe.c b/lib/send_unsubscribe.c index 27e612cf..654f0ebe 100644 --- a/lib/send_unsubscribe.c +++ b/lib/send_unsubscribe.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/socks_mosq.c b/lib/socks_mosq.c index 68ef72a6..a360d64b 100644 --- a/lib/socks_mosq.c +++ b/lib/socks_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/socks_mosq.h b/lib/socks_mosq.h index 6a1f3368..d08c3c52 100644 --- a/lib/socks_mosq.h +++ b/lib/socks_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/srv_mosq.c b/lib/srv_mosq.c index 049b6cff..412fc1eb 100644 --- a/lib/srv_mosq.c +++ b/lib/srv_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/strings_mosq.c b/lib/strings_mosq.c index b3a75bd1..3688650d 100644 --- a/lib/strings_mosq.c +++ b/lib/strings_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/thread_mosq.c b/lib/thread_mosq.c index a8e5747a..dbbda85e 100644 --- a/lib/thread_mosq.c +++ b/lib/thread_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/time_mosq.c b/lib/time_mosq.c index de8679b2..e8eb0755 100644 --- a/lib/time_mosq.c +++ b/lib/time_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/time_mosq.h b/lib/time_mosq.h index 8300289b..175d9732 100644 --- a/lib/time_mosq.h +++ b/lib/time_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/tls_mosq.c b/lib/tls_mosq.c index 96f444d5..bddf2ec0 100644 --- a/lib/tls_mosq.c +++ b/lib/tls_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/tls_mosq.h b/lib/tls_mosq.h index 61020d4a..479741d2 100644 --- a/lib/tls_mosq.h +++ b/lib/tls_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/utf8_mosq.c b/lib/utf8_mosq.c index e0c841d5..4a79cbd8 100644 --- a/lib/utf8_mosq.c +++ b/lib/utf8_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation. diff --git a/lib/util_mosq.c b/lib/util_mosq.c index 05b29ff7..fda69801 100644 --- a/lib/util_mosq.c +++ b/lib/util_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/util_mosq.h b/lib/util_mosq.h index abb197d1..6fa60cfc 100644 --- a/lib/util_mosq.h +++ b/lib/util_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/util_topic.c b/lib/util_topic.c index 03917b10..fc24f0d1 100644 --- a/lib/util_topic.c +++ b/lib/util_topic.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/will_mosq.c b/lib/will_mosq.c index 6b5e0021..4a48b8fe 100644 --- a/lib/will_mosq.c +++ b/lib/will_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/lib/will_mosq.h b/lib/will_mosq.h index d7c8a199..9bfdc572 100644 --- a/lib/will_mosq.h +++ b/lib/will_mosq.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/acl.c b/plugins/dynamic-security/acl.c index 7aaf3f8c..8a57f7a9 100644 --- a/plugins/dynamic-security/acl.c +++ b/plugins/dynamic-security/acl.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/auth.c b/plugins/dynamic-security/auth.c index 9ca9b132..1f62e1fb 100644 --- a/plugins/dynamic-security/auth.c +++ b/plugins/dynamic-security/auth.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/clientlist.c b/plugins/dynamic-security/clientlist.c index d362a9b8..779c774c 100644 --- a/plugins/dynamic-security/clientlist.c +++ b/plugins/dynamic-security/clientlist.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/clients.c b/plugins/dynamic-security/clients.c index de9092dd..50eba278 100644 --- a/plugins/dynamic-security/clients.c +++ b/plugins/dynamic-security/clients.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/dynamic_security.h b/plugins/dynamic-security/dynamic_security.h index 57c814b8..561af50a 100644 --- a/plugins/dynamic-security/dynamic_security.h +++ b/plugins/dynamic-security/dynamic_security.h @@ -12,7 +12,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/grouplist.c b/plugins/dynamic-security/grouplist.c index afdc0186..2d4cf13b 100644 --- a/plugins/dynamic-security/grouplist.c +++ b/plugins/dynamic-security/grouplist.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/groups.c b/plugins/dynamic-security/groups.c index d66e4dba..c4bdda14 100644 --- a/plugins/dynamic-security/groups.c +++ b/plugins/dynamic-security/groups.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/json_help.c b/plugins/dynamic-security/json_help.c index dd8379c9..e0c8178b 100644 --- a/plugins/dynamic-security/json_help.c +++ b/plugins/dynamic-security/json_help.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/json_help.h b/plugins/dynamic-security/json_help.h index b1b6aed0..1bb6623a 100644 --- a/plugins/dynamic-security/json_help.h +++ b/plugins/dynamic-security/json_help.h @@ -12,7 +12,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/plugin.c b/plugins/dynamic-security/plugin.c index 1ee89890..d5a8cf06 100644 --- a/plugins/dynamic-security/plugin.c +++ b/plugins/dynamic-security/plugin.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/rolelist.c b/plugins/dynamic-security/rolelist.c index 6df19d21..a8c93a96 100644 --- a/plugins/dynamic-security/rolelist.c +++ b/plugins/dynamic-security/rolelist.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/roles.c b/plugins/dynamic-security/roles.c index 5ffc911b..fb116770 100644 --- a/plugins/dynamic-security/roles.c +++ b/plugins/dynamic-security/roles.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/dynamic-security/sub_matches_sub.c b/plugins/dynamic-security/sub_matches_sub.c index 79701879..fb913902 100644 --- a/plugins/dynamic-security/sub_matches_sub.c +++ b/plugins/dynamic-security/sub_matches_sub.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/message-timestamp/mosquitto_message_timestamp.c b/plugins/message-timestamp/mosquitto_message_timestamp.c index 86132f42..1e87e9d8 100644 --- a/plugins/message-timestamp/mosquitto_message_timestamp.c +++ b/plugins/message-timestamp/mosquitto_message_timestamp.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/plugins/payload-modification/mosquitto_payload_modification.c b/plugins/payload-modification/mosquitto_payload_modification.c index ac11e1c1..6af83ef5 100644 --- a/plugins/payload-modification/mosquitto_payload_modification.c +++ b/plugins/payload-modification/mosquitto_payload_modification.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/bridge.c b/src/bridge.c index 45816418..6eda9cf8 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/bridge_topic.c b/src/bridge_topic.c index fd4bd133..dc19fda1 100644 --- a/src/bridge_topic.c +++ b/src/bridge_topic.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/conf.c b/src/conf.c index ba65fc00..33326c0c 100644 --- a/src/conf.c +++ b/src/conf.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/conf_includedir.c b/src/conf_includedir.c index 4a082c23..5dda0a1e 100644 --- a/src/conf_includedir.c +++ b/src/conf_includedir.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/context.c b/src/context.c index 083a07d0..d0f4d218 100644 --- a/src/context.c +++ b/src/context.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/control.c b/src/control.c index b6fcf423..9cef197c 100644 --- a/src/control.c +++ b/src/control.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/database.c b/src/database.c index ebdf6ecd..db18b9f1 100644 --- a/src/database.c +++ b/src/database.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/handle_auth.c b/src/handle_auth.c index 36c3091a..299e0a64 100644 --- a/src/handle_auth.c +++ b/src/handle_auth.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/handle_connack.c b/src/handle_connack.c index 632212b9..6aacb592 100644 --- a/src/handle_connack.c +++ b/src/handle_connack.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/handle_connect.c b/src/handle_connect.c index fc6ebbd8..df030108 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/handle_disconnect.c b/src/handle_disconnect.c index 7c89f53a..2beb676a 100644 --- a/src/handle_disconnect.c +++ b/src/handle_disconnect.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/handle_publish.c b/src/handle_publish.c index 1e3d9b4f..68359b69 100644 --- a/src/handle_publish.c +++ b/src/handle_publish.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/handle_subscribe.c b/src/handle_subscribe.c index e6e90a7b..2a72c597 100644 --- a/src/handle_subscribe.c +++ b/src/handle_subscribe.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/handle_unsubscribe.c b/src/handle_unsubscribe.c index 8e336f09..2162b465 100644 --- a/src/handle_unsubscribe.c +++ b/src/handle_unsubscribe.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/keepalive.c b/src/keepalive.c index 38ff4ff1..89d5c50b 100644 --- a/src/keepalive.c +++ b/src/keepalive.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/lib_load.h b/src/lib_load.h index 886662a8..70948d70 100644 --- a/src/lib_load.h +++ b/src/lib_load.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/logging.c b/src/logging.c index acee3a8a..ff1a5b4d 100644 --- a/src/logging.c +++ b/src/logging.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/loop.c b/src/loop.c index ec8b80f8..5044e7c8 100644 --- a/src/loop.c +++ b/src/loop.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/memory_public.c b/src/memory_public.c index 198d0f14..e1f791e0 100644 --- a/src/memory_public.c +++ b/src/memory_public.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/mosquitto.c b/src/mosquitto.c index 53cd85f2..82a61d3c 100644 --- a/src/mosquitto.c +++ b/src/mosquitto.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/mosquitto_broker_internal.h b/src/mosquitto_broker_internal.h index 1f6df3cc..5b88710f 100644 --- a/src/mosquitto_broker_internal.h +++ b/src/mosquitto_broker_internal.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/mux.c b/src/mux.c index 74483201..02fdf1f2 100644 --- a/src/mux.c +++ b/src/mux.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/mux.h b/src/mux.h index 6b416c99..b004984a 100644 --- a/src/mux.h +++ b/src/mux.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/mux_epoll.c b/src/mux_epoll.c index 87d76692..d21a2713 100644 --- a/src/mux_epoll.c +++ b/src/mux_epoll.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/mux_poll.c b/src/mux_poll.c index 3e0977dc..8a999d2b 100644 --- a/src/mux_poll.c +++ b/src/mux_poll.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/net.c b/src/net.c index b18a401b..1a500338 100644 --- a/src/net.c +++ b/src/net.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/password_mosq.c b/src/password_mosq.c index 62e06925..b8836f45 100644 --- a/src/password_mosq.c +++ b/src/password_mosq.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/password_mosq.h b/src/password_mosq.h index 4c5b20f9..3a9362a3 100644 --- a/src/password_mosq.h +++ b/src/password_mosq.h @@ -12,7 +12,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/persist.h b/src/persist.h index 80358aad..21c0e679 100644 --- a/src/persist.h +++ b/src/persist.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/persist_read.c b/src/persist_read.c index 8d17024f..4fedfeaa 100644 --- a/src/persist_read.c +++ b/src/persist_read.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/persist_read_v234.c b/src/persist_read_v234.c index 933da7df..7f7a64f9 100644 --- a/src/persist_read_v234.c +++ b/src/persist_read_v234.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/persist_read_v5.c b/src/persist_read_v5.c index f5e0cc57..a6e66351 100644 --- a/src/persist_read_v5.c +++ b/src/persist_read_v5.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/persist_write.c b/src/persist_write.c index d07c30b5..3ac4f4a5 100644 --- a/src/persist_write.c +++ b/src/persist_write.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/persist_write_v5.c b/src/persist_write_v5.c index 75d99ade..3d1d8e81 100644 --- a/src/persist_write_v5.c +++ b/src/persist_write_v5.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/plugin.c b/src/plugin.c index 34fddf26..fae5fba2 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/plugin_debug.c b/src/plugin_debug.c index 16bdf3d5..2e88b961 100644 --- a/src/plugin_debug.c +++ b/src/plugin_debug.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/plugin_defer.c b/src/plugin_defer.c index 1c6c7728..05f664fa 100644 --- a/src/plugin_defer.c +++ b/src/plugin_defer.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/plugin_public.c b/src/plugin_public.c index 97bda323..b61184a5 100644 --- a/src/plugin_public.c +++ b/src/plugin_public.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/property_broker.c b/src/property_broker.c index 4dc8a82d..1a38c204 100644 --- a/src/property_broker.c +++ b/src/property_broker.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/read_handle.c b/src/read_handle.c index dbebc1ce..416c32ab 100644 --- a/src/read_handle.c +++ b/src/read_handle.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/retain.c b/src/retain.c index 40045401..ca9e7313 100644 --- a/src/retain.c +++ b/src/retain.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/security.c b/src/security.c index 9bf46059..839ec31e 100644 --- a/src/security.c +++ b/src/security.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/security_default.c b/src/security_default.c index 6bbe70af..b800c91f 100644 --- a/src/security_default.c +++ b/src/security_default.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/send_auth.c b/src/send_auth.c index 5a42de4f..dbd0b8e8 100644 --- a/src/send_auth.c +++ b/src/send_auth.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/send_connack.c b/src/send_connack.c index b4c8e29d..a4d36f70 100644 --- a/src/send_connack.c +++ b/src/send_connack.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/send_suback.c b/src/send_suback.c index 3f4726bd..fb0b1409 100644 --- a/src/send_suback.c +++ b/src/send_suback.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/send_unsuback.c b/src/send_unsuback.c index 8e6a3880..5f59a066 100644 --- a/src/send_unsuback.c +++ b/src/send_unsuback.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/service.c b/src/service.c index 86b74c8e..2a438abd 100644 --- a/src/service.c +++ b/src/service.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/session_expiry.c b/src/session_expiry.c index 03aed565..1d2beb57 100644 --- a/src/session_expiry.c +++ b/src/session_expiry.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/signals.c b/src/signals.c index 71b58677..9938996f 100644 --- a/src/signals.c +++ b/src/signals.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/subs.c b/src/subs.c index d96cacb4..58684924 100644 --- a/src/subs.c +++ b/src/subs.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/sys_tree.c b/src/sys_tree.c index 14eb71fb..5aee42db 100644 --- a/src/sys_tree.c +++ b/src/sys_tree.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/sys_tree.h b/src/sys_tree.h index 71adec50..72f1da87 100644 --- a/src/sys_tree.h +++ b/src/sys_tree.h @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/topic_tok.c b/src/topic_tok.c index 4e16c446..340e0b6f 100644 --- a/src/topic_tok.c +++ b/src/topic_tok.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/websockets.c b/src/websockets.c index 82a3300d..f86d91b4 100644 --- a/src/websockets.c +++ b/src/websockets.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/will_delay.c b/src/will_delay.c index 37af3997..aca3b931 100644 --- a/src/will_delay.c +++ b/src/will_delay.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. diff --git a/src/xtreport.c b/src/xtreport.c index a3f99511..08750052 100644 --- a/src/xtreport.c +++ b/src/xtreport.c @@ -10,7 +10,7 @@ The Eclipse Public License is available at and the Eclipse Distribution License is available at http://www.eclipse.org/org/documents/edl-v10.php. -SPDX-License-Identifier: EPL-2.0 OR EDL-1.0 +SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. From cda84950bb3ed5b45b816c3e2389c31cbd3a023e Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 21 Jan 2021 12:01:20 +0000 Subject: [PATCH 14/51] Fix mux_epoll__handle() use. --- src/mux.c | 4 +++- src/mux.h | 2 +- src/mux_epoll.c | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mux.c b/src/mux.c index 02fdf1f2..3703ad5f 100644 --- a/src/mux.c +++ b/src/mux.c @@ -71,7 +71,9 @@ int mux__delete(struct mosquitto *context) int mux__handle(struct mosquitto__listener_sock *listensock, int listensock_count) { #ifdef WITH_EPOLL - return mux_epoll__handle(listensock, listensock_count); + UNUSED(listensock); + UNUSED(listensock_count); + return mux_epoll__handle(); #else return mux_poll__handle(listensock, listensock_count); #endif diff --git a/src/mux.h b/src/mux.h index b004984a..47573b45 100644 --- a/src/mux.h +++ b/src/mux.h @@ -26,7 +26,7 @@ int mux_epoll__add_out(struct mosquitto *context); int mux_epoll__remove_out(struct mosquitto *context); int mux_epoll__add_in(struct mosquitto *context); int mux_epoll__delete(struct mosquitto *context); -int mux_epoll__handle(struct mosquitto__listener_sock *listensock, int listensock_count); +int mux_epoll__handle(void); int mux_epoll__cleanup(void); int mux_poll__init(struct mosquitto__listener_sock *listensock, int listensock_count); diff --git a/src/mux_epoll.c b/src/mux_epoll.c index d21a2713..6b1b2e89 100644 --- a/src/mux_epoll.c +++ b/src/mux_epoll.c @@ -54,6 +54,7 @@ Contributors: #include "mosquitto_broker_internal.h" #include "memory_mosq.h" +#include "mux.h" #include "packet_mosq.h" #include "send_mosq.h" #include "sys_tree.h" From 706a1f3f297157ddb8430e2756152fa8e4a15330 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 21 Jan 2021 13:33:54 +0000 Subject: [PATCH 15/51] Fix more minor compiler warnings. --- apps/db_dump/stubs.c | 39 +++++++++++++ apps/mosquitto_ctrl/dynsec.c | 1 + apps/mosquitto_ctrl/example.c | 5 ++ apps/mosquitto_passwd/mosquitto_passwd.c | 2 +- client/client_shared.c | 4 +- client/pub_shared.c | 2 +- client/sub_client_output.c | 7 ++- lib/actions.c | 2 +- lib/send_publish.c | 2 +- lib/will_mosq.c | 2 +- .../mosquitto_message_timestamp.c | 13 ++++- src/handle_connect.c | 2 +- src/mux_poll.c | 14 ++--- src/net.c | 8 +-- src/plugin_public.c | 2 + src/security_default.c | 2 +- test/unit/bridge_topic_test.c | 3 + test/unit/persist_read_stubs.c | 36 ++++++++++++ test/unit/persist_read_test.c | 3 + test/unit/persist_write_stubs.c | 45 +++++++++++++++ test/unit/persist_write_test.c | 3 + test/unit/property_write.c | 2 + test/unit/stubs.c | 11 ++++ test/unit/subs_stubs.c | 56 +++++++++++++++++++ test/unit/subs_test.c | 3 + test/unit/test.c | 3 + 26 files changed, 250 insertions(+), 22 deletions(-) diff --git a/apps/db_dump/stubs.c b/apps/db_dump/stubs.c index 5fb08a8c..af00f706 100644 --- a/apps/db_dump/stubs.c +++ b/apps/db_dump/stubs.c @@ -6,74 +6,113 @@ struct mosquitto *context__init(mosq_sock_t sock) { + UNUSED(sock); + return NULL; } int db__message_store(const struct mosquitto *source, struct mosquitto_msg_store *stored, uint32_t message_expiry_interval, dbid_t store_id, enum mosquitto_msg_origin origin) { + UNUSED(source); + UNUSED(stored); + UNUSED(message_expiry_interval); + UNUSED(store_id); + UNUSED(origin); return 0; } void db__msg_store_ref_inc(struct mosquitto_msg_store *store) { + UNUSED(store); } int handle__packet(struct mosquitto *context) { + UNUSED(context); return 0; } int log__printf(struct mosquitto *mosq, unsigned int level, const char *fmt, ...) { + UNUSED(mosq); + UNUSED(level); + UNUSED(fmt); return 0; } FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read) { + UNUSED(path); + UNUSED(mode); + UNUSED(restrict_read); return NULL; } enum mosquitto_client_state mosquitto__get_state(struct mosquitto *mosq) { + UNUSED(mosq); return mosq_cs_new; } int mux__add_out(struct mosquitto *mosq) { + UNUSED(mosq); return 0; } int mux__remove_out(struct mosquitto *mosq) { + UNUSED(mosq); return 0; } ssize_t net__read(struct mosquitto *mosq, void *buf, size_t count) { + UNUSED(mosq); + UNUSED(buf); + UNUSED(count); return 0; } ssize_t net__write(struct mosquitto *mosq, const void *buf, size_t count) { + UNUSED(mosq); + UNUSED(buf); + UNUSED(count); return 0; } int retain__store(const char *topic, struct mosquitto_msg_store *stored, char **split_topics) { + UNUSED(topic); + UNUSED(stored); + UNUSED(split_topics); return 0; } int sub__add(struct mosquitto *context, const char *sub, uint8_t qos, uint32_t identifier, int options, struct mosquitto__subhier **root) { + UNUSED(context); + UNUSED(sub); + UNUSED(qos); + UNUSED(identifier); + UNUSED(options); + UNUSED(root); return 0; } int sub__messages_queue(const char *source_id, const char *topic, uint8_t qos, int retain, struct mosquitto_msg_store **stored) { + UNUSED(source_id); + UNUSED(topic); + UNUSED(qos); + UNUSED(retain); + UNUSED(stored); return 0; } int keepalive__update(struct mosquitto *context) { + UNUSED(context); return 0; } diff --git a/apps/mosquitto_ctrl/dynsec.c b/apps/mosquitto_ctrl/dynsec.c index 3a0f9761..fae86f43 100644 --- a/apps/mosquitto_ctrl/dynsec.c +++ b/apps/mosquitto_ctrl/dynsec.c @@ -386,6 +386,7 @@ static void dynsec__payload_callback(struct mosq_ctrl *ctrl, long payloadlen, co UNUSED(ctrl); #if CJSON_VERSION_FULL < 1007013 + UNUSED(payloadlen); tree = cJSON_Parse(payload); #else tree = cJSON_ParseWithLength(payload, payloadlen); diff --git a/apps/mosquitto_ctrl/example.c b/apps/mosquitto_ctrl/example.c index 4df53bc8..01b8d580 100644 --- a/apps/mosquitto_ctrl/example.c +++ b/apps/mosquitto_ctrl/example.c @@ -15,6 +15,8 @@ SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause Contributors: Roger Light - initial implementation and documentation. */ +#include "config.h" + #include #include #include @@ -31,6 +33,9 @@ void ctrl_help(void) int ctrl_main(int argc, char *argv[], struct mosq_ctrl *ctrl) { + UNUSED(argc); + UNUSED(ctrl); + if(!strcasecmp(argv[0], "help")){ ctrl_help(); return -1; diff --git a/apps/mosquitto_passwd/mosquitto_passwd.c b/apps/mosquitto_passwd/mosquitto_passwd.c index 0b8cec9d..628bcc71 100644 --- a/apps/mosquitto_passwd/mosquitto_passwd.c +++ b/apps/mosquitto_passwd/mosquitto_passwd.c @@ -392,7 +392,7 @@ void handle_sigint(int signal) static bool is_username_valid(const char *username) { - int i; + size_t i; size_t slen; if(username){ diff --git a/client/client_shared.c b/client/client_shared.c index a4a9531c..2a9e3720 100644 --- a/client/client_shared.c +++ b/client/client_shared.c @@ -46,7 +46,7 @@ static int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int static int check_format(const char *str) { - int i; + size_t i; size_t len; len = strlen(str); @@ -1395,7 +1395,7 @@ int client_connect(struct mosquitto *mosq, struct mosq_config *cfg) /* Convert %25 -> %, %3a, %3A -> :, %40 -> @ */ static int mosquitto__urldecode(char *str) { - int i, j; + size_t i, j; size_t len; if(!str) return 0; diff --git a/client/pub_shared.c b/client/pub_shared.c index a7f6092e..0b9323c9 100644 --- a/client/pub_shared.c +++ b/client/pub_shared.c @@ -125,7 +125,7 @@ int load_file(const char *filename) return 1; } pos = 0; - while(pos < cfg.msglen){ + while(pos < (size_t)cfg.msglen){ rlen = fread(&(cfg.message[pos]), sizeof(char), (size_t )cfg.msglen-pos, fptr); pos += rlen; } diff --git a/client/sub_client_output.c b/client/sub_client_output.c index c0270e8b..adb432ce 100644 --- a/client/sub_client_output.c +++ b/client/sub_client_output.c @@ -96,6 +96,8 @@ static void write_payload(const unsigned char *payload, int payloadlen, int hex, int i; int padlen; + UNUSED(precision); /* FIXME - use or remove */ + if(field_width > 0){ if(payloadlen > field_width){ payloadlen = field_width; @@ -357,6 +359,9 @@ static int json_print(const struct mosquitto_message *message, const mosquitto_p return MOSQ_ERR_SUCCESS; #else + UNUSED(properties); + UNUSED(pretty); + strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S.000000Z%z", ti); snprintf(&buf[strlen("2020-05-06T21:48:00.")], 9, "%06d", ns/1000); buf[strlen("2020-05-06T21:48:00.000000")] = 'Z'; @@ -625,7 +630,7 @@ static void formatted_print_percent(const struct mosq_config *lcfg, const struct static void formatted_print(const struct mosq_config *lcfg, const struct mosquitto_message *message, const mosquitto_property *properties) { size_t len; - int i; + size_t i; struct tm *ti = NULL; long ns = 0; char strf[3] = {0, 0 ,0}; diff --git a/lib/actions.c b/lib/actions.c index 9ea4aee8..f260eaba 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -92,7 +92,7 @@ int mosquitto_publish_v5(struct mosquitto *mosq, int *mid, const char *topic, in }else{ tlen = strlen(topic); if(mosquitto_validate_utf8(topic, (int)tlen)) return MOSQ_ERR_MALFORMED_UTF8; - if(payloadlen < 0 || payloadlen > MQTT_MAX_PAYLOAD) return MOSQ_ERR_PAYLOAD_SIZE; + if(payloadlen < 0 || payloadlen > (int)MQTT_MAX_PAYLOAD) return MOSQ_ERR_PAYLOAD_SIZE; if(mosquitto_pub_topic_check(topic) != MOSQ_ERR_SUCCESS){ return MOSQ_ERR_INVAL; } diff --git a/lib/send_publish.c b/lib/send_publish.c index 759accab..1d1842a0 100644 --- a/lib/send_publish.c +++ b/lib/send_publish.c @@ -42,8 +42,8 @@ Contributors: int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, uint8_t qos, bool retain, bool dup, const mosquitto_property *cmsg_props, const mosquitto_property *store_props, uint32_t expiry_interval) { #ifdef WITH_BROKER - size_t len; #ifdef WITH_BRIDGE + size_t len; int i; struct mosquitto__bridge_topic *cur_topic; bool match; diff --git a/lib/will_mosq.c b/lib/will_mosq.c index 4a48b8fe..1699d4ae 100644 --- a/lib/will_mosq.c +++ b/lib/will_mosq.c @@ -43,7 +43,7 @@ int will__set(struct mosquitto *mosq, const char *topic, int payloadlen, const v mosquitto_property *p; if(!mosq || !topic) return MOSQ_ERR_INVAL; - if(payloadlen < 0 || payloadlen > MQTT_MAX_PAYLOAD) return MOSQ_ERR_PAYLOAD_SIZE; + if(payloadlen < 0 || payloadlen > (int)MQTT_MAX_PAYLOAD) return MOSQ_ERR_PAYLOAD_SIZE; if(payloadlen > 0 && !payload) return MOSQ_ERR_INVAL; if(mosquitto_pub_topic_check(topic)) return MOSQ_ERR_INVAL; diff --git a/plugins/message-timestamp/mosquitto_message_timestamp.c b/plugins/message-timestamp/mosquitto_message_timestamp.c index 1e87e9d8..ae35ff87 100644 --- a/plugins/message-timestamp/mosquitto_message_timestamp.c +++ b/plugins/message-timestamp/mosquitto_message_timestamp.c @@ -28,7 +28,7 @@ Contributors: * * Note that this only works on Mosquitto 2.0 or later. */ - +#include "config.h" #include #include @@ -47,6 +47,9 @@ static int callback_message(int event, void *event_data, void *userdata) struct tm *ti; char time_buf[25]; + UNUSED(event); + UNUSED(userdata); + clock_gettime(CLOCK_REALTIME, &ts); ti = gmtime(&ts.tv_sec); strftime(time_buf, sizeof(time_buf), "%Y-%m-%dT%H:%M:%SZ", ti); @@ -68,11 +71,19 @@ int mosquitto_plugin_version(int supported_version_count, const int *supported_v int mosquitto_plugin_init(mosquitto_plugin_id_t *identifier, void **user_data, struct mosquitto_opt *opts, int opt_count) { + UNUSED(user_data); + UNUSED(opts); + UNUSED(opt_count); + mosq_pid = identifier; return mosquitto_callback_register(mosq_pid, MOSQ_EVT_MESSAGE, callback_message, NULL, NULL); } int mosquitto_plugin_cleanup(void *user_data, struct mosquitto_opt *opts, int opt_count) { + UNUSED(user_data); + UNUSED(opts); + UNUSED(opt_count); + return mosquitto_callback_unregister(mosq_pid, MOSQ_EVT_MESSAGE, callback_message, NULL); } diff --git a/src/handle_connect.c b/src/handle_connect.c index df030108..bc5c4604 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -344,7 +344,7 @@ static int will__read(struct mosquitto *context, const char *client_id, struct m will_struct->msg.payloadlen = payloadlen; if(will_struct->msg.payloadlen > 0){ - if(db.config->message_size_limit && will_struct->msg.payloadlen > db.config->message_size_limit){ + if(db.config->message_size_limit && will_struct->msg.payloadlen > (int)db.config->message_size_limit){ log__printf(NULL, MOSQ_LOG_DEBUG, "Client %s connected with too large Will payload", client_id); if(context->protocol == mosq_p_mqtt5){ send__connack(context, 0, MQTT_RC_PACKET_TOO_LARGE, NULL); diff --git a/src/mux_poll.c b/src/mux_poll.c index 8a999d2b..ca61cd5c 100644 --- a/src/mux_poll.c +++ b/src/mux_poll.c @@ -94,7 +94,7 @@ int mux_poll__init(struct mosquitto__listener_sock *listensock, int listensock_c pollfds[i].fd = INVALID_SOCKET; } - for(i=0; ievents & POLLOUT)) { if(context->pollfd_index != -1){ @@ -121,9 +121,9 @@ int mux_poll__add_out(struct mosquitto *context) pollfds[i].fd = context->sock; pollfds[i].events = POLLIN | POLLOUT; pollfds[i].revents = 0; - context->pollfd_index = i; + context->pollfd_index = (int )i; if(i > pollfd_current_max){ - pollfd_current_max = (size_t )i; + pollfd_current_max = i; } break; } @@ -148,7 +148,7 @@ int mux_poll__remove_out(struct mosquitto *context) int mux_poll__add_in(struct mosquitto *context) { - int i; + size_t i; if(context->pollfd_index != -1){ pollfds[context->pollfd_index].fd = context->sock; @@ -160,9 +160,9 @@ int mux_poll__add_in(struct mosquitto *context) pollfds[i].fd = context->sock; pollfds[i].events = POLLIN; pollfds[i].revents = 0; - context->pollfd_index = i; + context->pollfd_index = (int )i; if(i > pollfd_current_max){ - pollfd_current_max = (size_t )i; + pollfd_current_max = i; } break; } diff --git a/src/net.c b/src/net.c index 1a500338..da5cbc14 100644 --- a/src/net.c +++ b/src/net.c @@ -608,13 +608,13 @@ int net__tls_load_verify(struct mosquitto__listener *listener) #ifndef WIN32 -static int net__bind_interface(struct mosquitto__listener *listener, mosq_sock_t sock, struct addrinfo *rp) +static int net__bind_interface(struct mosquitto__listener *listener, struct addrinfo *rp) { /* * This binds the listener sock to a network interface. * The use of SO_BINDTODEVICE requires root access, which we don't have, so instead - * use getifaddrs to find the interface addresses, and attempt to bind to - * the IP of the matching interface. + * use getifaddrs to find the interface addresses, and use IP of the + * matching interface in the later bind(). */ struct ifaddrs *ifaddr, *ifa; if(getifaddrs(&ifaddr) < 0){ @@ -725,7 +725,7 @@ static int net__socket_listen_tcp(struct mosquitto__listener *listener) #ifndef WIN32 if(listener->bind_interface){ - if(net__bind_interface(listener, sock, rp)){ + if(net__bind_interface(listener, rp)){ COMPAT_CLOSE(sock); freeaddrinfo(ainfo); mosquitto__free(listener->socks); diff --git a/src/plugin_public.c b/src/plugin_public.c index b61184a5..5df56fec 100644 --- a/src/plugin_public.c +++ b/src/plugin_public.c @@ -91,6 +91,8 @@ int mosquitto_client_protocol(const struct mosquitto *client) if(client && client->wsi){ return mp_websockets; }else +#else + UNUSED(client); #endif { return mp_mqtt; diff --git a/src/security_default.c b/src/security_default.c index b800c91f..6c13cdbd 100644 --- a/src/security_default.c +++ b/src/security_default.c @@ -367,7 +367,7 @@ static int mosquitto_acl_check_default(int event, void *event_data, void *userda char *local_acl; struct mosquitto__acl *acl_root; bool result; - int i; + size_t i; size_t len, tlen, clen, ulen; char *s; struct mosquitto__security_options *security_opts = NULL; diff --git a/test/unit/bridge_topic_test.c b/test/unit/bridge_topic_test.c index 14992af8..03907ba4 100644 --- a/test/unit/bridge_topic_test.c +++ b/test/unit/bridge_topic_test.c @@ -101,6 +101,9 @@ int main(int argc, char *argv[]) { unsigned int fails; + UNUSED(argc); + UNUSED(argv); + if(CU_initialize_registry() != CUE_SUCCESS){ printf("Error initializing CUnit registry.\n"); return 1; diff --git a/test/unit/persist_read_stubs.c b/test/unit/persist_read_stubs.c index afe75986..62b03567 100644 --- a/test/unit/persist_read_stubs.c +++ b/test/unit/persist_read_stubs.c @@ -18,6 +18,8 @@ struct mosquitto *context__init(mosq_sock_t sock) { struct mosquitto *m; + UNUSED(sock); + m = mosquitto__calloc(1, sizeof(struct mosquitto)); if(m){ m->msgs_in.inflight_maximum = 20; @@ -50,6 +52,8 @@ int db__message_store(const struct mosquitto *source, struct mosquitto_msg_store { int rc = MOSQ_ERR_SUCCESS; + UNUSED(origin); + if(source && source->id){ stored->source_id = mosquitto__strdup(source->id); }else{ @@ -98,6 +102,10 @@ error: int log__printf(struct mosquitto *mosq, unsigned int priority, const char *fmt, ...) { + UNUSED(mosq); + UNUSED(priority); + UNUSED(fmt); + return 0; } @@ -108,27 +116,45 @@ time_t mosquitto_time(void) int net__socket_close(struct mosquitto *mosq) { + UNUSED(mosq); + return MOSQ_ERR_SUCCESS; } int send__pingreq(struct mosquitto *mosq) { + UNUSED(mosq); + return MOSQ_ERR_SUCCESS; } int mosquitto_acl_check(struct mosquitto *context, const char *topic, uint32_t payloadlen, void* payload, uint8_t qos, bool retain, int access) { + UNUSED(context); + UNUSED(topic); + UNUSED(payloadlen); + UNUSED(payload); + UNUSED(qos); + UNUSED(retain); + UNUSED(access); + return MOSQ_ERR_SUCCESS; } int acl__find_acls(struct mosquitto *context) { + UNUSED(context); + return MOSQ_ERR_SUCCESS; } int sub__add(struct mosquitto *context, const char *sub, uint8_t qos, uint32_t identifier, int options, struct mosquitto__subhier **root) { + UNUSED(context); + UNUSED(options); + UNUSED(root); + last_sub = strdup(sub); last_qos = qos; last_identifier = identifier; @@ -138,11 +164,21 @@ int sub__add(struct mosquitto *context, const char *sub, uint8_t qos, uint32_t i int db__message_insert(struct mosquitto *context, uint16_t mid, enum mosquitto_msg_direction dir, uint8_t qos, bool retain, struct mosquitto_msg_store *stored, mosquitto_property *properties, bool update) { + UNUSED(context); + UNUSED(mid); + UNUSED(dir); + UNUSED(qos); + UNUSED(retain); + UNUSED(stored); + UNUSED(properties); + UNUSED(update); + return MOSQ_ERR_SUCCESS; } void db__msg_store_ref_dec(struct mosquitto_msg_store **store) { + UNUSED(store); } void db__msg_store_ref_inc(struct mosquitto_msg_store *store) diff --git a/test/unit/persist_read_test.c b/test/unit/persist_read_test.c index 0055ba94..2bac2d44 100644 --- a/test/unit/persist_read_test.c +++ b/test/unit/persist_read_test.c @@ -832,6 +832,9 @@ int main(int argc, char *argv[]) { unsigned int fails; + UNUSED(argc); + UNUSED(argv); + if(CU_initialize_registry() != CUE_SUCCESS){ printf("Error initializing CUnit registry.\n"); return 1; diff --git a/test/unit/persist_write_stubs.c b/test/unit/persist_write_stubs.c index 59eb9d6c..173cd4ea 100644 --- a/test/unit/persist_write_stubs.c +++ b/test/unit/persist_write_stubs.c @@ -15,11 +15,17 @@ extern int last_qos; struct mosquitto *context__init(mosq_sock_t sock) { + UNUSED(sock); + return mosquitto__calloc(1, sizeof(struct mosquitto)); } int log__printf(struct mosquitto *mosq, unsigned int priority, const char *fmt, ...) { + UNUSED(mosq); + UNUSED(priority); + UNUSED(fmt); + return 0; } @@ -30,41 +36,80 @@ time_t mosquitto_time(void) int net__socket_close(struct mosquitto *mosq) { + UNUSED(mosq); + return MOSQ_ERR_SUCCESS; } int send__pingreq(struct mosquitto *mosq) { + UNUSED(mosq); + return MOSQ_ERR_SUCCESS; } int mosquitto_acl_check(struct mosquitto *context, const char *topic, uint32_t payloadlen, void* payload, uint8_t qos, bool retain, int access) { + UNUSED(context); + UNUSED(topic); + UNUSED(payloadlen); + UNUSED(payload); + UNUSED(qos); + UNUSED(retain); + UNUSED(access); + return MOSQ_ERR_SUCCESS; } int acl__find_acls(struct mosquitto *context) { + UNUSED(context); + return MOSQ_ERR_SUCCESS; } int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, uint8_t qos, bool retain, bool dup, const mosquitto_property *cmsg_props, const mosquitto_property *store_props, uint32_t expiry_interval) { + UNUSED(mosq); + UNUSED(mid); + UNUSED(topic); + UNUSED(payloadlen); + UNUSED(payload); + UNUSED(qos); + UNUSED(retain); + UNUSED(dup); + UNUSED(cmsg_props); + UNUSED(store_props); + UNUSED(expiry_interval); + return MOSQ_ERR_SUCCESS; } int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties) { + UNUSED(mosq); + UNUSED(mid); + UNUSED(properties); + return MOSQ_ERR_SUCCESS; } int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties) { + UNUSED(mosq); + UNUSED(mid); + UNUSED(reason_code); + UNUSED(properties); + return MOSQ_ERR_SUCCESS; } int send__pubrel(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties) { + UNUSED(mosq); + UNUSED(mid); + UNUSED(properties); + return MOSQ_ERR_SUCCESS; } diff --git a/test/unit/persist_write_test.c b/test/unit/persist_write_test.c index 099027b7..abdc455f 100644 --- a/test/unit/persist_write_test.c +++ b/test/unit/persist_write_test.c @@ -349,6 +349,9 @@ int main(int argc, char *argv[]) CU_pSuite test_suite = NULL; unsigned int fails; + UNUSED(argc); + UNUSED(argv); + if(CU_initialize_registry() != CUE_SUCCESS){ printf("Error initializing CUnit registry.\n"); return 1; diff --git a/test/unit/property_write.c b/test/unit/property_write.c index bbda06d4..ad037316 100644 --- a/test/unit/property_write.c +++ b/test/unit/property_write.c @@ -317,6 +317,8 @@ static void varint_prop_write_helper( memset(&packet, 0, sizeof(struct mosquitto__packet)); packet.remaining_length = property__get_length_all(&property)+1; + CU_ASSERT_EQUAL(packet.remaining_length, remaining_length); + packet.packet_length = packet.remaining_length+10; packet.payload = calloc(packet.remaining_length+10, 1); diff --git a/test/unit/stubs.c b/test/unit/stubs.c index 897cd77b..23fa36fd 100644 --- a/test/unit/stubs.c +++ b/test/unit/stubs.c @@ -1,3 +1,5 @@ +#include "config.h" + #include #include @@ -7,6 +9,10 @@ struct mosquitto_db{ int log__printf(struct mosquitto *mosq, unsigned int priority, const char *fmt, ...) { + UNUSED(mosq); + UNUSED(priority); + UNUSED(fmt); + return 0; } @@ -17,11 +23,16 @@ time_t mosquitto_time(void) int net__socket_close(struct mosquitto_db *db, struct mosquitto *mosq) { + UNUSED(db); + UNUSED(mosq); + return MOSQ_ERR_SUCCESS; } int send__pingreq(struct mosquitto *mosq) { + UNUSED(mosq); + return MOSQ_ERR_SUCCESS; } diff --git a/test/unit/subs_stubs.c b/test/unit/subs_stubs.c index b7563745..0815e4a9 100644 --- a/test/unit/subs_stubs.c +++ b/test/unit/subs_stubs.c @@ -37,6 +37,10 @@ void db__msg_store_ref_inc(struct mosquitto_msg_store *store) int log__printf(struct mosquitto *mosq, unsigned int priority, const char *fmt, ...) { + UNUSED(mosq); + UNUSED(priority); + UNUSED(fmt); + return 0; } @@ -70,26 +74,59 @@ int acl__find_acls(struct mosquitto *context) int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, uint8_t qos, bool retain, bool dup, const mosquitto_property *cmsg_props, const mosquitto_property *store_props, uint32_t expiry_interval) { + UNUSED(mosq); + UNUSED(mid); + UNUSED(topic); + UNUSED(payloadlen); + UNUSED(payload); + UNUSED(qos); + UNUSED(retain); + UNUSED(dup); + UNUSED(cmsg_props); + UNUSED(store_props); + UNUSED(expiry_interval); + return MOSQ_ERR_SUCCESS; } int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties) { + UNUSED(mosq); + UNUSED(mid); + UNUSED(properties); + return MOSQ_ERR_SUCCESS; } int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties) { + UNUSED(mosq); + UNUSED(mid); + UNUSED(reason_code); + UNUSED(properties); + return MOSQ_ERR_SUCCESS; } int send__pubrel(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties) { + UNUSED(mosq); + UNUSED(mid); + UNUSED(properties); + return MOSQ_ERR_SUCCESS; } int mosquitto_acl_check(struct mosquitto *context, const char *topic, uint32_t payloadlen, void* payload, uint8_t qos, bool retain, int access) { + UNUSED(context); + UNUSED(topic); + UNUSED(payloadlen); + UNUSED(payload); + UNUSED(qos); + UNUSED(retain); + UNUSED(access); + return MOSQ_ERR_SUCCESS; } @@ -97,16 +134,24 @@ uint16_t mosquitto__mid_generate(struct mosquitto *mosq) { static uint16_t mid = 1; + UNUSED(mosq); + return ++mid; } int mosquitto_property_add_varint(mosquitto_property **proplist, int identifier, uint32_t value) { + UNUSED(proplist); + UNUSED(identifier); + UNUSED(value); + return MOSQ_ERR_SUCCESS; } int persist__backup(bool shutdown) { + UNUSED(shutdown); + return MOSQ_ERR_SUCCESS; } @@ -117,6 +162,7 @@ int persist__restore(void) void mosquitto_property_free_all(mosquitto_property **properties) { + UNUSED(properties); } int retain__init(void) @@ -126,15 +172,25 @@ int retain__init(void) void retain__clean(struct mosquitto__retainhier **retainhier) { + UNUSED(retainhier); } int retain__queue(struct mosquitto *context, const char *sub, uint8_t sub_qos, uint32_t subscription_identifier) { + UNUSED(context); + UNUSED(sub); + UNUSED(sub_qos); + UNUSED(subscription_identifier); + return MOSQ_ERR_SUCCESS; } int retain__store(const char *topic, struct mosquitto_msg_store *stored, char **split_topics) { + UNUSED(topic); + UNUSED(stored); + UNUSED(split_topics); + return MOSQ_ERR_SUCCESS; } diff --git a/test/unit/subs_test.c b/test/unit/subs_test.c index 527f4991..a596e8bc 100644 --- a/test/unit/subs_test.c +++ b/test/unit/subs_test.c @@ -88,6 +88,9 @@ int main(int argc, char *argv[]) CU_pSuite test_suite = NULL; unsigned int fails; + UNUSED(argc); + UNUSED(argv); + if(CU_initialize_registry() != CUE_SUCCESS){ printf("Error initializing CUnit registry.\n"); return 1; diff --git a/test/unit/test.c b/test/unit/test.c index 97258c49..c59a7461 100644 --- a/test/unit/test.c +++ b/test/unit/test.c @@ -18,6 +18,9 @@ int main(int argc, char *argv[]) { unsigned int fails; + UNUSED(argc); + UNUSED(argv); + if(CU_initialize_registry() != CUE_SUCCESS){ printf("Error initializing CUnit registry.\n"); return 1; From ad9a78dfc39543ce3641fb3245bfb92aff5e05c9 Mon Sep 17 00:00:00 2001 From: Roger Light Date: Mon, 25 Jan 2021 23:09:03 +0000 Subject: [PATCH 16/51] Note in the man pages that SIGHUP reloads TLS certificates. Closes #2037. Thanks to Greg Troxel. --- ChangeLog.txt | 1 + man/mosquitto.8.xml | 2 ++ man/mosquitto.conf.5.xml | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 402fc43d..efdbc9ff 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -14,6 +14,7 @@ Broker: a message with empty topic and topic alias set, but the topic alias hadn't already been configured on the broker. This has been fixed to send a protocol error, as per section 3.3.4 of the specification. +- Note in the man pages that SIGHUP reloads TLS certificates. Closes #2037. Apps: - Allow command line arguments to override config file options in diff --git a/man/mosquitto.8.xml b/man/mosquitto.8.xml index e00bdd6d..fe2b2d9d 100644 --- a/man/mosquitto.8.xml +++ b/man/mosquitto.8.xml @@ -431,6 +431,8 @@ be reloaded without restarting. See mosquitto.conf5 for details. + If TLS certificates are in use, then mosquitto will + also reload certificate on receiving a SIGHUP. diff --git a/man/mosquitto.conf.5.xml b/man/mosquitto.conf.5.xml index 6ea2b10f..cd76cd5f 100644 --- a/man/mosquitto.conf.5.xml +++ b/man/mosquitto.conf.5.xml @@ -1275,6 +1275,12 @@ log_timestamp_format %Y-%m-%dT%H:%M:%S option and must be present to enable certificate based TLS encryption. + + The certificate pointed to by this option will be + reloaded when Mosquitto receives a SIGHUP signal. + This can be used to load new certificates prior to + the existing ones expiring. + @@ -1328,6 +1334,12 @@ openssl dhparam -out dhparam.pem 2048 option and must be present to enable certificate based TLS encryption. + + The private key pointed to by this option will be + reloaded when Mosquitto receives a SIGHUP signal. + This can be used to load new keys prior to + the existing ones expiring. + From 6e3738dcf06a08147d16276ff56b9ace41ab993f Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 26 Jan 2021 13:19:08 +0000 Subject: [PATCH 17/51] Fix bridges not always connecting on Windows. Closes #2043. Thanks to ttsorensen. --- ChangeLog.txt | 1 + lib/net_mosq.c | 2 +- src/bridge.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index efdbc9ff..4483a2e3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -15,6 +15,7 @@ Broker: already been configured on the broker. This has been fixed to send a protocol error, as per section 3.3.4 of the specification. - Note in the man pages that SIGHUP reloads TLS certificates. Closes #2037. +- Fix bridges not always connecting on Windows. Closes #2043. Apps: - Allow command line arguments to override config file options in diff --git a/lib/net_mosq.c b/lib/net_mosq.c index cb5bf2ab..d42d83a7 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -942,7 +942,7 @@ int net__socket_connect(struct mosquitto *mosq, const char *host, uint16_t port, if(rc2) return rc2; } - return MOSQ_ERR_SUCCESS; + return rc; } diff --git a/src/bridge.c b/src/bridge.c index 6eda9cf8..d10d1269 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -62,7 +62,7 @@ void bridge__start_all(void) int i; for(i=0; ibridge_count; i++){ - if(bridge__new(&(db.config->bridges[i]))){ + if(bridge__new(&(db.config->bridges[i])) > 0){ log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Unable to connect to bridge %s.", db.config->bridges[i].name); } From 18bad1ff32435e523d7507e9b2ce0010124a8f2d Mon Sep 17 00:00:00 2001 From: Przemek Zygmunt Date: Wed, 27 Jan 2021 18:29:50 +0100 Subject: [PATCH 18/51] Unconditionally adding an event to the epoll causes 100% CPU usage. This happens when the connection to the server is established and the client has not sent any data yet. Signed-off-by: Przemek Zygmunt --- lib/packet_mosq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/packet_mosq.c b/lib/packet_mosq.c index ad2a3aae..84f93cb8 100644 --- a/lib/packet_mosq.c +++ b/lib/packet_mosq.c @@ -216,7 +216,9 @@ int packet__write(struct mosquitto *mosq) if(mosq->sock == INVALID_SOCKET) return MOSQ_ERR_NO_CONN; #ifdef WITH_BROKER - mux__add_out(mosq); + if (mosq->current_out_packet) { + mux__add_out(mosq); + } #endif pthread_mutex_lock(&mosq->current_out_packet_mutex); From e98cc28cd32760f9876703066c6d6a363f81835a Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 28 Jan 2021 09:29:52 +0000 Subject: [PATCH 19/51] Move check after current_out_packet is updated. --- lib/packet_mosq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/packet_mosq.c b/lib/packet_mosq.c index 84f93cb8..ebe6b6b8 100644 --- a/lib/packet_mosq.c +++ b/lib/packet_mosq.c @@ -215,12 +215,6 @@ int packet__write(struct mosquitto *mosq) if(!mosq) return MOSQ_ERR_INVAL; if(mosq->sock == INVALID_SOCKET) return MOSQ_ERR_NO_CONN; -#ifdef WITH_BROKER - if (mosq->current_out_packet) { - mux__add_out(mosq); - } -#endif - pthread_mutex_lock(&mosq->current_out_packet_mutex); pthread_mutex_lock(&mosq->out_packet_mutex); if(mosq->out_packet && !mosq->current_out_packet){ @@ -232,6 +226,12 @@ int packet__write(struct mosquitto *mosq) } pthread_mutex_unlock(&mosq->out_packet_mutex); +#ifdef WITH_BROKER + if(mosq->current_out_packet){ + mux__add_out(mosq); + } +#endif + state = mosquitto__get_state(mosq); #if defined(WITH_TLS) && !defined(WITH_BROKER) if(state == mosq_cs_connect_pending || mosq->want_connect){ From 53b7cc5fc1195c4c7b63f25d3b2d5561e5816196 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 28 Jan 2021 12:29:45 +0000 Subject: [PATCH 20/51] Bump version number, add web post. --- CMakeLists.txt | 2 +- config.mk | 2 +- include/mosquitto.h | 2 +- installer/mosquitto.nsi | 2 +- installer/mosquitto64.nsi | 2 +- set-version.sh | 2 +- snap/snapcraft.yaml | 2 +- www/pages/download.md | 8 +-- www/posts/2021/01/version-2-0-6-released.md | 59 +++++++++++++++++++++ 9 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 www/posts/2021/01/version-2-0-6-released.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 4650e34f..fd01def3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.0) cmake_policy(SET CMP0042 NEW) project(mosquitto) -set (VERSION 2.0.5) +set (VERSION 2.0.6) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") diff --git a/config.mk b/config.mk index 73c2c611..0d350ec8 100644 --- a/config.mk +++ b/config.mk @@ -127,7 +127,7 @@ WITH_XTREPORT=no # Also bump lib/mosquitto.h, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto64.nsi -VERSION=2.0.5 +VERSION=2.0.6 # Client library SO version. Bump if incompatible API/ABI changes are made. SOVERSION=1 diff --git a/include/mosquitto.h b/include/mosquitto.h index a517cf31..956bcdd3 100644 --- a/include/mosquitto.h +++ b/include/mosquitto.h @@ -66,7 +66,7 @@ extern "C" { #define LIBMOSQUITTO_MAJOR 2 #define LIBMOSQUITTO_MINOR 0 -#define LIBMOSQUITTO_REVISION 5 +#define LIBMOSQUITTO_REVISION 6 /* 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) diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 0ad72cd4..24e09492 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -9,7 +9,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "Eclipse Mosquitto" -!define VERSION 2.0.5 +!define VERSION 2.0.6 OutFile "mosquitto-${VERSION}-install-windows-x86.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/installer/mosquitto64.nsi b/installer/mosquitto64.nsi index 4bf999ee..f8555a96 100644 --- a/installer/mosquitto64.nsi +++ b/installer/mosquitto64.nsi @@ -9,7 +9,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "Eclipse Mosquitto" -!define VERSION 2.0.5 +!define VERSION 2.0.6 OutFile "mosquitto-${VERSION}-install-windows-x64.exe" !include "x64.nsh" diff --git a/set-version.sh b/set-version.sh index dc6cf349..ac997fd7 100755 --- a/set-version.sh +++ b/set-version.sh @@ -2,7 +2,7 @@ MAJOR=2 MINOR=0 -REVISION=5 +REVISION=6 sed -i "s/^VERSION=.*/VERSION=${MAJOR}.${MINOR}.${REVISION}/" config.mk diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 41495ef2..912ee4d9 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: mosquitto -version: 2.0.5 +version: 2.0.6 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. diff --git a/www/pages/download.md b/www/pages/download.md index 526847b8..757eefd8 100644 --- a/www/pages/download.md +++ b/www/pages/download.md @@ -1,7 +1,7 @@ + +Version 2.0.6 of Mosquitto has been released. This is a bugfix release. + +# Broker +- Fix calculation of remaining length parameter for websockets clients that + send fragmented packets. Closes [#1974]. +- Fix potential duplicate Will messages being sent when a will delay interval + has been set. +- Fix message expiry interval property not being honoured in + `mosquitto_broker_publish` and `mosquitto_broker_publish_copy`. +- Fix websockets listeners with TLS not responding. Closes [#2020]. +- Add notes that libsystemd-dev or similar is needed if building with systemd + support. Closes [#2019]. +- Improve logging in obscure cases when a client disconnects. Closes [#2017]. +- Fix reloading of listeners where multiple listeners have been defined with + the same port but different bind addresses. Closes [#2029]. +- Fix `message_size_limit` not applying to the Will payload. Closes [#2022]. +- The error topic-alias-invalid was being sent if an MQTT v5 client published + a message with empty topic and topic alias set, but the topic alias hadn't + already been configured on the broker. This has been fixed to send a + protocol error, as per section 3.3.4 of the specification. +- Note in the man pages that SIGHUP reloads TLS certificates. Closes [#2037]. +- Fix bridges not always connecting on Windows. Closes [#2043]. + +# Apps +- Allow command line arguments to override config file options in + mosquitto_ctrl. Closes [#2010]. +- mosquitto_ctrl: produce an error when requesting a new password if both + attempts do not match. Closes [#2011]. + +# Build +- Fix cmake builds using `WITH_CJSON=no` not working if cJSON not found. + Closes [#2026]. + +# Other +- The SPDX identifiers for EDL-1.0 have been changed to BSD-3-Clause as per + The Eclipse legal documentation generator. The licenses are identical. + +[#1974]: https://github.com/eclipse/mosquitto/issues/1974 +[#2010]: https://github.com/eclipse/mosquitto/issues/2010 +[#2011]: https://github.com/eclipse/mosquitto/issues/2011 +[#2017]: https://github.com/eclipse/mosquitto/issues/2017 +[#2019]: https://github.com/eclipse/mosquitto/issues/2019 +[#2020]: https://github.com/eclipse/mosquitto/issues/2020 +[#2022]: https://github.com/eclipse/mosquitto/issues/2022 +[#2026]: https://github.com/eclipse/mosquitto/issues/2026 +[#2029]: https://github.com/eclipse/mosquitto/issues/2029 +[#2037]: https://github.com/eclipse/mosquitto/issues/2037 +[#2043]: https://github.com/eclipse/mosquitto/issues/2043 From bbe0afbfbe7bb392361de41e275759ee4ef06b1c Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 28 Jan 2021 13:34:29 +0000 Subject: [PATCH 21/51] Add missing WITH_CJSON option. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd01def3..9804337b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,7 @@ if (WITH_DLT) add_definitions("-DWITH_DLT") endif (WITH_DLT) +option(WITH_CJSON "Build with cJSON support (required for dynamic security plugin and useful for mosquitto_sub)?" ON) if (WITH_CJSON) FIND_PACKAGE(cJSON) if (CJSON_FOUND) From f1180dd23a32f4c6b7651abbb2646823f73ee5e4 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 28 Jan 2021 16:36:51 +0000 Subject: [PATCH 22/51] Update docker for 2.0.6. --- docker/2.0-openssl/Dockerfile | 4 ++-- docker/2.0/Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/2.0-openssl/Dockerfile b/docker/2.0-openssl/Dockerfile index fdb2c7da..5e200831 100644 --- a/docker/2.0-openssl/Dockerfile +++ b/docker/2.0-openssl/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=2.0.5 \ - DOWNLOAD_SHA256=67eaeb4160e5793715c017f53c4f42808d76129b7ad131d765a6a23792e58d5d \ +ENV VERSION=2.0.6 \ + DOWNLOAD_SHA256=0b69a105bafd8524d11f0731fcdb2fbe1c94ad3ddd8f40ccfd97067c59ddd176 \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=2.4.2 \ LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \ diff --git a/docker/2.0/Dockerfile b/docker/2.0/Dockerfile index 09f22301..70bc0969 100644 --- a/docker/2.0/Dockerfile +++ b/docker/2.0/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=2.0.5 \ - DOWNLOAD_SHA256=67eaeb4160e5793715c017f53c4f42808d76129b7ad131d765a6a23792e58d5d \ +ENV VERSION=2.0.6 \ + DOWNLOAD_SHA256=0b69a105bafd8524d11f0731fcdb2fbe1c94ad3ddd8f40ccfd97067c59ddd176 \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=2.4.2 \ LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \ From 603107b87af47a52b6daa38f63383440fa919441 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 2 Feb 2021 13:37:24 +0000 Subject: [PATCH 23/51] Fix build of mosquitto_ctrl with static only libs. --- apps/mosquitto_ctrl/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/mosquitto_ctrl/Makefile b/apps/mosquitto_ctrl/Makefile index c351f9b9..286eb449 100644 --- a/apps/mosquitto_ctrl/Makefile +++ b/apps/mosquitto_ctrl/Makefile @@ -5,8 +5,12 @@ include ../../config.mk ifeq ($(WITH_SHARED_LIBRARIES),yes) LIBMOSQ:=../../lib/libmosquitto.so.${SOVERSION} else +ifeq ($(WITH_THREADING),yes) +LIBMOSQ:=../../lib/libmosquitto.a -lpthread -lssl -lcrypto +else LIBMOSQ:=../../lib/libmosquitto.a endif +endif LOCAL_CPPFLAGS:=-I../mosquitto_passwd @@ -25,7 +29,6 @@ OBJS= mosquitto_ctrl.o \ EXAMPLE_OBJS= example.o ifeq ($(WITH_TLS),yes) - ifeq ($(WITH_CJSON),yes) TARGET:=mosquitto_ctrl mosquitto_ctrl_example.so else From 05292cdbef07572bdc59f89943c47f566ba3bc16 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 2 Feb 2021 16:14:05 +0000 Subject: [PATCH 24/51] Fix exporting of executable symbols on BSD when building via makefile. --- ChangeLog.txt | 4 ++++ config.mk | 1 + 2 files changed, 5 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 02348701..7f499f87 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +Broker: +- Fix exporting of executable symbols on BSD when building via makefile. + + 2.0.6 - 2021-01-28 ================== diff --git a/config.mk b/config.mk index 0d350ec8..54039960 100644 --- a/config.mk +++ b/config.mk @@ -181,6 +181,7 @@ PLUGIN_LDFLAGS:=$(LDFLAGS) ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD), $(findstring $(UNAME),NetBSD)),) BROKER_LDADD:=$(BROKER_LDADD) -lm + BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -Wl,--dynamic-list=linker.syms SEDINPLACE:=-i "" else BROKER_LDADD:=$(BROKER_LDADD) -ldl -lm From 217b416a2d11fbd8e93145e5006eb1fe1a2ac515 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 2 Feb 2021 16:33:49 +0000 Subject: [PATCH 25/51] Fix man page building to not absolutely require xsltproc when using CMake. This now handles the case where we are building from the released tar, or building from git if xsltproc is available, or building from git if xsltproc is not available. --- ChangeLog.txt | 6 +++++ man/CMakeLists.txt | 66 ++++++++++++++++++++++++++++------------------ 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 7f499f87..5ed7d0d1 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,12 @@ Broker: - Fix exporting of executable symbols on BSD when building via makefile. +Build: +- Fix man page building to not absolutely require xsltproc when using CMake. + This now handles the case where we are building from the released tar, or + building from git if xsltproc is available, or building from git if xsltproc + is not available. + 2.0.6 - 2021-01-28 ================== diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 98a457d1..2c8b0955 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -1,31 +1,47 @@ +# If we are building from a release tarball, the man pages should already be built, so them. +# If we are building from git, then the man pages will not be built. In this +# case, attempt to find xsltproc, and if found build the man pages. If xsltproc +# could not be found, then the man pages will not be built or installed - +# because the install is optional. + if(NOT WIN32) - find_program(XSLTPROC xsltproc REQUIRED) - if(NOT XSLTPROC) + find_program(XSLTPROC xsltproc OPTIONAL) + if(XSLTPROC) + function(compile_manpage page) + add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/man/${page} + COMMAND xsltproc ${CMAKE_SOURCE_DIR}/man/${page}.xml -o ${CMAKE_SOURCE_DIR}/man/ + MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/man/${page}.xml) + add_custom_target(${page} ALL DEPENDS ${CMAKE_SOURCE_DIR}/man/${page}) + endfunction() + + compile_manpage("mosquitto_ctrl.1") + compile_manpage("mosquitto_ctrl_dynsec.1") + compile_manpage("mosquitto_passwd.1") + compile_manpage("mosquitto_pub.1") + compile_manpage("mosquitto_sub.1") + compile_manpage("mosquitto_rr.1") + compile_manpage("libmosquitto.3") + compile_manpage("mosquitto.conf.5") + compile_manpage("mosquitto-tls.7") + compile_manpage("mqtt.7") + compile_manpage("mosquitto.8") + else() message(FATAL_ERROR "xsltproc not found: manpages cannot be built") endif() - function(compile_manpage page) - add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/man/${page} - COMMAND xsltproc ${CMAKE_SOURCE_DIR}/man/${page}.xml -o ${CMAKE_SOURCE_DIR}/man/ - MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/man/${page}.xml) - add_custom_target(${page} ALL DEPENDS ${CMAKE_SOURCE_DIR}/man/${page}) - endfunction() - - compile_manpage("mosquitto_ctrl.1") - compile_manpage("mosquitto_ctrl_dynsec.1") - compile_manpage("mosquitto_passwd.1") - compile_manpage("mosquitto_pub.1") - compile_manpage("mosquitto_sub.1") - compile_manpage("mosquitto_rr.1") - compile_manpage("libmosquitto.3") - compile_manpage("mosquitto.conf.5") - compile_manpage("mosquitto-tls.7") - compile_manpage("mqtt.7") - compile_manpage("mosquitto.8") endif() -install(FILES mosquitto_ctrl.1 mosquitto_ctrl_dynsec.1 mosquitto_passwd.1 mosquitto_pub.1 mosquitto_sub.1 mosquitto_rr.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) -install(FILES libmosquitto.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3) -install(FILES mosquitto.conf.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5) -install(FILES mosquitto-tls.7 mqtt.7 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7) -install(FILES mosquitto.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8) +install(FILES + mosquitto_ctrl.1 + mosquitto_ctrl_dynsec.1 + mosquitto_passwd.1 + mosquitto_pub.1 + mosquitto_sub.1 + mosquitto_rr.1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 + OPTIONAL) + +install(FILES libmosquitto.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 OPTIONAL) +install(FILES mosquitto.conf.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5 OPTIONAL) +install(FILES mosquitto-tls.7 mqtt.7 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7 OPTIONAL) +install(FILES mosquitto.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8 OPTIONAL) From f7dcd835728671568c536057832df9d61c3945e8 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 3 Feb 2021 09:52:52 +0000 Subject: [PATCH 26/51] Replace bash specific equality check with POSIX check. Closes #2056. Thanks to Greg Troxel. --- misc/letsencrypt/mosquitto-copy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/letsencrypt/mosquitto-copy.sh b/misc/letsencrypt/mosquitto-copy.sh index c2a69470..5c7fb7d0 100755 --- a/misc/letsencrypt/mosquitto-copy.sh +++ b/misc/letsencrypt/mosquitto-copy.sh @@ -12,7 +12,7 @@ # Place this script in /etc/letsencrypt/renewal-hooks/deploy/ and make it # executable after editing it to your needs. -if [ ${RENEWED_DOMAINS} == "my-mosquitto-domain" ]; then +if [ ${RENEWED_DOMAINS} = "my-mosquitto-domain" ]; then # Copy new certificate to Mosquitto directory cp ${RENEWED_LINEAGE}/fullchain.pem /etc/mosquitto/certs/server.pem cp ${RENEWED_LINEAGE}/privkey.pem /etc/mosquitto/certs/server.key From 6c2dca51c39fa89fd3555b3c44af9fbbf1633450 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 3 Feb 2021 10:11:44 +0000 Subject: [PATCH 27/51] Clients: Fix config files truncating options after the first space. Closes #2059. Thanks to Jason White. --- ChangeLog.txt | 3 +++ client/client_shared.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 5ed7d0d1..75392d76 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,9 @@ Broker: - Fix exporting of executable symbols on BSD when building via makefile. +Clients: +- Fix config files truncating options after the first space. Closes #2059. + Build: - Fix man page building to not absolutely require xsltproc when using CMake. This now handles the case where we are building from the released tar, or diff --git a/client/client_shared.c b/client/client_shared.c index 2a9e3720..26755b7b 100644 --- a/client/client_shared.c +++ b/client/client_shared.c @@ -357,7 +357,7 @@ int client_config_load(struct mosq_config *cfg, int pub_or_sub, int argc, char * * program name as the first entry. */ args[1] = strtok(line, " "); if(args[1]){ - args[2] = strtok(NULL, " "); + args[2] = strtok(NULL, ""); if(args[2]){ count = 3; }else{ From 1e6be1f123200c64451a7be3f2308f1098b4ddd2 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 1 Feb 2021 23:46:03 +0000 Subject: [PATCH 28/51] Fix some minor memory leaks on exit only. --- ChangeLog.txt | 1 + src/security_default.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 75392d76..edfc3d97 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,6 @@ Broker: - Fix exporting of executable symbols on BSD when building via makefile. +- Fix some minor memory leaks on exit only. Clients: - Fix config files truncating options after the first space. Closes #2059. diff --git a/src/security_default.c b/src/security_default.c index 6c13cdbd..ec96e319 100644 --- a/src/security_default.c +++ b/src/security_default.c @@ -182,6 +182,8 @@ int mosquitto_security_cleanup_default(bool reload) if(db.config->listeners[i].security_options.pid){ mosquitto_callback_unregister(db.config->listeners[i].security_options.pid, MOSQ_EVT_BASIC_AUTH, mosquitto_unpwd_check_default, NULL); + mosquitto_callback_unregister(db.config->listeners[i].security_options.pid, + MOSQ_EVT_ACL_CHECK, mosquitto_acl_check_default, NULL); mosquitto__free(db.config->listeners[i].security_options.pid); } @@ -190,6 +192,8 @@ int mosquitto_security_cleanup_default(bool reload) if(db.config->security_options.pid){ mosquitto_callback_unregister(db.config->security_options.pid, MOSQ_EVT_BASIC_AUTH, mosquitto_unpwd_check_default, NULL); + mosquitto_callback_unregister(db.config->security_options.pid, + MOSQ_EVT_ACL_CHECK, mosquitto_acl_check_default, NULL); mosquitto__free(db.config->security_options.pid); } From 7a3b69f2d7a5660d41a844c0a47eae8a643bba2f Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 3 Feb 2021 17:24:31 +0000 Subject: [PATCH 29/51] Fix possible leak during connect. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #2057. Thanks to Przemysław Zygmunt. --- ChangeLog.txt | 1 + src/handle_connect.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index edfc3d97..79a82b90 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,7 @@ Broker: - Fix exporting of executable symbols on BSD when building via makefile. - Fix some minor memory leaks on exit only. +- Fix possible memory leak on connect. Closes #2057. Clients: - Fix config files truncating options after the first space. Closes #2059. diff --git a/src/handle_connect.c b/src/handle_connect.c index bc5c4604..6dfd9e3a 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -351,7 +351,6 @@ static int will__read(struct mosquitto *context, const char *client_id, struct m }else{ send__connack(context, 0, CONNACK_REFUSED_NOT_AUTHORIZED, NULL); } - context__disconnect(context); rc = MOSQ_ERR_PAYLOAD_SIZE; goto error_cleanup; } @@ -835,6 +834,7 @@ int handle__connect(struct mosquitto *context) if(context->auth_method){ rc = mosquitto_security_auth_start(context, false, auth_data, auth_data_len, &auth_data_out, &auth_data_out_len); mosquitto__free(auth_data); + auth_data = NULL; if(rc == MOSQ_ERR_SUCCESS){ return connect__on_authorised(context, auth_data_out, auth_data_out_len); }else if(rc == MOSQ_ERR_AUTH_CONTINUE){ @@ -844,22 +844,23 @@ int handle__connect(struct mosquitto *context) return rc; }else{ free(auth_data_out); + auth_data_out = NULL; will__clear(context); if(rc == MOSQ_ERR_AUTH){ send__connack(context, 0, MQTT_RC_NOT_AUTHORIZED, NULL); mosquitto__free(context->id); context->id = NULL; - return MOSQ_ERR_PROTOCOL; + goto handle_connect_error; }else if(rc == MOSQ_ERR_NOT_SUPPORTED){ /* Client has requested extended authentication, but we don't support it. */ send__connack(context, 0, MQTT_RC_BAD_AUTHENTICATION_METHOD, NULL); mosquitto__free(context->id); context->id = NULL; - return MOSQ_ERR_PROTOCOL; + goto handle_connect_error; }else{ mosquitto__free(context->id); context->id = NULL; - return rc; + goto handle_connect_error; } } }else{ @@ -885,12 +886,11 @@ int handle__connect(struct mosquitto *context) }else{ send__connack(context, 0, CONNACK_REFUSED_NOT_AUTHORIZED, NULL); } - context__disconnect(context); rc = MOSQ_ERR_AUTH; goto handle_connect_error; break; default: - context__disconnect(context); + rc = MOSQ_ERR_UNKNOWN; goto handle_connect_error; break; } From 4a738f154e7964f0535e15097558e728be6a2bd6 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 3 Feb 2021 21:54:35 +0000 Subject: [PATCH 30/51] Fix openssl engine not being able to load private key. Closes #2066. Thanks to Boris Vanhoof. --- ChangeLog.txt | 1 + src/net.c | 129 ++++++++++++++++++++++++-------------------------- 2 files changed, 62 insertions(+), 68 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 79a82b90..d2c69884 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,6 +2,7 @@ Broker: - Fix exporting of executable symbols on BSD when building via makefile. - Fix some minor memory leaks on exit only. - Fix possible memory leak on connect. Closes #2057. +- Fix openssl engine not being able to load private key. Closes #2066. Clients: - Fix config files truncating options after the first space. Closes #2059. diff --git a/src/net.c b/src/net.c index da5cbc14..dcc9db36 100644 --- a/src/net.c +++ b/src/net.c @@ -458,11 +458,6 @@ int net__load_crl_file(struct mosquitto__listener *listener) int net__load_certificates(struct mosquitto__listener *listener) { #ifdef WITH_TLS - ENGINE *engine = NULL; -# if !defined(OPENSSL_NO_ENGINE) - UI_METHOD *ui_method; - EVP_PKEY *pkey; -# endif int rc; if(listener->require_certificate){ @@ -474,51 +469,13 @@ int net__load_certificates(struct mosquitto__listener *listener) if(rc != 1){ log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to load server certificate \"%s\". Check certfile.", listener->certfile); net__print_ssl_error(NULL); -#if !defined(OPENSSL_NO_ENGINE) - ENGINE_FINISH(engine); -#endif return MOSQ_ERR_TLS; } - if(listener->tls_engine && listener->tls_keyform == mosq_k_engine){ -#if !defined(OPENSSL_NO_ENGINE) - ui_method = net__get_ui_method(); - if(listener->tls_engine_kpass_sha1){ - if(!ENGINE_ctrl_cmd(engine, ENGINE_SECRET_MODE, ENGINE_SECRET_MODE_SHA, NULL, NULL, 0)){ - log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to set engine secret mode sha"); - net__print_ssl_error(NULL); - ENGINE_FINISH(engine); - return MOSQ_ERR_TLS; - } - if(!ENGINE_ctrl_cmd(engine, ENGINE_PIN, 0, listener->tls_engine_kpass_sha1, NULL, 0)){ - log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to set engine pin"); - net__print_ssl_error(NULL); - ENGINE_FINISH(engine); - return MOSQ_ERR_TLS; - } - ui_method = NULL; - } - pkey = ENGINE_load_private_key(engine, listener->keyfile, ui_method, NULL); - if(!pkey){ - log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to load engine private key file \"%s\".", listener->keyfile); - net__print_ssl_error(NULL); - ENGINE_FINISH(engine); - return MOSQ_ERR_TLS; - } - if(SSL_CTX_use_PrivateKey(listener->ssl_ctx, pkey) <= 0){ - log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to use engine private key file \"%s\".", listener->keyfile); - net__print_ssl_error(NULL); - ENGINE_FINISH(engine); - return MOSQ_ERR_TLS; - } -#endif - }else{ + if(listener->tls_engine == NULL){ rc = SSL_CTX_use_PrivateKey_file(listener->ssl_ctx, listener->keyfile, SSL_FILETYPE_PEM); if(rc != 1){ log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to load server key file \"%s\". Check keyfile.", listener->keyfile); net__print_ssl_error(NULL); -#if !defined(OPENSSL_NO_ENGINE) - ENGINE_FINISH(engine); -#endif return MOSQ_ERR_TLS; } } @@ -526,18 +483,12 @@ int net__load_certificates(struct mosquitto__listener *listener) if(rc != 1){ log__printf(NULL, MOSQ_LOG_ERR, "Error: Server certificate/key are inconsistent."); net__print_ssl_error(NULL); -#if !defined(OPENSSL_NO_ENGINE) - ENGINE_FINISH(engine); -#endif return MOSQ_ERR_TLS; } /* Load CRLs if they exist. */ if(listener->crlfile){ rc = net__load_crl_file(listener); if(rc){ -#if !defined(OPENSSL_NO_ENGINE) - ENGINE_FINISH(engine); -#endif return rc; } } @@ -546,10 +497,67 @@ int net__load_certificates(struct mosquitto__listener *listener) } +static int net__load_engine(struct mosquitto__listener *listener) +{ +#if defined(WITH_TLS) && !defined(OPENSSL_NO_ENGINE) + ENGINE *engine = NULL; + UI_METHOD *ui_method; + EVP_PKEY *pkey; + + if(!listener->tls_engine){ + return MOSQ_ERR_SUCCESS; + } + + engine = ENGINE_by_id(listener->tls_engine); + if(!engine){ + log__printf(NULL, MOSQ_LOG_ERR, "Error loading %s engine\n", listener->tls_engine); + net__print_ssl_error(NULL); + return MOSQ_ERR_TLS; + } + if(!ENGINE_init(engine)){ + log__printf(NULL, MOSQ_LOG_ERR, "Failed engine initialisation\n"); + net__print_ssl_error(NULL); + return MOSQ_ERR_TLS; + } + ENGINE_set_default(engine, ENGINE_METHOD_ALL); + + if(listener->tls_keyform == mosq_k_engine){ + ui_method = net__get_ui_method(); + if(listener->tls_engine_kpass_sha1){ + if(!ENGINE_ctrl_cmd(engine, ENGINE_SECRET_MODE, ENGINE_SECRET_MODE_SHA, NULL, NULL, 0)){ + log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to set engine secret mode sha"); + net__print_ssl_error(NULL); + return MOSQ_ERR_TLS; + } + if(!ENGINE_ctrl_cmd(engine, ENGINE_PIN, 0, listener->tls_engine_kpass_sha1, NULL, 0)){ + log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to set engine pin"); + net__print_ssl_error(NULL); + return MOSQ_ERR_TLS; + } + ui_method = NULL; + } + pkey = ENGINE_load_private_key(engine, listener->keyfile, ui_method, NULL); + if(!pkey){ + log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to load engine private key file \"%s\".", listener->keyfile); + net__print_ssl_error(NULL); + return MOSQ_ERR_TLS; + } + if(SSL_CTX_use_PrivateKey(listener->ssl_ctx, pkey) <= 0){ + log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to use engine private key file \"%s\".", listener->keyfile); + net__print_ssl_error(NULL); + return MOSQ_ERR_TLS; + } + } + ENGINE_free(engine); /* release the structural reference from ENGINE_by_id() */ +#endif + + return MOSQ_ERR_SUCCESS; +} + + int net__tls_load_verify(struct mosquitto__listener *listener) { #ifdef WITH_TLS - ENGINE *engine = NULL; int rc; #if OPENSSL_VERSION_NUMBER < 0x30000000L @@ -584,23 +592,8 @@ int net__tls_load_verify(struct mosquitto__listener *listener) } #endif - if(listener->tls_engine){ -#if !defined(OPENSSL_NO_ENGINE) - engine = ENGINE_by_id(listener->tls_engine); - if(!engine){ - log__printf(NULL, MOSQ_LOG_ERR, "Error loading %s engine\n", listener->tls_engine); - net__print_ssl_error(NULL); - return MOSQ_ERR_TLS; - } - if(!ENGINE_init(engine)){ - log__printf(NULL, MOSQ_LOG_ERR, "Failed engine initialisation\n"); - net__print_ssl_error(NULL); - ENGINE_free(engine); - return MOSQ_ERR_TLS; - } - ENGINE_set_default(engine, ENGINE_METHOD_ALL); - ENGINE_free(engine); /* release the structural reference from ENGINE_by_id() */ -#endif + if(net__load_engine(listener)){ + return MOSQ_ERR_TLS; } #endif return net__load_certificates(listener); From c2a26250f699b9c21104c682d8641f3e120c9170 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 4 Feb 2021 10:10:13 +0000 Subject: [PATCH 31/51] Bump changelog, versions, and web pages. --- CMakeLists.txt | 2 +- ChangeLog.txt | 37 ++++++++++ config.mk | 2 +- include/mosquitto.h | 2 +- installer/mosquitto.nsi | 2 +- installer/mosquitto64.nsi | 2 +- set-version.sh | 2 +- snap/snapcraft.yaml | 2 +- www/pages/download.md | 8 +-- www/posts/2021/02/version-2-0-7-released.md | 77 +++++++++++++++++++++ 10 files changed, 125 insertions(+), 11 deletions(-) create mode 100644 www/posts/2021/02/version-2-0-7-released.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 9804337b..7a08b325 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.0) cmake_policy(SET CMP0042 NEW) project(mosquitto) -set (VERSION 2.0.6) +set (VERSION 2.0.7) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") diff --git a/ChangeLog.txt b/ChangeLog.txt index d2c69884..ba115c0a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,6 @@ +2.0.7 - 2021-02-04 +================== + Broker: - Fix exporting of executable symbols on BSD when building via makefile. - Fix some minor memory leaks on exit only. @@ -14,6 +17,40 @@ Build: is not available. +1.6.13 - 2021-02-04 +=================== + +Broker: +- Fix crash on Windows if loading a plugin fails. Closes #1866. +- Fix DH group not being set for TLS connections, which meant ciphers using + DHE couldn't be used. Closes #1925. Closes #1476. +- Fix local bridges being disconnected on SIGHUP. Closes #1942. +- Fix $SYS/broker/publish/messages/+ counters not being updated for QoS 1, 2 + messages. Closes #1968. +- Fix listener not being reassociated with client when reloading a persistence + file and `per_listener_settings true` is set and the client did not set a + username. Closes #1891. +- Fix file logging on Windows. Closes #1880. +- Fix bridge sock not being removed from sock hash on error. Closes #1897. + +Client library: +- Fix build on Mac Big Sur. Closes #1905. +- Fix DH group not being set for TLS connections, which meant ciphers using + DHE couldn't be used. Closes #1925. Closes #1476. + +Clients: +- mosquitto_sub will now quit with an error if the %U option is used on + Windows, rather than just quitting. Closes #1908. +- Fix config files truncating options after the first space. Closes #2059. + +Apps: +- Perform stricter parsing of input username in mosquitto_passwd. Closes + #570126 (Eclipse bugzilla). + +Build: +- Enable epoll support in CMake builds. + + 2.0.6 - 2021-01-28 ================== diff --git a/config.mk b/config.mk index 54039960..e8c577ba 100644 --- a/config.mk +++ b/config.mk @@ -127,7 +127,7 @@ WITH_XTREPORT=no # Also bump lib/mosquitto.h, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto64.nsi -VERSION=2.0.6 +VERSION=2.0.7 # Client library SO version. Bump if incompatible API/ABI changes are made. SOVERSION=1 diff --git a/include/mosquitto.h b/include/mosquitto.h index 956bcdd3..386c9da1 100644 --- a/include/mosquitto.h +++ b/include/mosquitto.h @@ -66,7 +66,7 @@ extern "C" { #define LIBMOSQUITTO_MAJOR 2 #define LIBMOSQUITTO_MINOR 0 -#define LIBMOSQUITTO_REVISION 6 +#define LIBMOSQUITTO_REVISION 7 /* 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) diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 24e09492..ad3ee454 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -9,7 +9,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "Eclipse Mosquitto" -!define VERSION 2.0.6 +!define VERSION 2.0.7 OutFile "mosquitto-${VERSION}-install-windows-x86.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/installer/mosquitto64.nsi b/installer/mosquitto64.nsi index f8555a96..b88b656d 100644 --- a/installer/mosquitto64.nsi +++ b/installer/mosquitto64.nsi @@ -9,7 +9,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "Eclipse Mosquitto" -!define VERSION 2.0.6 +!define VERSION 2.0.7 OutFile "mosquitto-${VERSION}-install-windows-x64.exe" !include "x64.nsh" diff --git a/set-version.sh b/set-version.sh index ac997fd7..bf1a1cf9 100755 --- a/set-version.sh +++ b/set-version.sh @@ -2,7 +2,7 @@ MAJOR=2 MINOR=0 -REVISION=6 +REVISION=7 sed -i "s/^VERSION=.*/VERSION=${MAJOR}.${MINOR}.${REVISION}/" config.mk diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 912ee4d9..063a71de 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: mosquitto -version: 2.0.6 +version: 2.0.7 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. diff --git a/www/pages/download.md b/www/pages/download.md index 757eefd8..290ba6b2 100644 --- a/www/pages/download.md +++ b/www/pages/download.md @@ -1,7 +1,7 @@ + +Version 2.0.7 and 1.6.13 of Mosquitto have been released. These are bugfix releases. + +# 2.0.7 + +## Broker +- Fix exporting of executable symbols on BSD when building via makefile. +- Fix some minor memory leaks on exit only. +- Fix possible memory leak on connect. Closes [#2057]. +- Fix openssl engine not being able to load private key. Closes [#2066]. + +## Clients +- Fix config files truncating options after the first space. Closes [#2059]. + +## Build +- Fix man page building to not absolutely require xsltproc when using CMake. + This now handles the case where we are building from the released tar, or + building from git if xsltproc is available, or building from git if xsltproc + is not available. + + +# 1.6.13 + +## Broker: +- Fix crash on Windows if loading a plugin fails. Closes [#1866]. +- Fix DH group not being set for TLS connections, which meant ciphers using + DHE couldn't be used. Closes [#1925]. Closes [#1476]. +- Fix local bridges being disconnected on SIGHUP. Closes [#1942]. +- Fix $SYS/broker/publish/messages/+ counters not being updated for QoS 1, 2 + messages. Closes [#1968]. +- Fix listener not being reassociated with client when reloading a persistence + file and `per_listener_settings true` is set and the client did not set a + username. Closes [#1891]. +- Fix file logging on Windows. Closes [#1880]. +- Fix bridge sock not being removed from sock hash on error. Closes [#1897]. + +## Client library: +- Fix build on Mac Big Sur. Closes [#1905]. +- Fix DH group not being set for TLS connections, which meant ciphers using + DHE couldn't be used. Closes [#1925]. Closes [#1476]. + +## Clients: +- mosquitto_sub will now quit with an error if the %U option is used on + Windows, rather than just quitting. Closes [#1908]. +- Fix config files truncating options after the first space. Closes [#2059]. + +## Apps: +- Perform stricter parsing of input username in mosquitto_passwd. Closes + [#570126] (Eclipse bugzilla). + +## Build: +- Enable epoll support in CMake builds. + +[#1476]: https://github.com/eclipse/mosquitto/issues/1476 +[#1866]: https://github.com/eclipse/mosquitto/issues/1866 +[#1880]: https://github.com/eclipse/mosquitto/issues/1880 +[#1891]: https://github.com/eclipse/mosquitto/issues/1891 +[#1897]: https://github.com/eclipse/mosquitto/issues/1897 +[#1905]: https://github.com/eclipse/mosquitto/issues/1905 +[#1908]: https://github.com/eclipse/mosquitto/issues/1908 +[#1925]: https://github.com/eclipse/mosquitto/issues/1925 +[#1942]: https://github.com/eclipse/mosquitto/issues/1942 +[#1968]: https://github.com/eclipse/mosquitto/issues/1968 +[#2057]: https://github.com/eclipse/mosquitto/issues/2057 +[#2059]: https://github.com/eclipse/mosquitto/issues/2059 +[#2066]: https://github.com/eclipse/mosquitto/issues/2066 +[#570126]: https://bugs.eclipse.org/bugs/show_bug.cgi?id=570126 From 0736414306caa4229c5b476b616bb0491c423145 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 4 Feb 2021 10:59:40 +0000 Subject: [PATCH 32/51] Update docker builds. --- docker/1.6-openssl/Dockerfile | 4 ++-- docker/1.6/Dockerfile | 4 ++-- docker/2.0-openssl/Dockerfile | 4 ++-- docker/2.0/Dockerfile | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/1.6-openssl/Dockerfile b/docker/1.6-openssl/Dockerfile index 46e0bc83..c26c07e6 100644 --- a/docker/1.6-openssl/Dockerfile +++ b/docker/1.6-openssl/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=1.6.12 \ - DOWNLOAD_SHA256=548d73d19fb787dd0530334e398fd256ef3a581181678488a741a995c4f007fb \ +ENV VERSION=1.6.13 \ + DOWNLOAD_SHA256=ce205248dd323e4e562ff83e9e84d0f9a16f4bda87183c367c66a7163c0fc287 \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=2.4.2 \ LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 diff --git a/docker/1.6/Dockerfile b/docker/1.6/Dockerfile index 63083ec2..f8fa4fd9 100644 --- a/docker/1.6/Dockerfile +++ b/docker/1.6/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=1.6.12 \ - DOWNLOAD_SHA256=548d73d19fb787dd0530334e398fd256ef3a581181678488a741a995c4f007fb \ +ENV VERSION=1.6.13 \ + DOWNLOAD_SHA256=ce205248dd323e4e562ff83e9e84d0f9a16f4bda87183c367c66a7163c0fc287 \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=2.4.2 \ LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 diff --git a/docker/2.0-openssl/Dockerfile b/docker/2.0-openssl/Dockerfile index 5e200831..6147ba55 100644 --- a/docker/2.0-openssl/Dockerfile +++ b/docker/2.0-openssl/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=2.0.6 \ - DOWNLOAD_SHA256=0b69a105bafd8524d11f0731fcdb2fbe1c94ad3ddd8f40ccfd97067c59ddd176 \ +ENV VERSION=2.0.7 \ + DOWNLOAD_SHA256=a98054f0b8161588975ef24e1d467550d3935f4c16ccee63ecb623248a28356e \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=2.4.2 \ LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \ diff --git a/docker/2.0/Dockerfile b/docker/2.0/Dockerfile index 70bc0969..56723a17 100644 --- a/docker/2.0/Dockerfile +++ b/docker/2.0/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=2.0.6 \ - DOWNLOAD_SHA256=0b69a105bafd8524d11f0731fcdb2fbe1c94ad3ddd8f40ccfd97067c59ddd176 \ +ENV VERSION=2.0.7 \ + DOWNLOAD_SHA256=a98054f0b8161588975ef24e1d467550d3935f4c16ccee63ecb623248a28356e \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=2.4.2 \ LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \ From 801f5d216eeb655634d466db2056f8d5561b3494 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 5 Feb 2021 12:44:43 +0000 Subject: [PATCH 33/51] Use `listener` in default snap config to avoid deprecated `port`. --- snap/local/default_config.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/local/default_config.conf b/snap/local/default_config.conf index be2071c6..32d29674 100644 --- a/snap/local/default_config.conf +++ b/snap/local/default_config.conf @@ -1,3 +1,3 @@ -port 1883 +listener 1883 persistence false user root From c7177d88981643d971329a015144ac51605be4d9 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 5 Feb 2021 14:25:04 +0000 Subject: [PATCH 34/51] Don't specify listener *or* port in snap default. If we do that, then nothing can connect even from the local machine. --- snap/local/default_config.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/snap/local/default_config.conf b/snap/local/default_config.conf index 32d29674..c1156f27 100644 --- a/snap/local/default_config.conf +++ b/snap/local/default_config.conf @@ -1,3 +1,2 @@ -listener 1883 persistence false user root From c640d669c9c447c947d8b8324f7510310ab925be Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 5 Feb 2021 15:36:36 +0000 Subject: [PATCH 35/51] Add authentication methods doc. --- .../documentation/authentication-methods.md | 147 ++++++++++++++++++ www/pages/documentation/using-the-snap.md | 5 +- 2 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 www/pages/documentation/authentication-methods.md diff --git a/www/pages/documentation/authentication-methods.md b/www/pages/documentation/authentication-methods.md new file mode 100644 index 00000000..f516956d --- /dev/null +++ b/www/pages/documentation/authentication-methods.md @@ -0,0 +1,147 @@ + + +It is important to configure authentication on your Mosquitto instance, so +unauthorised clients cannot connect. + +In Mosquitto 2.0 and up, you must choose your authentication options explicitly +before clients can connect. In earlier versions the default is to allow clients +to connect without authentication. + +There are three choices for authentication: password files, authentication +plugins, and unauthorised/anonymous access. It is possible to use a combination +of all three choices. + +It is possible to have different listeners use different authentication methods +by setting `per_listener_settings true` in your configuration file. + +As well as authentication you should also consider some form of access control +to determine what clients can access which topics. + +## Password files + +Password files are a simple mechanism of storing usernames and passwords in a +single file. They are good if you have a relatively small number of fairly +static users. + +If you make changes to the password file you must trigger the broker to reload +the file by sending a SIGHUP message: + +``` +kill -HUP +``` + +### Creating a password file + +To create a password file, use the `mosquitto_passwd` utility, use the line +below. You will be asked for the password. Note that `-c` means an existing +file will be overwritten: + +``` +mosquitto_passwd -c +``` + +To add more users to an existing password file, or to change the password for +an existing user, leave out the `-c` argument: + +``` +mosquitto_passwd +``` + +To remove a user from a password file: + +``` +mosquitto_passwd -D +``` + +You can also add/update a username and password in a single line, but be aware +that this means the password is visible on the command line and in any command +history: + +``` +mosquitto_passwd +``` + +### Configuring the broker + +To start using your password file you must add the `password_file` option to +your configuration file: + +``` +password_file +``` + +The password file must be able to be read by whatever user Mosquitto is running +as. On Linux/POSIX systems this will typically be the `mosquitto` user, and +`/etc/mosquitto/password_file` is a good place for the file itself. + +If you are using the `per_listener_settings true` option to have separate +security settings per listener, you must place the password file option *after* +the listener it is for: + +``` +listener 1883 +password_file /etc/mosquitto/password_file +``` + +## Authentication plugins + +If you want more control over authentication of your users than is offered by a +password file, then an authentication plugin may be suitable for you. The +features offered depend on which plugin you use. + +### Configuring the plugin + +Configuring a plugin varies depending on the version of Mosquitto plugin +interface the plugin was written for, either version 2.0 and up, or 1.6.x and +earlier. + +For 1.6.x and below, use the `auth_plugin` option. These plugins are also +supported by version 2.0: + +``` +listener 1883 +auth_plugin +``` + +Some plugins require extra configuration which will be described in their +documentation. + +For 2.0 and up, use the `plugin` option: + +``` +listener 1883 +plugin +``` + +### Available plugins + +* [Dynamic security](https://mosquitto.org/documentation/dynamic-security/), + for 2.0 and up only, provided by the Mosquitto project to give flexible + in-broker clients, groups, and roles that can be administered remotely. +* [mosquitto-go-auth](https://github.com/iegomez/mosquitto-go-auth), which + offers the use of a variety of backends to store user data, such as mysql, + jwt, or redis. + + +## Unauthenticated access + +To configure unauthenticated access, use the `allow_anonymous` option: + +``` +listener 1883 +allow_anonymous true +``` + +It is valid to allow anonmous and authenticated access on the same broker. In +particular the dynamic security plugin allows you to assign different rights to +anonymous users than to authenticated users, which may be useful for read-only +access to data for example. diff --git a/www/pages/documentation/using-the-snap.md b/www/pages/documentation/using-the-snap.md index d9926b20..41d6f3d4 100644 --- a/www/pages/documentation/using-the-snap.md +++ b/www/pages/documentation/using-the-snap.md @@ -14,7 +14,8 @@ graphical software installer, or with `snap install mosquitto`. After installing the Mosquitto snap, the Mosquitto broker will be running with the default configuration, which means it is listening for connections on port -1883. +1883 on the local computer only. If you want to allow connections from other +computers you must configure a listener and an [authentication method]. To test the broker, you can use the `mosquitto_pub` and `mosquitto_sub` command line utilities, which are also provided in the snap. `mosquitto_pub` allows you @@ -75,3 +76,5 @@ running as a snap. All other aspects of running Mosquitto are the same as with any other installation methods. + +[authentication method]:/documentation/authentication-methods From 36b42364aee24d0d8267d2563fabbadac074d5c3 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 5 Feb 2021 15:41:26 +0000 Subject: [PATCH 36/51] Add new auth doc to documentation index. --- www/pages/documentation.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/pages/documentation.md b/www/pages/documentation.md index 49b786a3..cc728dc8 100644 --- a/www/pages/documentation.md +++ b/www/pages/documentation.md @@ -26,8 +26,9 @@ # Other -* [Using the snap package] - specific instructions on installing and configuring the Mosquitto snap package. +* [Authentication methods] - details on the different authentication options available. * [Dynamic Security plugin] - details of using the Dynamic Security authentication and access control plugin. +* [Using the snap package] - specific instructions on installing and configuring the Mosquitto snap package. * [Migrating from 1.x to 2.0] - details of changes needed to migrate to version 2.0. [mosquitto]:/man/mosquitto-8.html @@ -41,6 +42,7 @@ [libmosquitto API documentation]:/api/ +[Authentication methods]:/documentation/authentication-methods/ [Using the snap package]:/documentation/using-the-snap/ [Dynamic Security plugin]:/documentation/dynamic-security/ [Migrating from 1.x to 2.0]:/documentation/migrating-to-2-0/ From 24920c9a08fb5b42884d4ddcda9a76c29255f1e6 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 6 Feb 2021 23:02:06 +0000 Subject: [PATCH 37/51] Fix possible loss of data in `mosquitto_pub -l` when sending multiple long lines. Closes #2078. Thanks to Ysincit. --- ChangeLog.txt | 4 ++++ client/pub_client.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index ba115c0a..3831823e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +Clients: +- Fix possible loss of data in `mosquitto_pub -l` when sending multiple long + lines. Closes #2078. + 2.0.7 - 2021-02-04 ================== diff --git a/client/pub_client.c b/client/pub_client.c index 9153ebad..8049de6e 100644 --- a/client/pub_client.c +++ b/client/pub_client.c @@ -275,7 +275,7 @@ int pub_stdin_line_loop(struct mosquitto *mosq) break; }else{ line_buf_len += 1024; - pos += 1023; + pos += read_len-1; read_len = 1024; buf2 = realloc(line_buf, (size_t )line_buf_len); if(!buf2){ From 7fe638786dfd33619ef779dfced3cfb61978a796 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 6 Feb 2021 23:43:42 +0000 Subject: [PATCH 38/51] Fix mosquitto_evt_tick struct members. --- ChangeLog.txt | 8 ++++++++ include/mosquitto_broker.h | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 3831823e..db224ae5 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,11 @@ +Broker: +- Fix incorrect datatypes in `struct mosquitto_evt_tick`. This changes the + size and offset of two of the members of this struct, and changes the size + of the struct. This is an ABI break, but is considered to be acceptable + because plugins should never be allocating their own instance of this + struct, and currently none of the struct members are used for anything, so a + plugin should not be accessing them. + Clients: - Fix possible loss of data in `mosquitto_pub -l` when sending multiple long lines. Closes #2078. diff --git a/include/mosquitto_broker.h b/include/mosquitto_broker.h index 9653cab9..a2aff495 100644 --- a/include/mosquitto_broker.h +++ b/include/mosquitto_broker.h @@ -37,6 +37,7 @@ extern "C" { #include #include #include +#include struct mosquitto; typedef struct mqtt5__property mosquitto_property; @@ -157,8 +158,8 @@ struct mosquitto_evt_tick { void *future; long now_ns; long next_ns; - int now_s; - int next_s; + time_t now_s; + time_t next_s; void *future2[4]; }; From 1b24f625ea4ee77f3c4796ec2233d059f8c7977e Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 3 Feb 2021 20:16:06 +0000 Subject: [PATCH 39/51] Give compile time warning for libwebsockets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If it is compiled without external poll support. Closes #2060. Thanks to Yannic Schröder. --- ChangeLog.txt | 2 ++ src/mosquitto_broker_internal.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index db224ae5..214974b0 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,8 @@ Broker: because plugins should never be allocating their own instance of this struct, and currently none of the struct members are used for anything, so a plugin should not be accessing them. +- Give compile time warning if libwebsockets compiled without external poll + support. Closes #2060. Clients: - Fix possible loss of data in `mosquitto_pub -l` when sending multiple long diff --git a/src/mosquitto_broker_internal.h b/src/mosquitto_broker_internal.h index 5b88710f..894e7500 100644 --- a/src/mosquitto_broker_internal.h +++ b/src/mosquitto_broker_internal.h @@ -25,6 +25,9 @@ Contributors: #ifdef WITH_WEBSOCKETS # include +# if LWS_LIBRARY_VERSION_NUMBER >= 3002000 && !defined(LWS_WITH_EXTERNAL_POLL) +# warning "libwebsockets is not compiled with LWS_WITH_EXTERNAL_POLL support. Websocket performance will be unusable." +# endif #endif #include "mosquitto_internal.h" From 9b08faf0bdaf5a4f2e6e3dd1ea7e8c57f70418d6 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 9 Feb 2021 14:09:53 +0000 Subject: [PATCH 40/51] Fix mosquitto_{pub|sub}_topic_check() function returns. The would not return MOSQ_ERR_INVAL on topic == NULL. --- ChangeLog.txt | 5 +++++ lib/util_topic.c | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 214974b0..33457bbd 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -8,10 +8,15 @@ Broker: - Give compile time warning if libwebsockets compiled without external poll support. Closes #2060. +Client library: +- Fix mosquitto_{pub|sub}_topic_check() functions not returning MOSQ_ERR_INVAL + on topic == NULL. + Clients: - Fix possible loss of data in `mosquitto_pub -l` when sending multiple long lines. Closes #2078. + 2.0.7 - 2021-02-04 ================== diff --git a/lib/util_topic.c b/lib/util_topic.c index fc24f0d1..62b53112 100644 --- a/lib/util_topic.c +++ b/lib/util_topic.c @@ -54,6 +54,11 @@ int mosquitto_pub_topic_check(const char *str) #ifdef WITH_BROKER int hier_count = 0; #endif + + if(str == NULL){ + return MOSQ_ERR_INVAL; + } + while(str && str[0]){ if(str[0] == '+' || str[0] == '#'){ return MOSQ_ERR_INVAL; @@ -81,7 +86,9 @@ int mosquitto_pub_topic_check2(const char *str, size_t len) int hier_count = 0; #endif - if(len > 65535) return MOSQ_ERR_INVAL; + if(str == NULL || len > 65535){ + return MOSQ_ERR_INVAL; + } for(i=0; i 65535) return MOSQ_ERR_INVAL; + if(str == NULL || len > 65535){ + return MOSQ_ERR_INVAL; + } for(i=0; i Date: Thu, 25 Feb 2021 13:51:27 +0000 Subject: [PATCH 41/51] Allow Docker images to run with anon, without a config file. Provide a mechanism for Docker users to run a broker that doesn't use authentication, without having to provide their own configuration file. Closes #2040. --- ChangeLog.txt | 5 +++ docker/2.0-openssl/Dockerfile | 2 +- docker/2.0-openssl/README.md | 42 ++++++++++++++++++++++- docker/2.0-openssl/docker-entrypoint.sh | 9 ++++- docker/2.0-openssl/mosquitto-no-auth.conf | 5 +++ docker/2.0/Dockerfile | 2 +- docker/2.0/README.md | 42 ++++++++++++++++++++++- docker/2.0/docker-entrypoint.sh | 9 ++++- docker/2.0/mosquitto-no-auth.conf | 5 +++ 9 files changed, 115 insertions(+), 6 deletions(-) create mode 100644 docker/2.0-openssl/mosquitto-no-auth.conf create mode 100644 docker/2.0/mosquitto-no-auth.conf diff --git a/ChangeLog.txt b/ChangeLog.txt index 33457bbd..9ef5b707 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -16,6 +16,11 @@ Clients: - Fix possible loss of data in `mosquitto_pub -l` when sending multiple long lines. Closes #2078. +Build: +- Provide a mechanism for Docker users to run a broker that doesn't use + authentication, without having to provide their own configuration file. + Closes #2040. + 2.0.7 - 2021-02-04 ================== diff --git a/docker/2.0-openssl/Dockerfile b/docker/2.0-openssl/Dockerfile index 6147ba55..ff7892d0 100644 --- a/docker/2.0-openssl/Dockerfile +++ b/docker/2.0-openssl/Dockerfile @@ -106,7 +106,7 @@ RUN set -x && \ VOLUME ["/mosquitto/data", "/mosquitto/log"] # Set up the entry point script and default command -COPY docker-entrypoint.sh / +COPY docker-entrypoint.sh mosquitto-no-auth.conf / EXPOSE 1883 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["/usr/sbin/mosquitto", "-c", "/mosquitto/config/mosquitto.conf"] diff --git a/docker/2.0-openssl/README.md b/docker/2.0-openssl/README.md index 8a54a86b..cb112131 100644 --- a/docker/2.0-openssl/README.md +++ b/docker/2.0-openssl/README.md @@ -18,13 +18,53 @@ Two docker volumes have been created in the image to be used for persistent stor The image runs mosquitto under the mosquitto user and group, which are created with a uid and gid of 1883. +## Running without a configuration file +Mosquitto 2.0 requires you to configure listeners and authentication before it +will allow connections from anything other than the loopback interface. In the +context of a container, this means you would normally need to provide a +configuration file with your settings. + +If you wish to run mosquitto without any authentication, and without setting +any other configuration options, you can do so by setting an environment +variable when creating the container: `NO_AUTHENTICATION=1`. Doing this will +ignore any configuration file you provide. + +``` +docker run -it -p 1883:1883 -e NO_AUTHENTICATION=1 eclipse-mosquitto: +``` + ## Configuration -When creating a container from the image, the default configuration values are used. To use a custom configuration file, mount a **local** configuration file to `/mosquitto/config/mosquitto.conf` + ``` docker run -it -p 1883:1883 -v :/mosquitto/config/mosquitto.conf eclipse-mosquitto: ``` +Your configuration file must include a `listener`, and you must configure some +form of authentication or allow unauthenticated access. If you do not do this, +clients will be unable to connect. + + +File based authentication and authorisation: +``` +listener 1883 +password_file /mosquitto/data/mosquitto.password_file +acl_file /mosquitto/data/mosquitto.aclfile +``` + +Plugin based authentication and authorisation: +``` +listener 1883 +plugin /usr/lib/mosquitto_dynamic_security.so +plugin_opt_config_file /mosquitto/data/mosquitto-dynsec.json +``` + +Unauthenticated access: +``` +listener 1883 +allow_anonymous true +``` + :boom: if the mosquitto configuration (mosquitto.conf) was modified to use non-default ports, the docker run command will need to be updated to expose the ports that have been configured, for example: diff --git a/docker/2.0-openssl/docker-entrypoint.sh b/docker/2.0-openssl/docker-entrypoint.sh index 583f67c9..4177b451 100755 --- a/docker/2.0-openssl/docker-entrypoint.sh +++ b/docker/2.0-openssl/docker-entrypoint.sh @@ -7,4 +7,11 @@ if [ "$user" = '0' ]; then [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true fi -exec "$@" +if [ "$NO_AUTHENTICATION" = "1" ] && [ "$*" = '/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf' ]; then + # The user wants to run Mosquitto with no authentication, but without + # providing a configuration file. Use the pre-provided file for this. + exec /usr/sbin/mosquitto -c /mosquitto-no-auth.conf +else + # Execute whatever command is requested + exec "$@" +fi diff --git a/docker/2.0-openssl/mosquitto-no-auth.conf b/docker/2.0-openssl/mosquitto-no-auth.conf new file mode 100644 index 00000000..40dd92b9 --- /dev/null +++ b/docker/2.0-openssl/mosquitto-no-auth.conf @@ -0,0 +1,5 @@ +# This is a Mosquitto configuration file that creates a listener on port 1883 +# that allows unauthenticated access. + +listener 1883 +allow_anonymous true diff --git a/docker/2.0/Dockerfile b/docker/2.0/Dockerfile index 56723a17..df43d3b2 100644 --- a/docker/2.0/Dockerfile +++ b/docker/2.0/Dockerfile @@ -108,7 +108,7 @@ RUN set -x && \ VOLUME ["/mosquitto/data", "/mosquitto/log"] # Set up the entry point script and default command -COPY docker-entrypoint.sh / +COPY docker-entrypoint.sh mosquitto-no-auth.conf / EXPOSE 1883 ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["/usr/sbin/mosquitto", "-c", "/mosquitto/config/mosquitto.conf"] diff --git a/docker/2.0/README.md b/docker/2.0/README.md index 8a54a86b..cb112131 100644 --- a/docker/2.0/README.md +++ b/docker/2.0/README.md @@ -18,13 +18,53 @@ Two docker volumes have been created in the image to be used for persistent stor The image runs mosquitto under the mosquitto user and group, which are created with a uid and gid of 1883. +## Running without a configuration file +Mosquitto 2.0 requires you to configure listeners and authentication before it +will allow connections from anything other than the loopback interface. In the +context of a container, this means you would normally need to provide a +configuration file with your settings. + +If you wish to run mosquitto without any authentication, and without setting +any other configuration options, you can do so by setting an environment +variable when creating the container: `NO_AUTHENTICATION=1`. Doing this will +ignore any configuration file you provide. + +``` +docker run -it -p 1883:1883 -e NO_AUTHENTICATION=1 eclipse-mosquitto: +``` + ## Configuration -When creating a container from the image, the default configuration values are used. To use a custom configuration file, mount a **local** configuration file to `/mosquitto/config/mosquitto.conf` + ``` docker run -it -p 1883:1883 -v :/mosquitto/config/mosquitto.conf eclipse-mosquitto: ``` +Your configuration file must include a `listener`, and you must configure some +form of authentication or allow unauthenticated access. If you do not do this, +clients will be unable to connect. + + +File based authentication and authorisation: +``` +listener 1883 +password_file /mosquitto/data/mosquitto.password_file +acl_file /mosquitto/data/mosquitto.aclfile +``` + +Plugin based authentication and authorisation: +``` +listener 1883 +plugin /usr/lib/mosquitto_dynamic_security.so +plugin_opt_config_file /mosquitto/data/mosquitto-dynsec.json +``` + +Unauthenticated access: +``` +listener 1883 +allow_anonymous true +``` + :boom: if the mosquitto configuration (mosquitto.conf) was modified to use non-default ports, the docker run command will need to be updated to expose the ports that have been configured, for example: diff --git a/docker/2.0/docker-entrypoint.sh b/docker/2.0/docker-entrypoint.sh index 583f67c9..4177b451 100755 --- a/docker/2.0/docker-entrypoint.sh +++ b/docker/2.0/docker-entrypoint.sh @@ -7,4 +7,11 @@ if [ "$user" = '0' ]; then [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true fi -exec "$@" +if [ "$NO_AUTHENTICATION" = "1" ] && [ "$*" = '/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf' ]; then + # The user wants to run Mosquitto with no authentication, but without + # providing a configuration file. Use the pre-provided file for this. + exec /usr/sbin/mosquitto -c /mosquitto-no-auth.conf +else + # Execute whatever command is requested + exec "$@" +fi diff --git a/docker/2.0/mosquitto-no-auth.conf b/docker/2.0/mosquitto-no-auth.conf new file mode 100644 index 00000000..40dd92b9 --- /dev/null +++ b/docker/2.0/mosquitto-no-auth.conf @@ -0,0 +1,5 @@ +# This is a Mosquitto configuration file that creates a listener on port 1883 +# that allows unauthenticated access. + +listener 1883 +allow_anonymous true From 2190e98b20720cfe2aef83c1dba84609b8b95d26 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 25 Feb 2021 17:04:15 +0000 Subject: [PATCH 42/51] Fix memory tracking not being available on FreeBSD or macOS. Closes #2096. Thanks to blusewang. --- ChangeLog.txt | 1 + lib/memory_mosq.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 9ef5b707..247b112b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,7 @@ Broker: plugin should not be accessing them. - Give compile time warning if libwebsockets compiled without external poll support. Closes #2060. +- Fix memory tracking not being available on FreeBSD or macOS. Closes #2096. Client library: - Fix mosquitto_{pub|sub}_topic_check() functions not returning MOSQ_ERR_INVAL diff --git a/lib/memory_mosq.h b/lib/memory_mosq.h index da149913..48fadf8c 100644 --- a/lib/memory_mosq.h +++ b/lib/memory_mosq.h @@ -22,8 +22,10 @@ Contributors: #include #include -#if defined(WITH_MEMORY_TRACKING) && defined(WITH_BROKER) && defined(__GLIBC__) -#define REAL_WITH_MEMORY_TRACKING +#if defined(WITH_MEMORY_TRACKING) && defined(WITH_BROKER) +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__GLIBC__) +# define REAL_WITH_MEMORY_TRACKING +# endif #endif void *mosquitto__calloc(size_t nmemb, size_t size); From 465ee546c458f0a7d0032d93ad1c2ba1a31cdd6b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 25 Feb 2021 17:13:56 +0000 Subject: [PATCH 43/51] Update comment. --- ChangeLog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 247b112b..93f0ff23 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,7 +4,8 @@ Broker: of the struct. This is an ABI break, but is considered to be acceptable because plugins should never be allocating their own instance of this struct, and currently none of the struct members are used for anything, so a - plugin should not be accessing them. + plugin should not be accessing them. It would also be safe to read/write + from the existing struct parameters. - Give compile time warning if libwebsockets compiled without external poll support. Closes #2060. - Fix memory tracking not being available on FreeBSD or macOS. Closes #2096. From cec9d364451da6fd106c68da9ff45add05dcbcaf Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 25 Feb 2021 17:23:24 +0000 Subject: [PATCH 44/51] Bump version and web pages. --- CMakeLists.txt | 2 +- ChangeLog.txt | 3 ++ config.mk | 2 +- include/mosquitto.h | 2 +- installer/mosquitto.nsi | 2 +- installer/mosquitto64.nsi | 2 +- set-version.sh | 2 +- snap/snapcraft.yaml | 2 +- www/pages/download.md | 8 ++-- www/posts/2021/02/version-2-0-8-released.md | 42 +++++++++++++++++++++ 10 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 www/posts/2021/02/version-2-0-8-released.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a08b325..489105df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.0) cmake_policy(SET CMP0042 NEW) project(mosquitto) -set (VERSION 2.0.7) +set (VERSION 2.0.8) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") diff --git a/ChangeLog.txt b/ChangeLog.txt index 93f0ff23..a83937e2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,6 @@ +2.0.8 - 2021-02-25 +================== + Broker: - Fix incorrect datatypes in `struct mosquitto_evt_tick`. This changes the size and offset of two of the members of this struct, and changes the size diff --git a/config.mk b/config.mk index e8c577ba..73e5cc39 100644 --- a/config.mk +++ b/config.mk @@ -127,7 +127,7 @@ WITH_XTREPORT=no # Also bump lib/mosquitto.h, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto64.nsi -VERSION=2.0.7 +VERSION=2.0.8 # Client library SO version. Bump if incompatible API/ABI changes are made. SOVERSION=1 diff --git a/include/mosquitto.h b/include/mosquitto.h index 386c9da1..3e304836 100644 --- a/include/mosquitto.h +++ b/include/mosquitto.h @@ -66,7 +66,7 @@ extern "C" { #define LIBMOSQUITTO_MAJOR 2 #define LIBMOSQUITTO_MINOR 0 -#define LIBMOSQUITTO_REVISION 7 +#define LIBMOSQUITTO_REVISION 8 /* 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) diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index ad3ee454..e34c7847 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -9,7 +9,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "Eclipse Mosquitto" -!define VERSION 2.0.7 +!define VERSION 2.0.8 OutFile "mosquitto-${VERSION}-install-windows-x86.exe" InstallDir "$PROGRAMFILES\mosquitto" diff --git a/installer/mosquitto64.nsi b/installer/mosquitto64.nsi index b88b656d..4bd80f54 100644 --- a/installer/mosquitto64.nsi +++ b/installer/mosquitto64.nsi @@ -9,7 +9,7 @@ !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' Name "Eclipse Mosquitto" -!define VERSION 2.0.7 +!define VERSION 2.0.8 OutFile "mosquitto-${VERSION}-install-windows-x64.exe" !include "x64.nsh" diff --git a/set-version.sh b/set-version.sh index bf1a1cf9..a96b6a77 100755 --- a/set-version.sh +++ b/set-version.sh @@ -2,7 +2,7 @@ MAJOR=2 MINOR=0 -REVISION=7 +REVISION=8 sed -i "s/^VERSION=.*/VERSION=${MAJOR}.${MINOR}.${REVISION}/" config.mk diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 063a71de..0099409a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: mosquitto -version: 2.0.7 +version: 2.0.8 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. diff --git a/www/pages/download.md b/www/pages/download.md index 290ba6b2..0d16e248 100644 --- a/www/pages/download.md +++ b/www/pages/download.md @@ -1,7 +1,7 @@ + +Version 2.0.8 of Mosquitto has been released. This is a bugfix release. + +# Broker +- Fix incorrect datatypes in `struct mosquitto_evt_tick`. This changes the + size and offset of two of the members of this struct, and changes the size + of the struct. This is an ABI break, but is considered to be acceptable + because plugins should never be allocating their own instance of this + struct, and currently none of the struct members are used for anything, so a + plugin should not be accessing them. It would also be safe to read/write + from the existing struct parameters. +- Give compile time warning if libwebsockets compiled without external poll + support. Closes [#2060]. +- Fix memory tracking not being available on FreeBSD or macOS. Closes [#2096]. + +# Client library +- Fix `mosquitto_{pub|sub}_topic_check()` functions not returning `MOSQ_ERR_INVAL` + on topic == NULL. + +# Clients +- Fix possible loss of data in `mosquitto_pub -l` when sending multiple long + lines. Closes [#2078]. + +# Build +- Provide a mechanism for Docker users to run a broker that doesn't use + authentication, without having to provide their own configuration file. + Closes [#2040]. + +[#2040]: https://github.com/eclipse/mosquitto/issues/2040 +[#2060]: https://github.com/eclipse/mosquitto/issues/2060 +[#2078]: https://github.com/eclipse/mosquitto/issues/2078 +[#2096]: https://github.com/eclipse/mosquitto/issues/2096 From 1103c83268fc89cdfd79865b5250c51944bc4c2b Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 25 Feb 2021 17:37:03 +0000 Subject: [PATCH 45/51] Bump docker builds. --- docker/2.0-openssl/Dockerfile | 4 ++-- docker/2.0/Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/2.0-openssl/Dockerfile b/docker/2.0-openssl/Dockerfile index ff7892d0..85e0ee2c 100644 --- a/docker/2.0-openssl/Dockerfile +++ b/docker/2.0-openssl/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=2.0.7 \ - DOWNLOAD_SHA256=a98054f0b8161588975ef24e1d467550d3935f4c16ccee63ecb623248a28356e \ +ENV VERSION=2.0.8 \ + DOWNLOAD_SHA256=b15da8fc4edcb91d554e1259e220ea0173ef639ceaa4b465e06feb7e125b84bf \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=2.4.2 \ LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \ diff --git a/docker/2.0/Dockerfile b/docker/2.0/Dockerfile index df43d3b2..1111687b 100644 --- a/docker/2.0/Dockerfile +++ b/docker/2.0/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.12 LABEL maintainer="Roger Light " \ description="Eclipse Mosquitto MQTT Broker" -ENV VERSION=2.0.7 \ - DOWNLOAD_SHA256=a98054f0b8161588975ef24e1d467550d3935f4c16ccee63ecb623248a28356e \ +ENV VERSION=2.0.8 \ + DOWNLOAD_SHA256=b15da8fc4edcb91d554e1259e220ea0173ef639ceaa4b465e06feb7e125b84bf \ GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \ LWS_VERSION=2.4.2 \ LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \ From 5c45bc4e8407d94d29b39152b580d2b4cc8082e9 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 3 Mar 2021 17:14:16 +0000 Subject: [PATCH 46/51] Improve Docker no-auth mode. Remove use of environment variable, instruct users to run a specific command instead. --- docker/2.0-openssl/README.md | 8 +++----- docker/2.0-openssl/docker-entrypoint.sh | 9 +-------- docker/2.0/README.md | 8 +++----- docker/2.0/docker-entrypoint.sh | 9 +-------- 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/docker/2.0-openssl/README.md b/docker/2.0-openssl/README.md index cb112131..8ec812ed 100644 --- a/docker/2.0-openssl/README.md +++ b/docker/2.0-openssl/README.md @@ -25,12 +25,10 @@ context of a container, this means you would normally need to provide a configuration file with your settings. If you wish to run mosquitto without any authentication, and without setting -any other configuration options, you can do so by setting an environment -variable when creating the container: `NO_AUTHENTICATION=1`. Doing this will -ignore any configuration file you provide. - +any other configuration options, you can do so by using a configuration +provided in the container for this purpose: ``` -docker run -it -p 1883:1883 -e NO_AUTHENTICATION=1 eclipse-mosquitto: +docker run -it -p 1883:1883 eclipse-mosquitto: mosquitto -c /mosquitto-no-auth.conf ``` ## Configuration diff --git a/docker/2.0-openssl/docker-entrypoint.sh b/docker/2.0-openssl/docker-entrypoint.sh index 4177b451..583f67c9 100755 --- a/docker/2.0-openssl/docker-entrypoint.sh +++ b/docker/2.0-openssl/docker-entrypoint.sh @@ -7,11 +7,4 @@ if [ "$user" = '0' ]; then [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true fi -if [ "$NO_AUTHENTICATION" = "1" ] && [ "$*" = '/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf' ]; then - # The user wants to run Mosquitto with no authentication, but without - # providing a configuration file. Use the pre-provided file for this. - exec /usr/sbin/mosquitto -c /mosquitto-no-auth.conf -else - # Execute whatever command is requested - exec "$@" -fi +exec "$@" diff --git a/docker/2.0/README.md b/docker/2.0/README.md index cb112131..8ec812ed 100644 --- a/docker/2.0/README.md +++ b/docker/2.0/README.md @@ -25,12 +25,10 @@ context of a container, this means you would normally need to provide a configuration file with your settings. If you wish to run mosquitto without any authentication, and without setting -any other configuration options, you can do so by setting an environment -variable when creating the container: `NO_AUTHENTICATION=1`. Doing this will -ignore any configuration file you provide. - +any other configuration options, you can do so by using a configuration +provided in the container for this purpose: ``` -docker run -it -p 1883:1883 -e NO_AUTHENTICATION=1 eclipse-mosquitto: +docker run -it -p 1883:1883 eclipse-mosquitto: mosquitto -c /mosquitto-no-auth.conf ``` ## Configuration diff --git a/docker/2.0/docker-entrypoint.sh b/docker/2.0/docker-entrypoint.sh index 4177b451..583f67c9 100755 --- a/docker/2.0/docker-entrypoint.sh +++ b/docker/2.0/docker-entrypoint.sh @@ -7,11 +7,4 @@ if [ "$user" = '0' ]; then [ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true fi -if [ "$NO_AUTHENTICATION" = "1" ] && [ "$*" = '/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf' ]; then - # The user wants to run Mosquitto with no authentication, but without - # providing a configuration file. Use the pre-provided file for this. - exec /usr/sbin/mosquitto -c /mosquitto-no-auth.conf -else - # Execute whatever command is requested - exec "$@" -fi +exec "$@" From 64f697d55da1d02cd40d43e5349c83aeae681f41 Mon Sep 17 00:00:00 2001 From: Roger Light Date: Wed, 3 Mar 2021 22:21:24 +0000 Subject: [PATCH 47/51] Fix `tls_version` behaviour not matching documentation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was setting the exact TLS version to use, not the minimium TLS version to use. Closes #2110. Thanks to Petter Jönsson. --- ChangeLog.txt | 8 ++++++++ src/net.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index a83937e2..73b29b75 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,11 @@ +2.0.9 - 2021-03-xx +================== + +Broker: +- Fix `tls_version` behaviour not matching documentation. It was setting the + exact TLS version to use, not the minimium TLS version to use. Closes #2110. + + 2.0.8 - 2021-02-25 ================== diff --git a/src/net.c b/src/net.c index dcc9db36..2c7b0cf8 100644 --- a/src/net.c +++ b/src/net.c @@ -335,14 +335,14 @@ int net__tls_server_ctx(struct mosquitto__listener *listener) }else if(!strcmp(listener->tls_version, "tlsv1.3")){ SSL_CTX_set_options(listener->ssl_ctx, SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2); }else if(!strcmp(listener->tls_version, "tlsv1.2")){ - SSL_CTX_set_options(listener->ssl_ctx, SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_3); + SSL_CTX_set_options(listener->ssl_ctx, SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1); }else if(!strcmp(listener->tls_version, "tlsv1.1")){ - SSL_CTX_set_options(listener->ssl_ctx, SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_2 | SSL_OP_NO_TLSv1_3); + SSL_CTX_set_options(listener->ssl_ctx, SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1); #else }else if(!strcmp(listener->tls_version, "tlsv1.2")){ SSL_CTX_set_options(listener->ssl_ctx, SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1); }else if(!strcmp(listener->tls_version, "tlsv1.1")){ - SSL_CTX_set_options(listener->ssl_ctx, SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_2); + SSL_CTX_set_options(listener->ssl_ctx, SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1); #endif }else{ log__printf(NULL, MOSQ_LOG_ERR, "Error: Unsupported tls_version \"%s\".", listener->tls_version); From 83334afee8d271c54b4f94bc93eaa0f252b237aa Mon Sep 17 00:00:00 2001 From: Roger Light Date: Wed, 3 Mar 2021 22:44:50 +0000 Subject: [PATCH 48/51] Remove redunant function delaration. --- include/mosquitto.h | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/include/mosquitto.h b/include/mosquitto.h index 3e304836..587888a6 100644 --- a/include/mosquitto.h +++ b/include/mosquitto.h @@ -1604,40 +1604,6 @@ libmosq_EXPORT int mosquitto_string_option(struct mosquitto *mosq, enum mosq_opt */ 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 . - * MOSQ_OPT_TLS_KEYFORM - * Configure the client to treat the keyfile differently depending - * on its type. Must be set before . - * 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 . - * 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 * From 7baca428da1822c0ece3ba526ef8065c49c7dfa7 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 4 Mar 2021 09:49:29 +0000 Subject: [PATCH 49/51] Remove obsolete tests. --- test/broker/03-publish-b2c-timeout-qos1.py | 71 ------------------- test/broker/03-publish-b2c-timeout-qos2.py | 81 ---------------------- test/broker/03-publish-c2b-timeout-qos2.py | 52 -------------- 3 files changed, 204 deletions(-) delete mode 100755 test/broker/03-publish-b2c-timeout-qos1.py delete mode 100755 test/broker/03-publish-b2c-timeout-qos2.py delete mode 100755 test/broker/03-publish-c2b-timeout-qos2.py diff --git a/test/broker/03-publish-b2c-timeout-qos1.py b/test/broker/03-publish-b2c-timeout-qos1.py deleted file mode 100755 index a30d1af8..00000000 --- a/test/broker/03-publish-b2c-timeout-qos1.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python3 - -# Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet. - -from mosq_test_helper import * - - -def helper(port): - connect_packet = mosq_test.gen_connect("test-helper", keepalive=60) - connack_packet = mosq_test.gen_connack(rc=0) - - mid = 128 - publish_packet = mosq_test.gen_publish("qos1/timeout/test", qos=1, mid=mid, payload="timeout-message") - puback_packet = mosq_test.gen_puback(mid) - - sock = mosq_test.do_client_connect(connect_packet, connack_packet, connack_error="helper connack") - mosq_test.do_send_receive(sock, publish_packet, puback_packet, "helper puback") - sock.close() - - -def do_test(proto_ver): - rc = 1 - mid = 3265 - keepalive = 60 - connect_packet = mosq_test.gen_connect("pub-qos1-timeout-test", keepalive=keepalive, proto_ver=proto_ver) - connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) - - subscribe_packet = mosq_test.gen_subscribe(mid, "qos1/timeout/test", 1, proto_ver=proto_ver) - suback_packet = mosq_test.gen_suback(mid, 1, proto_ver=proto_ver) - - mid = 1 - publish_packet = mosq_test.gen_publish("qos1/timeout/test", qos=1, mid=mid, payload="timeout-message", proto_ver=proto_ver) - publish_dup_packet = mosq_test.gen_publish("qos1/timeout/test", qos=1, mid=mid, payload="timeout-message", dup=True, proto_ver=proto_ver) - puback_packet = mosq_test.gen_puback(mid, proto_ver=proto_ver) - - port = mosq_test.get_port() - broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) - - try: - sock = mosq_test.do_client_connect(connect_packet, connack_packet) - mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") - - helper(port) - # Should have now received a publish command - - mosq_test.expect_packet(sock, "publish", publish_packet) - # Wait for longer than 5 seconds to get republish with dup set - # This is covered by the 8 second timeout - - mosq_test.expect_packet(sock, "dup publish", publish_dup_packet) - sock.send(puback_packet) - rc = 0 - - sock.close() - except mosq_test.TestError: - pass - finally: - broker.terminate() - broker.wait() - (stdo, stde) = broker.communicate() - if rc: - print(stde.decode('utf-8')) - print("proto_ver=%d" % (proto_ver)) - exit(rc) - - -do_test(proto_ver=4) -do_test(proto_ver=5) - -exit(0) - diff --git a/test/broker/03-publish-b2c-timeout-qos2.py b/test/broker/03-publish-b2c-timeout-qos2.py deleted file mode 100755 index 6b80bf18..00000000 --- a/test/broker/03-publish-b2c-timeout-qos2.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python3 - -# Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet. - -from mosq_test_helper import * - - -def helper(port): - connect_packet = mosq_test.gen_connect("test-helper", keepalive=60) - connack_packet = mosq_test.gen_connack(rc=0) - - mid = 312 - publish_packet = mosq_test.gen_publish("qos2/timeout/test", qos=2, mid=mid, payload="timeout-message") - pubrec_packet = mosq_test.gen_pubrec(mid) - pubrel_packet = mosq_test.gen_pubrel(mid) - pubcomp_packet = mosq_test.gen_pubcomp(mid) - - sock = mosq_test.do_client_connect(connect_packet, connack_packet, connack_error="helper connack") - mosq_test.do_send_receive(sock, publish_packet, pubrec_packet, "helper pubrec") - mosq_test.do_send_receive(sock, pubrel_packet, pubcomp_packet, "helper pubcomp") - sock.close() - - -def do_test(proto_ver): - rc = 1 - mid = 3265 - keepalive = 60 - connect_packet = mosq_test.gen_connect("pub-qo2-timeout-test", keepalive=keepalive, proto_ver=proto_ver) - connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) - - subscribe_packet = mosq_test.gen_subscribe(mid, "qos2/timeout/test", 2, proto_ver=proto_ver) - suback_packet = mosq_test.gen_suback(mid, 2, proto_ver=proto_ver) - - mid = 1 - publish_packet = mosq_test.gen_publish("qos2/timeout/test", qos=2, mid=mid, payload="timeout-message", proto_ver=proto_ver) - publish_dup_packet = mosq_test.gen_publish("qos2/timeout/test", qos=2, mid=mid, payload="timeout-message", dup=True, proto_ver=proto_ver) - pubrec_packet = mosq_test.gen_pubrec(mid, proto_ver=proto_ver) - pubrel_packet = mosq_test.gen_pubrel(mid, proto_ver=proto_ver) - pubcomp_packet = mosq_test.gen_pubcomp(mid, proto_ver=proto_ver) - - port = mosq_test.get_port() - broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) - - try: - sock = mosq_test.do_client_connect(connect_packet, connack_packet) - mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") - - helper(port) - # Should have now received a publish command - - mosq_test.expect_packet(sock, "publish", publish_packet) - # Wait for longer than 5 seconds to get republish with dup set - # This is covered by the 8 second timeout - - mosq_test.expect_packet(sock, "dup publish", publish_dup_packet) - mosq_test.do_send_receive(sock, pubrec_packet, pubrel_packet, "pubrel") - - # Wait for longer than 5 seconds to get republish with dup set - # This is covered by the 8 second timeout - - mosq_test.expect_packet(sock, "dup pubrel", pubrel_packet) - sock.send(pubcomp_packet) - rc = 0 - - sock.close() - except mosq_test.TestError: - pass - finally: - broker.terminate() - broker.wait() - (stdo, stde) = broker.communicate() - if rc: - print(stde.decode('utf-8')) - print("proto_ver=%d" % (proto_ver)) - exit(rc) - - -do_test(proto_ver=4) -do_test(proto_ver=5) -exit(0) - diff --git a/test/broker/03-publish-c2b-timeout-qos2.py b/test/broker/03-publish-c2b-timeout-qos2.py deleted file mode 100755 index 54538fe2..00000000 --- a/test/broker/03-publish-c2b-timeout-qos2.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 - -# Test whether a PUBLISH to a topic with QoS 2 results in the correct packet -# flow. This test introduces delays into the flow in order to force the broker -# to send duplicate PUBREC and PUBCOMP messages. - -from mosq_test_helper import * - - -def do_test(port): - rc = 1 - keepalive = 600 - connect_packet = mosq_test.gen_connect("pub-qos2-timeout-test", keepalive=keepalive, proto_ver=proto_ver) - connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) - - mid = 1926 - publish_packet = mosq_test.gen_publish("pub/qos2/test", qos=2, mid=mid, payload="timeout-message", proto_ver=proto_ver) - pubrec_packet = mosq_test.gen_pubrec(mid, proto_ver=proto_ver) - pubrel_packet = mosq_test.gen_pubrel(mid, proto_ver=proto_ver) - pubcomp_packet = mosq_test.gen_pubcomp(mid, proto_ver=proto_ver) - - port = mosq_test.get_port() - broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) - - try: - sock = mosq_test.do_client_connect(connect_packet, connack_packet) - mosq_test.do_send_receive(sock, publish_packet, pubrec_packet, "pubrec") - - # Timeout is 8 seconds which means the broker should repeat the PUBREC. - - mosq_test.expect_packet(sock, "pubrec", pubrec_packet) - mosq_test.do_send_receive(sock, pubrel_packet, pubcomp_packet, "pubcomp") - - rc = 0 - - sock.close() - except mosq_test.TestError: - pass - finally: - broker.terminate() - broker.wait() - (stdo, stde) = broker.communicate() - if rc: - print(stde.decode('utf-8')) - print("proto_ver=%d" % (proto_ver)) - exit(rc) - - -do_test(proto_ver=4) -do_test(proto_ver=5) -exit(0) - From f89a3c3fc081728f5ccaa74b3e4d447d3706c6f1 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 6 Mar 2021 00:57:37 +0000 Subject: [PATCH 50/51] Fix messages to `$` prefixed topics being rejected. Closes #2111. Thanks to yellowgg2. --- ChangeLog.txt | 1 + src/retain.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 73b29b75..ffc5f40e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,7 @@ Broker: - Fix `tls_version` behaviour not matching documentation. It was setting the exact TLS version to use, not the minimium TLS version to use. Closes #2110. +- Fix messages to `$` prefixed topics being rejected. Closes #2111. 2.0.8 - 2021-02-25 diff --git a/src/retain.c b/src/retain.c index ca9e7313..ee8ad609 100644 --- a/src/retain.c +++ b/src/retain.c @@ -83,7 +83,10 @@ int retain__store(const char *topic, struct mosquitto_msg_store *stored, char ** assert(split_topics); HASH_FIND(hh, db.retains, split_topics[0], strlen(split_topics[0]), retainhier); - if(retainhier == NULL) return MOSQ_ERR_NOT_FOUND; + if(retainhier == NULL){ + retainhier = retain__add_hier_entry(NULL, &db.retains, split_topics[0], (uint16_t)strlen(split_topics[0])); + if(!retainhier) return MOSQ_ERR_NOMEM; + } for(i=0; split_topics[i] != NULL; i++){ slen = strlen(split_topics[i]); From e401def06dd68ce70c101eac5c3e051a3ea72392 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 8 Mar 2021 23:23:45 +0000 Subject: [PATCH 51/51] Fix QoS 0 messages not being delivered when max_queued_bytes was configured. Closes #2123. Thanks to quackgizmo. --- ChangeLog.txt | 2 + lib/mosquitto_internal.h | 4 +- src/database.c | 6 +-- test/broker/02-subpub-qos0-queued-bytes.py | 61 ++++++++++++++++++++++ test/broker/Makefile | 1 + test/broker/test.py | 1 + 6 files changed, 70 insertions(+), 5 deletions(-) create mode 100755 test/broker/02-subpub-qos0-queued-bytes.py diff --git a/ChangeLog.txt b/ChangeLog.txt index ffc5f40e..ee2fd96b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,8 @@ Broker: - Fix `tls_version` behaviour not matching documentation. It was setting the exact TLS version to use, not the minimium TLS version to use. Closes #2110. - Fix messages to `$` prefixed topics being rejected. Closes #2111. +- Fix QoS 0 messages not being delivered when max_queued_bytes was configured. + Closes #2123. 2.0.8 - 2021-02-25 diff --git a/lib/mosquitto_internal.h b/lib/mosquitto_internal.h index 04bdf92a..02008af1 100644 --- a/lib/mosquitto_internal.h +++ b/lib/mosquitto_internal.h @@ -190,8 +190,8 @@ struct mosquitto_msg_data{ #ifdef WITH_BROKER struct mosquitto_client_msg *inflight; struct mosquitto_client_msg *queued; - unsigned long msg_bytes; - unsigned long msg_bytes12; + long msg_bytes; + long msg_bytes12; int msg_count; int msg_count12; #else diff --git a/src/database.c b/src/database.c index db18b9f1..77eb4520 100644 --- a/src/database.c +++ b/src/database.c @@ -53,7 +53,7 @@ bool db__ready_for_flight(struct mosquitto_msg_data *msgs, int qos) if(db.config->max_queued_messages == 0 && db.config->max_inflight_bytes == 0){ return true; } - valid_bytes = msgs->msg_bytes - db.config->max_inflight_bytes < db.config->max_queued_bytes; + valid_bytes = ((msgs->msg_bytes - (ssize_t)db.config->max_inflight_bytes) < (ssize_t)db.config->max_queued_bytes); valid_count = msgs->msg_count - msgs->inflight_maximum < db.config->max_queued_messages; if(db.config->max_queued_messages == 0){ @@ -90,8 +90,8 @@ bool db__ready_for_queue(struct mosquitto *context, int qos, struct mosquitto_ms { int source_count; int adjust_count; - size_t source_bytes; - size_t adjust_bytes = db.config->max_inflight_bytes; + long source_bytes; + ssize_t adjust_bytes = (ssize_t)db.config->max_inflight_bytes; bool valid_bytes; bool valid_count; diff --git a/test/broker/02-subpub-qos0-queued-bytes.py b/test/broker/02-subpub-qos0-queued-bytes.py new file mode 100755 index 00000000..7ca08e80 --- /dev/null +++ b/test/broker/02-subpub-qos0-queued-bytes.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 + +from mosq_test_helper import * + +def write_config(filename, port): + with open(filename, 'w') as f: + f.write("listener %d\n" % (port)) + f.write("allow_anonymous true\n") + f.write("max_inflight_messages 20\n") + f.write("max_inflight_bytes 1000000\n") + f.write("max_queued_messages 20\n") + f.write("max_queued_bytes 1000000\n") + +def do_test(proto_ver): + rc = 1 + keepalive = 60 + connect_packet = mosq_test.gen_connect("subpub-qos0-bytes", keepalive=keepalive, proto_ver=proto_ver) + connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver) + + connect_packet_helper = mosq_test.gen_connect("qos0-bytes-helper", keepalive=keepalive, proto_ver=proto_ver) + + mid = 1 + subscribe_packet = mosq_test.gen_subscribe(mid, "subpub/qos0/queued/bytes", 1, proto_ver=proto_ver) + suback_packet = mosq_test.gen_suback(mid, 1, proto_ver=proto_ver) + + publish_packet0 = mosq_test.gen_publish("subpub/qos0/queued/bytes", qos=0, payload="message", proto_ver=proto_ver) + + + port = mosq_test.get_port() + conf_file = os.path.basename(__file__).replace('.py', '.conf') + write_config(conf_file, port) + broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) + + try: + sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=4, port=port, connack_error="connack 1") + + mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") + + helper = mosq_test.do_client_connect(connect_packet_helper, connack_packet, timeout=4, port=port, connack_error="connack helper") + + helper.send(publish_packet0) + mosq_test.expect_packet(sock, "publish0", publish_packet0) + rc = 0 + + sock.close() + except mosq_test.TestError: + pass + finally: + os.remove(conf_file) + broker.terminate() + broker.wait() + (stdo, stde) = broker.communicate() + if rc: + print(stde.decode('utf-8')) + print("proto_ver=%d" % (proto_ver)) + exit(rc) + + +do_test(proto_ver=4) +do_test(proto_ver=5) +exit(0) diff --git a/test/broker/Makefile b/test/broker/Makefile index fcb6839d..01816063 100644 --- a/test/broker/Makefile +++ b/test/broker/Makefile @@ -45,6 +45,7 @@ test : test-compile 01 02 03 04 05 06 07 08 09 10 11 12 13 14 ./02-subhier-crash.py ./02-subpub-qos0-long-topic.py ./02-subpub-qos0-oversize-payload.py + ./02-subpub-qos0-queued-bytes.py ./02-subpub-qos0-retain-as-publish.py ./02-subpub-qos0-send-retain.py ./02-subpub-qos0-subscription-id.py diff --git a/test/broker/test.py b/test/broker/test.py index 0514359a..62216203 100755 --- a/test/broker/test.py +++ b/test/broker/test.py @@ -28,6 +28,7 @@ tests = [ (1, './02-subhier-crash.py'), (1, './02-subpub-qos0-long-topic.py'), (1, './02-subpub-qos0-oversize-payload.py'), + (1, './02-subpub-qos0-queued-bytes.py'), (1, './02-subpub-qos0-retain-as-publish.py'), (1, './02-subpub-qos0-send-retain.py'), (1, './02-subpub-qos0-subscription-id.py'),