Commit Graph

659 Commits

Author SHA1 Message Date
Roger A. Light
c1b009e4df Fix memory leak on handling QoS 2 PUBLISH.
In some circumstances, Mosquitto could leak memory when handling PUBLISH  messages. This is limited to incoming QoS 2 messages, and is related to the combination of the broker having persistence enabled, a clean session=false client, which was connected prior to the broker restarting, then has reconnected and has now sent messages at a sufficiently high rate that the incoming queue at the broker has filled up and hence messages are being dropped. This is more likely to have an effect where max_queued_messages is a small value. This has now been fixed.

Closes #1793. Thanks to mbates14.
2020-08-19 14:38:57 +01:00
Roger A. Light
b3b58cc635 Build warning fixes. 2020-08-19 14:04:02 +01:00
Roger A. Light
a224a8f217 Don't busy loop with mosquitto_pub -l on a slow connection. 2020-08-13 14:32:47 +01:00
Roger A. Light
9929ce0a26 All clients exit with an error exit code on CONNACK failure.
Closes #1778. Thanks to jflambert.
2020-08-12 09:44:42 +01:00
Roger A. Light
c9218fd48c Bump version. 2020-08-11 12:05:32 +01:00
Roger A. Light
b3c2ac20dc Fix overly broad HAVE_PTHREAD_CANCEL compile guard.
Closes #1547. Thanks to Markus Gothe.
2020-08-11 11:02:38 +01:00
Roger A. Light
4b100df5b1 Fix reconnect+will delay interval issue causing missing messages.
Fix clients not receiving messages after a previous client with the same   client ID and positive will delay interval quit.
Closes #1752. Thanks to Jiří Zuzaňák.
2020-08-11 11:01:25 +01:00
Roger Light
60dc8f5e4c Fix service path quoting on Windows.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=565671
2020-08-11 09:09:31 +01:00
Roger Light
4ef48269f5 Fix mosquitto_loop_stop() not stopping on Windows
Closes #1748. Closes #117. Thanks to Sigmund Vik.
2020-08-11 08:55:05 +01:00
Roger A. Light
bd27935ff6 mosquitto_loop_start() now sets a thread name.
This applies on Linux, FreeBSD, NetBSD, and OpenBSD.

Closes #1777. Thanks to ABuch19.
2020-08-10 22:51:17 +01:00
Roger A. Light
94d04136f8 Fix potential memory leaks.
Closes #1773. Closes #1774. Thanks to Yingpei Zeng.
2020-08-06 21:28:09 +01:00
Roger A. Light
618cd7006b Don't try to start DLT logging if DLT unavailable.
This is to avoid a long delay when shutting down the broker.

Closes #1735. Thanks to Colin Law.
2020-08-04 11:17:04 +01:00
Roger A. Light
84e4ba2c1e Send DISCONNECT with malformed-packet reason code on bad PUBLISHes. 2020-08-02 23:12:47 +01:00
Roger A. Light
b1e9377a20 Send DISCONNECT with malformed-packet reason code on bad SUBSCRIBEs. 2020-08-02 15:10:12 +01:00
Roger A. Light
8416b007ec Send DISCONNECT with malformed-packet reason code on bad UNSUBSCRIBEs. 2020-08-02 14:22:40 +01:00
Roger A. Light
1f717873d6 Log protocol error message where appropriate from a bad UNSUBSCRIBE
Rather than the generic "socket error".

Related to #1765.
2020-07-31 23:01:15 +01:00
Roger A. Light
54f3b686dc Fix "slow" file based logging by switching to line based buffering.
Closes #1689. Closes #1741. Thanks to Brett M. Gordon and tt92.
2020-07-15 22:28:19 +01:00
Roger A. Light
8234d24b1b Fix websockets clients sometimes not being disconnected promptly.
Closes #1718. Thanks to Luca Casonato.
2020-07-15 22:06:29 +01:00
Roger A. Light
d371b3c58b Fix mosquitto_publish*() no longer returning MOSQ_ERR_NO_CONN.
This was always returning success when the client was not connected.

