Skip to content

Commit

Permalink
Merge branch 'fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Jan 28, 2021
2 parents 18c98e7 + e98cc28 commit 2749b8c
Show file tree
Hide file tree
Showing 185 changed files with 819 additions and 226 deletions.
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 33 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
2.0.6 - 2021-01-xx
2.0.6 - 2021-01-28
==================

Broker:
- Fix calculation of remaining length parameter for websockets clients that
send fragmented packets. Closes #1974.
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`.
- 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.


2.0.5 - 2021-01-11
Expand Down
1 change: 1 addition & 0 deletions README-compiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion apps/db_dump/db_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down
2 changes: 1 addition & 1 deletion apps/db_dump/db_dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down
2 changes: 1 addition & 1 deletion apps/db_dump/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down
39 changes: 39 additions & 0 deletions apps/db_dump/stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion apps/mosquitto_ctrl/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down
6 changes: 3 additions & 3 deletions apps/mosquitto_ctrl/dynsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -720,9 +721,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;
}
Expand Down
7 changes: 5 additions & 2 deletions apps/mosquitto_ctrl/dynsec_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion apps/mosquitto_ctrl/dynsec_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down
2 changes: 1 addition & 1 deletion apps/mosquitto_ctrl/dynsec_role.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down
7 changes: 6 additions & 1 deletion apps/mosquitto_ctrl/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
*/
#include "config.h"

#include <cjson/cJSON.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion apps/mosquitto_ctrl/mosquitto_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down
2 changes: 1 addition & 1 deletion apps/mosquitto_ctrl/mosquitto_ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down
8 changes: 4 additions & 4 deletions apps/mosquitto_ctrl/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions apps/mosquitto_passwd/get_password.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion apps/mosquitto_passwd/get_password.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Eclipse Public License is available at
and the Eclipse Distribution License is available at
http:https://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.
Expand Down

0 comments on commit 2749b8c

Please sign in to comment.