Commit Graph

734 Commits

Author SHA1 Message Date
Roger A. Light
9e28eea0a2 Initialise sockpairR/W to invalid in mosquitto_reinitialise()
This avoids closing invalid sockets in `mosquitto_destroy()` on error.

Closes #2326. Thanks to Arrigo Zanette.
2021-09-24 16:50:53 +01:00
Roger A. Light
330bf6efdc Various fixes around inflight quota management.
Closes #2306. Thanks to canique.
2021-09-22 17:20:24 +01:00
Roger A. Light
d09591d92e Fix reconnecting in some cases when using MOSQ_OPT_TLS_USE_OS_CERTS.
Fix reconnecting failing when MOSQ_OPT_TLS_USE_OS_CERTS was in use, but none
of capath, cafile, psk, nor MOSQ_OPT_SSL_CTX were set, and
MOSQ_OPT_SSL_CTX_WITH_DEFAULTS was set to the default value of true.

Closes #2288. Thanks to Poltorak Serguei.
2021-08-31 15:59:40 +01:00
Roger A. Light
605131502b Fix MOSQ_OPT_SSL_CTX not being able to be set to NULL.
Closes #2289. Thanks to Poltorak Serguei.
2021-08-31 10:45:10 +01:00
Roger A. Light
9d6a73f9f7 Fix CONNECT performance with many user-properties.
An MQTT v5 client connecting with a large number of user-property properties
could cause excessive CPU usage, leading to a loss of performance and
possible denial of service. This has been fixed.
2021-08-26 12:17:42 +01:00
Roger Light
32af599c81 Fix $share subscriptions not being recovered for durable clients.
If a plugin had granted ACL subscription access to a
durable/non-clean-session client, then removed that access, the client would
keep its existing subscription. This has been fixed.
2021-08-26 12:17:26 +01:00
Roger A. Light
376226c129 Build warning fixes. 2021-08-26 10:54:03 +01:00
Roger A. Light
9b25dd3b0d libressl build fixes.
Closes #2198. Thanks to Theo Buehler.
2021-08-24 13:53:03 +01:00
Roger A. Light
0d1837ebe3 Deconfigure thread mode when the loop thread ends.
Threaded mode is deconfigured when the mosquitto_loop_start() thread ends,
which allows mosquitto_loop_start() to be called again.

Closes #2242. Thanks to Timo Lange.
2021-08-24 11:51:38 +01:00
Roger A. Light
9526b4cf23 Check for file==dir only when reading. 2021-08-23 23:19:37 +01:00
Roger Light
ba2ca33671 Strict protocol compliance fixes, and extensive test suite. 2021-08-23 23:19:28 +01:00
Roger Light
723b5d7081 Fix listener mount_point not being removed on outgoing messages.
Closes #2244. Thanks to alflexRH.
2021-08-22 08:23:13 +01:00
Roger Light
6608e852a1 Fix broker not quiting if password_file is specified as a directory.
Closes #2241. Thanks to Bryan Pearson.
2021-08-21 22:45:39 +01:00
Roger Light
93b2232bb9 Apply max_keepalive to MQTT v3.1.1 and v3.1 clients. 2021-08-20 23:27:14 +01:00
Roger A. Light
ea371564e7 Disable TLS 1.3 when using TLS-PSK, because it isn't correctly config'd. 2021-08-19 17:26:04 +01:00
Roger A. Light
a37c8e65d2 TLS-PSK mismatch fix.
Produce an error if a TLS-PSK client tries to connect to a broker
that is not configured with TLS-PSK.
2021-08-19 17:26:04 +01:00
Roger A. Light
79542158f4 Fix max_connections option not being correctly counted. 2021-08-17 13:10:18 +01:00
Roger A. Light
4e146b7b53 Fix possible out of bounds memory reads when reading configuration.
This would happen with a corrupt/crafted configuration file. Unless your
configuration file is writable by untrusted users this is not a risk.

Closes #567213. Thanks to Roland Sako.
2021-07-22 16:43:06 +01:00
Roger A. Light
8416f928df Revert premature want_connect fix. 2021-06-08 22:26:14 +01:00
Roger A. Light
403691ce40 Add missing return types. 2021-06-08 22:25:59 +01:00
Roger A. Light
104b94db57 Fix non-reachable bridge blocking the broker on Windows.
Closes #2172. Thanks to Niclas Lindgren.
2021-06-08 12:07:24 +01:00
Roger A. Light
625e2a5060 Refactor to remove duplicate code. 2021-06-08 11:59:12 +01:00
Roger A. Light
16fb0025a7 Improve QoS 0 outgoing packet queueing. 2021-05-18 16:53:45 +01:00
Roger Light
9bb58a88fc Cleanup messsage before return.
Coverity scan #1451483.
2021-05-16 19:57:59 +01:00
Roger A. Light
a2ab20df13 Don't call read() if sockpairR < 0.
Coverity #1450782.
2021-05-06 21:04:49 +01:00
Roger Light
b4c86df6f5 Fix missing control path.
Closes #2190. Thanks to RengeRenge.
2021-04-25 23:10:06 +01:00
Roger Light
e1c8f09372 Remove C++ style comments. 2021-04-25 22:26:12 +01:00
Christian Beier
fe10226cc9 Fix building with Visual Studio 2008
This older Microsoft compiler does not support mixing declarations and
code and misses some error defines. This commit enables building with
VS2008 by moving up some variable declarations and defining error
codes to their WinSock counterparts in case they're not defined.