Closes #1725. Thanks to BOTorioN.
2020-07-15 20:25:36 +01:00
Roger A. Light
b4e0dfa598 Fix autosave_interval not being triggered by messages being delivered.
Closes #1726. Thanks to nduhme.
2020-07-15 19:29:40 +01:00
Roger A. Light
4e0312c55f Fix messages being queued for disconnected bridges
This occurred incorrectly when clean start was set to true.

Closes #1729. Thanks to Andreyooo.
2020-07-15 17:08:00 +01:00
Roger A. Light
f846711ea2 mosquitto_pub now sends 0 length files without an error when using -f. 2020-07-15 12:03:15 +01:00
Roger A. Light
1d66d3e443 Fix bridge topic remapping when using "" as the topic.
Closes #1749. Thanks to cieslarchristian.
2020-07-15 00:19:44 +01:00
Roger A. Light
5a56f066a8 Change systemd unit files to create /var/log/mosquitto
This happens before starting the broker.

Also don't quit with an error if opening the log file isn't possible.

Closes #821.
2020-07-14 20:10:54 +01:00
Roger A. Light
abb31ffe8d Fix broker refusing to start if only websockets listeners were defined.
Closes #1740. Thanks to OkenKhuman.
2020-07-14 17:27:57 +01:00
Roger A. Light
f46187d5e5 Add mosquitto_client_protocol_version() function.
This can be used by plugins to determine which version of MQTT a client
has connected with.
2020-07-12 23:01:20 +01:00
Roger Light
318dead6bf Function to allow plugins to publish messages. 2020-06-30 10:31:34 +01:00
Roger A. Light
2e32634a95 DLT logging is now configurable at runtime with log_dest dlt.
Closes #1735. Thanks to Brian Orpin.
2020-06-30 00:51:57 +01:00
Roger A. Light
c8964228e3 Improved documentation around connect callback return codes.
Close #1730. Thanks to John Laird.
2020-06-22 21:45:50 +01:00
Roger A. Light
4b541ad5ca Fix usage message not mentioning v5.0.
Closes #1713. Thanks to whnr.
2020-06-09 15:42:51 +01:00
Roger A. Light
cea0423e69 Update changelog and version. 2020-05-25 23:40:15 +01:00
Roger A. Light
6bd435d721 Fix possible assert crash associated with bridge reconnecting.
This only occurs when compiled without epoll support.

Closes #1700. Thanks to Matthias Urlichs.
2020-05-25 23:38:13 +01:00
Roger A. Light
ce463c185b Update changelog. 2020-05-20 11:02:11 +01:00
Roger A. Light
eae8c9aab4 Fix check when loading persistence file of a different version
Closes #1684. Thanks to grekhss.
2020-05-15 22:11:26 +01:00
Roger A. Light
762ad432e8 Fix support for openssl 3.0 2020-05-12 13:39:49 +01:00
Roger A. Light
24049b1a1e Fix mosquitto_sub %j or %J not working on Windows.
Closes #1674. Thanks to amigian74.
2020-05-06 22:24:58 +01:00
Roger A. Light
b726e2f1ec mosquitto_sub %j and %J timestamps are now in a ISO 8601 compatible format. 2020-05-06 22:21:21 +01:00
Roger A. Light
946257bf30 Remove spurious version heading. 2020-05-05 16:01:17 +01:00
Roger A. Light
4960fc0702 Don't disconnect clients that are already disconnected.
This prevents the session expiry being extended on SIGHUP.

Closes #1521. Thanks to Christoph Krey.
2020-05-01 22:45:40 +01:00
Roger A. Light
eeaafed485 Fix memory leak when connecting clients rejected. 2020-04-30 17:31:13 +01:00
Roger A. Light
5908585afd Fix mosquitto_passwd -b not updating passwords for existing users
Closes #1664. Thanks to Leon Kiefer.
2020-04-26 22:44:57 +01:00
Roger A. Light
c72dd39f92 Allow MQTT v5.0 outgoing bridges to fall back to MQTT v3.1.1
This applies if connecting to a v3.x only broker.
2020-04-02 10:26:36 +01:00
Roger A. Light
21f203b91a Don't treact unexpected PUBACK/COMP as fatal. 2020-03-28 23:33:01 +00:00
Roger A. Light
de25ff694e Report invalid bridge prefix+pattern combinations at config parsing time
Rather than letting the bridge fail later.

Issue #1635. Thanks to pokerazor.
2020-03-28 22:44:35 +00:00
Roger A. Light
a16d7e0661 iDon't treat an unexpected PUBREL as fatal.
Issue #1629. Thanks to radcrabs.
2020-03-19 15:38:29 +00:00
Roger A. Light
7f41e37f0f Fix use of sed on BSD.
Closes #1614. Thanks to Christoph Krey.
2020-03-12 11:52:58 +00:00
Roger A. Light
c84d175b3d Fixes for the poor souls stuck on <c99.
Closes #1622.
2020-03-12 10:29:11 +00:00
Roger A. Light
0da723c1ec Add --random-filter to mosquitto_sub. 2020-03-03 14:12:30 +00:00
Roger A. Light
d96543c0b8 Merge branch 'fixes' into develop 2020-03-03 12:54:57 +00:00
Roger A. Light
b0a065f790 Update changelog. Release page. Bump copyright. 2020-02-27 23:26:58 +00:00
Roger A. Light
8d5fd7d1e2 Fix mosquitto_topic_matches_sub() behaviour with wildcards in topic.
It was not returning MOSQ_ERR_INVAL if the topic contains a wildcard.

Closes #1589. Thanks to mdelete.
2020-02-07 22:55:50 +00:00
Roger A. Light
17e20de9e7 Fix session-expiry-interval for v5 clients using -c.
Default behaviour for v5 clients using `-c` is now to use infinite length
sessions, as with v3 clients.

Closes #1546. Thanks to Kiran Pradeep.
2020-02-06 16:14:29 +00:00
Roger A. Light
019d4214b8 Fix session-expiry-interval for v5 clients using -c.
Default behaviour for v5 clients using `-c` is now to use infinite length
sessions, as with v3 clients.

Closes #1546. Thanks to Kiran Pradeep.
2020-02-06 16:12:56 +00:00
Roger A. Light
56d0b950ac Fix --remove-retained not obeying the -T option.
This means `--remove-retained -t bbc/# -T bbc/one/#` would remove all
retained messages in `bbc/#`, instead of leaving all of the topics in
`bbc/one/#`.

Closes #1585. Thanks to Simon Moser.
2020-02-05 15:19:55 +00:00
Roger A. Light
07c54627e9 Print OpenSSL errors in more situations
Covers when loading certificates fails, or there are ENGINE problems.

Closes #1552. Thanks to Michael Richardson.
2020-02-04 16:59:29 +00:00
Roger A. Light
27b4518d7e Improve password file parsing in the broker and mosqitto_passwd.
Closes #1584. Thanks to panava.
2020-02-04 16:38:51 +00:00
Roger A. Light
ed5db1bd6b Fix bind_interface not working for the default listener.
Closes #1533. Thanks to Markus Gothe.
2020-01-30 22:48:15 +00:00
Roger A. Light
70fd600c3a Fix trailing whitespace not being trimmed on acl users.
Closes #1539. Thanks to CliveJL and LeonPoon.
2020-01-30 19:52:46 +00:00
Roger A. Light
3671a6dfdb Add -x argument to all clients.
This allows the session-expiry-interval property to be easily set for
MQTT v5 clients.
2020-01-30 11:19:09 +00:00
Roger A. Light
8f1c8cba59 Set minimum keepalive argument to mosquitto_connect*() to be 5 seconds.
Closes #1550. Thanks to Markus Gothe.
2020-01-28 16:59:20 +00:00
Roger A. Light
9ae38788dc Fix config->user not being freed on exit.
Closes #1564. Thanks to back1127.
2020-01-28 16:52:14 +00:00
Roger A. Light
812c0636d5 Satisfy valgrind when exiting on error.
This is when due to not being able to open a listening socket, solved by
calling freeaddrinfo in the error cases.