Signed-off-by: Christian Beier <info@christianbeier.net>
2021-04-18 21:23:25 +02:00
Roger Light
6ebbb4d654 Fix possible socket leak.
This would occur if a client was using `mosquitto_loop_start()`, then if
the connection failed due to the remote server being inaccessible they
called `mosquitto_loop_stop(, true)` and recreated the mosquitto object.

See: https://www.eclipse.org/forums/index.php?t=rview&goto=1839865#msg_1839865
2021-04-02 11:03:01 +01:00
Roger Light
0f9e5795a2
Merge pull request #2145 from abiliojr/empty_sockpairR
Fully empty sockpairR on interruptible_sleep
2021-03-22 10:34:57 +00:00
Abilio Marques
dd4a64b049 fully empty socketpairR on interruptible_sleep
Signed-off-by: Abilio Marques <abiliojr@gmail.com>
2021-03-22 08:15:47 +01:00
Abilio Marques
91f34e084f fix duplication of messages during connect
Signed-off-by: Abilio Marques <abiliojr@gmail.com>
2021-03-22 07:59:37 +01:00
Roger Light
2de8c15bc9 Minor build fixes. 2021-03-21 09:18:43 +00:00
Roger Light
cca41d176d Fix inconsistent sign in log__printf declaration. 2021-03-20 19:16:43 +00:00
Roger A. Light
f8838243fb Fix connections retrying very rapidly in some situations.
Thanks to Abilio Marques.
2021-03-11 21:04:51 +00:00
Roger A. Light
b7a08d5c40 Fix TLS bridge/lib incorrectly connecting on invalid CA file.
Closes #2130. Thanks to becz.
2021-03-11 12:45:04 +00:00
Roger A. Light
e401def06d Fix QoS 0 messages not being delivered when max_queued_bytes was configured.
Closes #2123. Thanks to quackgizmo.
2021-03-08 23:23:45 +00:00
Roger A. Light
2190e98b20 Fix memory tracking not being available on FreeBSD or macOS.
Closes #2096. Thanks to blusewang.
2021-02-25 17:04:15 +00:00
Roger A. Light
9b08faf0bd Fix mosquitto_{pub|sub}_topic_check() function returns.
The would not return MOSQ_ERR_INVAL on topic == NULL.
2021-02-09 14:09:53 +00:00
Roger A. Light
e98cc28cd3 Move check after current_out_packet is updated. 2021-01-28 09:29:52 +00:00
Przemek Zygmunt
18bad1ff32 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 <p.zygmunt@acsoftware.pl>
2021-01-28 09:28:36 +00:00
Roger A. Light
6e3738dcf0 Fix bridges not always connecting on Windows.
Closes #2043. Thanks to ttsorensen.
2021-01-26 13:19:08 +00:00
Roger A. Light
706a1f3f29 Fix more minor compiler warnings. 2021-01-21 13:33:54 +00:00
Roger A. Light
a4389fc9ce Fix SPDX identifiers: EDL-1.0 -> BSD-3-Clause.
The two licenses are the same.
2021-01-20 11:46:18 +00:00
Roger A. Light
370cec5edd Fixes for lots of minor build warnings highlighted by Visual Studio. 2021-01-09 21:06:08 +00:00
Roger A. Light
fabdfcc060 Further fix for large packets not being sent in a timely fashion. 2021-01-06 11:40:08 +00:00
Roger Light
c604cf8fd0 net__write buf should be const. 2021-01-03 20:52:45 +00:00
Roger A. Light
b2da540c64 Fix large packets not being completely published to slow clients.
Also fix bridge connection not relinquishing POLLOUT after messages are
sent.

Closes #1977. Thanks to marchaesen.
Closes #1979. Thanks to GorazdKikelj.
2020-12-27 23:03:38 +00:00
Roger A. Light
2db9aecac4 Do not reset bind address option if passed NULL.
mosquitto_connect_bind_async() and mosquitto_connect_bind_v5() should not
reset the bind address option if called with bind_address == NULL.

Otherwise calling mosquitto_connect_async() will *force* the bind
address to be reset, even if previously set with
mosquitto_string_option().
2020-12-20 17:21:17 +00:00
Roger A. Light
e02b5a2775 Fix $SYS/broker/publish/messages/+ counters not being updated for QoS 1, 2
Closes #1968. Thanks to promahn.
2020-12-18 22:55:10 +00:00