Closes #1565. Thanks to back1127.
2020-01-28 16:12:45 +00:00
Roger A. Light
e7c9f009bd Strip whitespace from end of config file string options.
Closes #1566. Thanks to kollokollo.
2020-01-28 16:04:25 +00:00
Roger A. Light
d452ea138b Use presence of password file as indicator for authentication checks.
Previously, authentication checks would only take place if usernames
were defined in the password file.

Closes #1545. Thanks to Timothy Godfrey.
2019-12-20 00:19:17 +00:00
Roger A. Light
b6119bb759 Check ACL patterns for validity when loading.
Closes #1539. Thanks to Leon Poon.
2019-12-18 21:39:27 +00:00
Roger A. Light
d60e86d2a3 Add TCP_NODELAY support to lib and clients.
Closes #1526. Thanks to Felix Moessbauer.
2019-12-18 17:04:43 +00:00
Roger A. Light
c8789180f3 Fix session expiry with very large expiry intervals.
Closes #1525. Thanks to Christoph Krey.
2019-12-12 09:40:37 +00:00
Roger A. Light
c0443637e8 Merge branch 'master'
Conflicts:
	ChangeLog.txt
	config.mk
	src/context.c
	src/loop.c
	src/subs.c
	test/broker/01-connect-bad-packet.py
	test/broker/02-subpub-qos1-bad-pubcomp.py
	test/broker/02-subpub-qos1-bad-pubrec.py
	test/broker/02-subpub-qos2-bad-puback-1.py
	test/broker/02-subpub-qos2-bad-puback-2.py
	test/broker/02-subpub-qos2-bad-pubcomp.py
	test/broker/02-subpub-qos2.py
	test/broker/07-will-null-topic.py
2019-12-03 13:59:05 +00:00
Roger A. Light
b410568299 Bump version, add release post. 2019-11-28 17:08:11 +00:00
Roger A. Light
b96739341d Update changelog for last pull request.
Closes #1513.
2019-11-28 16:41:35 +00:00
Roger A. Light
a46b45b006 Fix persistent_client_expiration not being used
Closes #1494. Thanks to Christoph Krey.
2019-11-28 16:17:41 +00:00
Roger A. Light
c37251c53d Document mosquitto_connect_srv().
Closes #1499. Thanks to Basavesh Shivakumar.
2019-11-22 11:16:53 +00:00
Roger A. Light
3d92dcbbd9 Make documentation for mosquitto_pub -l match reality
Blank lines are sent as empty messages.

Closes #1474. Thanks to majekw.
2019-11-07 20:49:59 +00:00
Roger A. Light
1e04b22833 Fix mosquitto_pub -l not sending the final line of stdin
This would happen if the final line did not end with a new line.

Closes #1473. Thanks to majekw.
2019-11-07 18:25:56 +00:00
Roger A. Light
d003fed383 MQTT v5 bridges can handle "retain-available" being false. 2019-11-07 13:31:42 +00:00
Roger A. Light
2af260ba58 Add bridge_outgoing_retain option
This allows outgoing messages from a bridge to have the retain bit
completely disabled, which is useful when bridging to e.g. Amazon or
Google.
2019-11-07 11:59:29 +00:00
Roger A. Light
88c83fe6b5 mosquitto_pub now handles the MQTT v5 retain-available property
It will not set the retain bit if retain-available is false.
2019-11-06 23:07:00 +00:00
Roger A. Light
05171b266d Fix TLS Websockets clients not receiving messages.
This can occurs after one client takes over a previous connection.

Closes #1489. Thanks to Bas Verhoeven.
2019-11-06 22:25:33 +00:00
Roger A. Light
6bde209799 Added CLIENT_STATIC_LDADD to makefile builds
This allow more libraries to be linked when compiling the clients with a
static libmosquitto, as required for e.g. openssl on some systems.

Closes #1371. Thanks to Fabrice Fontaine.
2019-11-06 15:04:54 +00:00
Roger A. Light
22eb193309 Merge branch 'stdin-fix-1' of git://github.com/majekw/mosquitto into majekw-stdin-fix-1 2019-11-06 13:24:38 +00:00
Roger A. Light
9cdc822a19 Add changelog, change msg text for previous merge. 2019-11-06 13:17:23 +00:00
Roger A. Light
b622aaeee4 Fix messages with an expiry interval missing the property.
They would be be sent without an expiry interval property just before
they were expired.

Closes #1464. Thanks to Dustin Sallings.
2019-10-31 12:56:13 +00:00
Roger A. Light
06a27e799f Fix retained messages with an expiry interval not being expired.
This happened after being restored from persistence.

Closes #1464. Thanks to Dustin Sallings.
2019-10-31 12:54:20 +00:00
Roger A. Light
463fe8fc6c Fix document issues in mosquitto.h.
Closes #1478. Thanks to Liam Fry.
2019-10-31 11:58:54 +00:00
Roger A. Light
1d468708de Fix mosquitto_rr.exe not being included in Windows installers.
Closes #1463. Thanks to raisonchacko.
2019-10-29 14:41:39 +00:00
Roger A. Light
934ec7355a Add issue reference to changelog.
Closes #1416.
2019-10-15 15:37:34 +01:00
Roger A. Light
253326dcc9 Fix problems with reloading config when per_listener_settings was true.
Closes #1459. Thanks to Thomas Markin Klein.
2019-10-15 15:32:24 +01:00
Roger A. Light
59c0bfe6e1 Add support for v5 property printing to mosquitto_sub/rr in non-JSON mode. 2019-10-15 15:23:29 +01:00
Roger A. Light
9e4226622f Add --pretty option to mosquitto_sub/rr
If active, this produces formatted JSON output rather than the normal
minimised output.
2019-10-15 14:44:25 +01:00
Roger Light
e5237ae7e5 Add support for sub/rr v5 prop output in JSON mode 2019-10-15 14:26:51 +01:00
Roger Light
2f8573b456 Add property helper functions.
mosquitto_property_identifier()
mosquitto_property_identifier_to_string()
mosquitto_property_next()
2019-10-15 13:47:46 +01:00
Roger A. Light
ad5c2e11d9 Use cJSON for producing JSON output in clients.
Closes #1222. Thanks to Ben Barbour.
2019-10-15 11:59:22 +01:00
majekw
50c9a4b0b0 Fix mosquitto_pub -l hang when stdin stream ends. Closes #1448.
Signed-off-by: Marek Wodzinski <majek@w7i.pl>
2019-10-10 13:00:22 +02:00
Roger A. Light
8a4ae28fa9 Fix duplicate cfg definition in rr_client.
Closes #1453. Thanks to jveber.
2019-10-09 14:01:44 +01:00
Roger A. Light
499e2f2e98 Add support for unix sockets to broker, lib, and clients. 2019-10-08 20:55:31 +01:00
Roger A. Light
cfacd961c9 Only a single CRL could be loaded at once. This has been fixed.
Closes #1442. Thanks to charlemagnelasse.
2019-10-02 13:37:52 +01:00
Roger A. Light
c471dfb201 Fix sub topics being limited to 200 chars instead of 200 levels
Closes #1441. Thanks to Christoph Krey.
2019-10-02 13:00:01 +01:00
Roger A. Light
b942b73b6d Fix incorrect memory tracking causing problems with memory_limit option.
Closes #1437. Thanks to Guillaume Bour.
2019-10-01 16:57:54 +01:00
Roger A. Light
093c8f90f5 Fix publish props not being passed to v5 msg callback for QoS 2 msgs.
Closes #1432. Thanks to Magnus Galåen.
2019-09-26 16:47:34 +01:00
Roger A. Light
4db1e80410 More allow_zero_length_clientid fixes.
Closes #1429. Thanks to Dustin Sallings.
2019-09-26 11:53:58 +01:00