Commit Graph

685 Commits

Author SHA1 Message Date
Roger A. Light
fd7b08c0eb Per listener psk_file. 2018-03-15 21:39:42 +00:00
Roger A. Light
b2e1592376 Per listener allow_anonymous. 2018-03-15 14:29:07 +00:00
Roger A. Light
7046691b7d Reload password files properly. 2018-03-15 14:29:02 +00:00
Roger A. Light
aa87f3c170 Per listener allow_anonymous. 2018-03-15 12:18:19 +00:00
Roger A. Light
a571104809 Check correct password list. 2018-03-15 11:08:19 +00:00
Roger A. Light
0fef6bdee8 Maximum connections on Windows increased to 2048.
Thanks to ericGTT.
2018-03-14 10:01:47 +00:00
Peter Korsgaard
01ead7e73e websockets.c: unbreak build without TLS
Commit 7943072b1f (Fix use_identity_as_username not working on websockets
clients) added code which unconditionally accesses mosq-ssl, breaking the
build when TLS support is disabled.

Fix it by guarding this logic inside #ifdef WITH_TLS.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-03-13 23:16:25 +00:00
Roger A. Light
57e852db05 Per listener password file. 2018-03-13 17:52:04 +00:00
Roger A. Light
bc13eab9d6 Add per_listener_settings, which isn't used yet. 2018-03-13 17:52:03 +00:00
Roger A. Light
4d3f5b2b39 Ensure pollfd_index is initialised. 2018-03-13 17:52:03 +00:00
Thomas Pedley
ba8734b749 Add LWT message logging.
Signed-off-by: Thomas Pedley <me@shallax.com>
2018-03-13 13:41:58 +00:00
Roger A. Light
9ea0d38002 [706] Serve http /dir/ as /dir/index.html.
Thanks to Jean-Claude Wippler.
2018-03-13 09:12:54 +00:00
Roger A. Light
4f838e5161 Windows fixes. 2018-02-28 15:53:24 +00:00
Roger A. Light
5b2bf3d1c1 Bump version number, update copyrights. 2018-02-28 11:15:20 +00:00
Roger A. Light
e6cbff0e94 Fix unauthorised clients being able to cause OOM on connect. 2018-02-24 22:09:19 +00:00
Roger A. Light
b76982db13 Fix reloading of config when fds are exhausted. 2018-02-24 21:44:38 +00:00
Roger A. Light
ec63d7bfc7 Add set_tcp_nodelay option to disable Nagle's algorithm.
Bug: https://github.com/eclipse/mosquitto/issues/433
2018-02-14 23:51:16 +00:00
Roger A. Light
81cb7ab547 Merge branch 'fixes' into develop 2018-02-13 14:16:47 +00:00
Roger A. Light
c001e778c1 [693] Fix handling of null bytes in received strings.
Thanks to Umberto Boscolo.

Bug: https://github.com/eclipse/mosquitto/issues/693
2018-02-13 12:19:34 +00:00
Roger A. Light
3066f89a24 packet__read_string() returns the string length. 2018-02-11 20:47:17 +00:00
Roger A. Light
ff55499725 Fix persistence reloading. 2018-01-13 21:11:07 +00:00
Roger A. Light
027c5d7f6e Don't remove invalid socket from epoll fd. 2018-01-13 21:10:24 +00:00
Roger A. Light
2283585e39 Remove build timestamp information for reproducible builds. 2018-01-12 13:41:09 +00:00
Pierre Fersing
59380cef2d Fix CONNACK not send over WebSocket for bad auth
When client over WebSockets fail to authenticate, the CONNACK packet was
not sent because the connection was closed too early. Closes #18.

Signed-off-by: Pierre Fersing <pierre.fersing@bleemeo.com>
2018-01-12 13:34:12 +00:00
Roger A. Light
b4c72e8fc0 Fix HUP disconnecting clients incorrectly.
Bug: https://github.com/eclipse/mosquitto/issues/657
2018-01-10 22:34:03 +00:00
Roger A. Light
9c6a5f3cf0 [656] Fix building on Windows.
Thanks to Arun Kirthi Cherian.

Bug: https://github.com/eclipse/mosquitto/issues/656
2018-01-06 22:42:40 +00:00
Tatsuzo Osawa
024fd400d4 Fix Unsubscribe with No Topic
Signed-off-by: Tatsuzo Osawa <tatsuzo.osawa@gmail.com>
2018-01-06 12:11:06 +00:00
Pierre Fersing
7775924bae [534]Fix upgrade_outgoing_qos for retained message 2018-01-03 18:50:34 +01:00
Pierre Fersing
7df5c40004 Fix $SYS counters when message is sent over WS
Signed-off-by: Pierre Fersing <pierre.fersing@bleemeo.com>
2018-01-02 16:51:56 +01:00
Roger A. Light
7f82cdc753 [652] Don't limit config file lines to 1024 chars.
Bug: https://github.com/eclipse/mosquitto/issues/652
2017-12-20 11:00:16 +00:00
Michael Heimpold
48dec391f7 Quote ${DESTDIR} usage in various Makefiles
This prevents failures during make install when whitespace
is part of DESTDIR pathname.

Signed-off-by: Michael Heimpold <michael.heimpold@i2se.com>
2017-12-01 22:28:26 +00:00
Roger A. Light
d3239920d7 Validate UTF-8 client ids, usernames and topics. 2017-08-16 11:28:54 +01:00
Roger A. Light
0745bcdb91 Improve some struct ordering. 2017-08-12 00:25:59 +01:00
Roger A. Light
8795f063d4 Add ability to deny access to SUBSCRIBE messages.
This is as well as the current read/write accesses. Currently for auth
plugins only.
2017-08-11 22:15:37 +01:00
Roger A. Light
7096d57c3a Documentation fix. 2017-08-09 22:17:11 +01:00
Roger A. Light
36e86355d7 Improve documentation and formatting. 2017-08-09 21:59:12 +01:00
toast-uz
df9ad5f0bd Add Epoll. (#495)
Signed-off-by: Tatsuzo Osawa <tatsuzo.osawa@gmail.com>
2017-07-27 18:43:09 +01:00
Roger A. Light
7943072b1f Fix use_identity_as_username not working on websockets clients.
Thanks to achest.
2017-07-26 23:27:04 +01:00
Roger A. Light
53c71b2a77 Fix memory leak related to use_identity_as_username. 2017-07-26 23:25:49 +01:00
Roger A. Light
c26b852c53 Don't double free when using remote_clientid/username/password. 2017-07-19 22:04:56 +01:00
Roger A. Light
ac6997d7bc Fix merge error. 2017-07-19 14:49:49 +01:00
Roger A. Light
5a267368d7 Merge branch 'master' into develop 2017-07-19 00:15:42 +01:00
Roger A. Light
ba0122f9a9 Don't disable IPv6 support for websockets. 2017-07-18 22:12:51 +01:00
Roger A. Light
d8cc5bc4fe Merge branch 'fixes' of github.com:eclipse/mosquitto into fixes 2017-07-17 22:02:30 +01:00
Roger A. Light
0ba0bc434e Use constant time memcmp for password checks. 2017-07-16 23:20:58 +01:00
Fredrik Fornwall
366194cde4 Replace getdtablesize() with sysconf(_SC_OPEN_MAX)
From http://man7.org/linux/man-pages/man3/getdtablesize.3.html:

"It is not specified in POSIX.1; portable applications should employ
sysconf(_SC_OPEN_MAX) instead of this call."

Specifically this fixes a build failure on Android which does not
have getdtablesize().

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2017-07-16 23:16:30 +01:00
Roger A. Light
e74203de2c Merge branch 'master' into develop 2017-07-16 22:52:01 +01:00
Roger A. Light
2a50b2e9bd Fix regression from 1.4.13 where persistence data was not being saved. 2017-07-10 23:43:42 +01:00
Roger A. Light
8de5ed4464 Remove "error in poll" messages. 2017-06-27 22:32:10 +01:00
Roger A. Light
cd17ca45cd [462] Relax CVE-2017-7650 checks.
Checks for '/' are no longer made, this character is a much lower risk
and is widely used in usernames.

Bug: https://github.com/eclipse/mosquitto/issues/462
2017-06-27 15:10:43 +01:00
Roger A. Light
c3823c0a81 [462] Add auth_plugin_deny_special_chars option.
Auth plugins can be configured to disable the check for +# in
usernames/client ids with the auth_plugin_deny_special_chars option.

Thanks to wiebeytec.

Bug: https://github.com/eclipse/mosquitto/issues/462
2017-06-27 14:59:37 +01:00
Roger A. Light
5246a76f87 [477] Send will messages for connected clients when broker stops.
Thanks to mikeS7.

Bug: https://github.com/eclipse/mosquitto/issues/477
2017-06-27 14:33:02 +01:00
Roger A. Light
96db6d6644 Fix CONNECT check for reserved=0, as per MQTT v3.1.1 check MQTT-3.1.2-3. 2017-06-27 11:11:43 +01:00
Roger A. Light
6e7d02ba16 Fix for CVE-2017-9868 for Windows. 2017-06-26 14:53:33 +01:00
Pierre Fersing
408972ddc1 Fix two issues with Websocket (#472)
* Websocket were always marked as "want_write" (even if they only
  want to read, or worse want nothing).
* Websocket FD was read twice in some case (when socket recv queue was
  larger that size read by libwebsocket)

Signed-off-by: Pierre Fersing <pierre.fersing@bleemeo.com>
2017-06-23 22:30:57 +01:00
Roger A. Light
09cb1b61c8 [468] Set persistence file to only be readable by owner.
Not implemented on Windows.

Thanks to Moshe Zioni.

Bug: https://github.com/eclipse/mosquitto/issues/468
2017-06-23 14:50:39 +01:00
Roger A. Light
ab45f86d74 Prevent out of bounds array access. 2017-06-22 09:47:03 +01:00
Roger A. Light
c78678607d [427] Fix large retained messages over websockets.
Thanks to Brian Block.

Bug: https://github.com/eclipse/mosquitto/issues/427
2017-06-19 21:40:19 +01:00
Roger A. Light
bb61cd2dee Fix merge error. 2017-06-19 18:31:58 +01:00
Roger A. Light
8f59d5ad28 Remove unused vars and reset pollfd_index on disconnect. 2017-06-19 16:14:59 +01:00
Roger A. Light
c07ba2a3da Experimental fix for poor websockets performance. 2017-06-18 12:52:59 +01:00
Jan Lukavsky
621f18d696 #419 Broker sometimes kills connection to client
Signed-off-by: Jan Lukavsky <je.ik@seznam.cz>
2017-06-11 22:00:45 +01:00
Roger A. Light
b61fefcf08 Merge branch 'master' into develop 2017-05-31 21:05:26 +01:00
Roger A. Light
9af3c6958f Fix for CVE-2017-7650. 2017-05-28 21:51:50 +01:00
Roger A. Light
ca8a507607 [446] Don't segfault on duplicate bridge names.
Thanks to Tifaifai Maupiti.

Bug: https://github.com/eclipse/mosquitto/issues/446
2017-05-12 22:29:54 +01:00
Riccardo Magliocchetti
059ba5f00b Fix use of unitialized memory in gets_quiet
Spotted by cppcheck

Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
2017-05-05 22:10:25 +01:00
YuLun Shih
97572610c0 Fix bridge->restart_t won't be reset
Signed-off-by: YuLun Shih <shih@yulun.me>
2017-05-05 22:02:05 +01:00
Roger A. Light
a93a0c9bb1 [424]
Fix mosquitto.db from becoming corrupted due to client messages being
persisted with no stored message.

Thanks to codami.

Bug: https://github.com/eclipse/mosquitto/issues/424
2017-04-13 13:40:12 +01:00
Roger A. Light
91b308a11d Merge branch 'master' into develop 2017-03-06 21:19:53 +00:00
Jiří Pinkava
1ed39b9aac Add (missing) plugin.c into build
Signed-off-by: Jiří Pinkava <j-pi@seznam.cz>
2017-03-06 10:50:04 +00:00
Roger A. Light
1a0240b5d5 [379] Improve mosquitto_passwd error messages.
Thanks to Jaimyn Mayer. Closes #379.

Bug: https://github.com/eclipse/mosquitto/issues/379
2017-02-20 23:48:30 +00:00
Roger A. Light
b55e7035ff [344] Fix non-async case. 2017-02-20 23:48:30 +00:00
Roger A. Light
433ee5c4d6 [344] Don't compile in async dns support by default for makefiles. 2017-02-20 23:48:30 +00:00
Roger A. Light
8406c08124 [344] Detect libanl in cmake. 2017-02-20 23:48:30 +00:00
Roger A. Light
6f45ab9624 [344] Only do async dns on glibc. 2017-02-20 23:48:30 +00:00
Roger A. Light
e0e8cc9f3e [344] Fix leaks and incorrect connect call. 2017-02-20 23:48:30 +00:00
Roger A. Light
e13af18ed9 Start of fix for [344]. 2017-02-20 23:48:30 +00:00
Fredrik Fornwall
54a467d782 Include <syslog.h> instead of <sys/syslog.h>
Using the standard <syslog.h> header instead of <sys/syslog.h> makes it
consistent with other source files and fixes compilation on Android.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2017-02-20 23:48:30 +00:00
Fredrik Fornwall
35cc1eb21e Check for rt and pthread libraries before linking
This fixes building on Android which does not have separate librt
or libpthread libraries.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2017-02-20 23:48:30 +00:00
Roger A. Light
2c92d3b837 More file closing fixes. 2017-02-20 23:48:30 +00:00
Roger A. Light
e7c1507f88 Fix error message when websockets http_dir directory does not exist. 2017-02-20 23:48:30 +00:00
Roger A. Light
b01e32bd8b [354] Close http files even on bad clients.
Thanks to jbwdevries.

Bug: https://github.com/eclipse/mosquitto/issues/354
2017-02-20 23:48:30 +00:00
Roger A. Light
7279e48191 [316] Don't error on zero length persistence files.
Closes #316.

Bug: https://github.com/eclipse/mosquitto/issues/316
2017-02-20 23:48:30 +00:00
Roger A. Light
ed80a9a526 [295] Usage should say we support 3.1.1 as well as 3.1.
Closes #295.

Bug: https://github.com/eclipse/mosquitto/issues/295
2017-02-20 23:48:30 +00:00
tucic
9f743d5972 Maximum connections for websockets listener (#271)
Check current number of connections before accepting new websockets clients.

Signed-off-by: tucic <tucic.milan@gmail.com>
2017-02-20 23:48:30 +00:00
Roger A. Light
6b68371dbe [259] Fix crash when "lazy" type bridge attempts to reconnect.
Thanks to hakofugu41.

Bug: https://github.com/eclipse/mosquitto/issues/259
2017-02-20 23:48:30 +00:00
Karl Palsson
20197e2496 websockets: fix compatibility with older lws versions (#260)
In 1.3, 1.4 and 1.5, the function was "libwebsockets_get_protocol" not
"libwebsocket_get_protocol"  While the #define name doesn't matter on
newer libwebsockets, where it redirects to lws_get_protocol, the naming
is critical for older versions.

Fixes: 477cd3e399 (Fix missing context->listener for websocket client)

Signed-off-by: Karl Palsson <karlp@etactica.com>
2017-02-20 23:48:30 +00:00
Roger A. Light
f72d9b3a34 [17] Sort include_dir files before loading them.
Bug: https://github.com/eclipse/mosquitto/issues/17
2017-02-19 20:29:04 +00:00
Roger A. Light
ebad302119 [379] Improve mosquitto_passwd error messages.
Thanks to Jaimyn Mayer. Closes #379.

Bug: https://github.com/eclipse/mosquitto/issues/379
2017-02-12 21:22:58 +00:00
Roger A. Light
565c9c3432 [344] Fix non-async case. 2017-02-09 16:41:48 +00:00
Roger A. Light
f0485d1398 [344] Don't compile in async dns support by default for makefiles. 2017-02-08 22:30:00 +00:00
Roger A. Light
fb824e7f1e [344] Detect libanl in cmake. 2017-02-08 16:24:50 +00:00
Roger A. Light
3d40ffe18b [344] Only do async dns on glibc. 2017-02-08 15:40:44 +00:00
Roger A. Light
f464970fcf [344] Fix leaks and incorrect connect call. 2017-02-06 23:10:43 +00:00
Roger A. Light
ef7a230365 Start of fix for [344]. 2017-02-06 22:41:34 +00:00
Fredrik Fornwall
23b0891048 Include <syslog.h> instead of <sys/syslog.h>
Using the standard <syslog.h> header instead of <sys/syslog.h> makes it
consistent with other source files and fixes compilation on Android.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2017-01-30 21:15:19 +00:00
Fredrik Fornwall
532273250c Check for rt and pthread libraries before linking
This fixes building on Android which does not have separate librt
or libpthread libraries.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2017-01-30 21:00:25 +00:00
Roger A. Light
9b05b12039 More file closing fixes. 2017-01-21 07:54:48 +00:00
Roger A. Light
a2a2099fa1 Fix error message when websockets http_dir directory does not exist. 2017-01-20 21:18:18 +00:00
Roger A. Light
8171a975ae [354] Close http files even on bad clients.
Thanks to jbwdevries.

Bug: https://github.com/eclipse/mosquitto/issues/354
2017-01-20 18:25:04 +00:00
Roger A. Light
7f66bf1f65 [316] Don't error on zero length persistence files.
Closes #316.

Bug: https://github.com/eclipse/mosquitto/issues/316
2017-01-06 00:44:17 +00:00
Ben Hardill
740b710a0b Add support for local only bridge notifications (#328)
This update adds an option to only publishes bridge
notification messages to the local side of the bridge.

It adds a config file option called notifications_local_only
that accepts a boolean value, defaults to false to be
consistent with existing behaviour.

Fixes #233

Signed-off-by: Ben Hardill <hardillb@uk.ibm.com>
2016-12-04 21:47:38 +00:00
Roger A. Light
1abd089afb [295] Usage should say we support 3.1.1 as well as 3.1.
Closes #295.

Bug: https://github.com/eclipse/mosquitto/issues/295
2016-10-20 13:48:30 +01:00
tucic
f272e2e047 Maximum connections for websockets listener (#271)
Check current number of connections before accepting new websockets clients.

Signed-off-by: tucic <tucic.milan@gmail.com>
2016-09-29 18:51:31 +01:00
Roger A. Light
762126064c [259] Fix crash when "lazy" type bridge attempts to reconnect.
Thanks to hakofugu41.

Bug: https://github.com/eclipse/mosquitto/issues/259
2016-09-20 23:26:14 +01:00
Roger A. Light
7ace6c9e7e Merge branch 'master' into fixes 2016-09-20 23:25:17 +01:00
Roger A. Light
a71bee494f HASH_DELETE needs to modify subhier. 2016-09-16 12:46:32 +01:00
Roger A. Light
9ddec11f89 Fix Coverity issue 1362805. 2016-09-15 22:22:28 +01:00
Karl Palsson
374c62586e db_dump: use objects to simplify printing (#215)
Prepratory work for providing more filtering of the output dump.
This makes _no_ difference to the current behaviour, but makes it much
simpler for people who "need", for whatever reason, to hack some private
changes into the db_dump tool.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-09-10 13:10:01 +01:00
Karl Palsson
2dec0ed895 broker: fix queue_qos0_messages behaviour
Prior, offline qos0 clients had an unlimited queue depth when
queue_qos0_messages was true.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-09-09 17:27:46 +00:00
Karl Palsson
c6aac741c2 broker: support byte based queueing
Limiting queued message depth purely based on message count is hard to
control for memory constrained devices.  The size of messages can vary
wildly, from a few bytes, to a few kilobytes.  Support a new
max_queued_bytes option, and drop packets when the first limit is
reached.  Option defaults to 0 (disabled) by default.
Support also a max_inflight_bytes variable, with similar behaviour.

Fixes (partof) https://github.com/eclipse/mosquitto/issues/100

This pulls up some helper routines for calculating whether to allow
inflight or queuing, resolving some inconsistences in connection
resumption.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-09-09 17:27:39 +00:00
Karl Palsson
03d4b8c270 websockets: fix compatibility with older lws versions (#260)
In 1.3, 1.4 and 1.5, the function was "libwebsockets_get_protocol" not
"libwebsocket_get_protocol"  While the #define name doesn't matter on
newer libwebsockets, where it redirects to lws_get_protocol, the naming
is critical for older versions.

Fixes: 477cd3e399 (Fix missing context->listener for websocket client)

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-09-08 12:24:29 +01:00
Karl Palsson
8268e6da08 database: drop unnecessary local variable
No need to maintain count and context->msg_count separately.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-08-17 11:14:31 +00:00
Karl Palsson
8a48fd13f1 broker: publish initial load averages
This publishes initial 0 figures for all load averages, as is done for
all the existing counter values in the SYS tree.  This makes the
behaviour of certain variables use for diagnostics (stored count for
instance) more predictable, instead of changing due to the creation of
load topics as soon as the load became non-zero.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-08-17 11:14:31 +00:00
Karl Palsson
30c96f4a1c broker: track stored messages in bytes as well as count
Instead of simply tracking the count of stored messages, keep track of
the total byte size of stored messages.  While only informational at
this point, it provides the basis for byte based limits in the future.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-08-17 10:35:26 +00:00
Karl Palsson
641158aed9 config: garbage line number if file not found
If the file is not found, showing 0 rather than a garbage number is
mildly better.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-08-17 10:27:37 +00:00
Roger A. Light
ee1fd1718b Merge branch 'fixes' 2016-08-16 22:56:28 +01:00
kcallin
7ba3f3d33b [189] Mosquitto database corrupted on power-loss. (#206)
Mosquitto database writes are not atomic and if power is lost during
a write the file will be permanently lost.  This commit makes writes as
atomic as possible.

Signed-off-by: Keegan Callin <kc@kcallin.net>
Bug: https://github.com/eclipse/mosquitto/issues/189
2016-08-16 22:36:58 +01:00
Roger A. Light
ba2de88790 Display error if broker unable to open the log file.
Thanks to Matthew Treinish.

Bug: https://github.com/eclipse/mosquitto/issues/234
2016-08-16 22:31:36 +01:00
Pierre Fersing
477cd3e399 Fix missing context->listener for websocket client (#239)
The context associated with websocket client didn't had listener
filled, which caused use_username_as_clientid to be ignored.

Signed-off-by: Pierre Fersing <pierre.fersing@bleemeo.com>
2016-08-16 22:10:41 +01:00
Roger A. Light
00aa181749 [244] Add note on compiling auth plugin on OSX.
Closes #244.

Bug: https://github.com/eclipse/mosquitto/issues/244
2016-08-12 08:00:56 +01:00
Roger A. Light
b1c4171cdc Merge branch 'develop' of github.com:eclipse/mosquitto into develop 2016-08-10 12:22:39 +01:00
Roger A. Light
bcfa29cbd1 [222] Fix will retained flag handling on Windows.
Thanks to codami.

Bug: https://github.com/eclipse/mosquitto/issues/222
2016-07-22 10:37:30 +01:00
Roger A. Light
883af8af53 Better subtree searching. 2016-07-19 15:05:53 +01:00
tucic
50b26347d4 Writing least significant byte of subscription QoS (#210)
Signed-off-by: Milan Tucic <tucic.milan@gmail.com>
2016-07-12 12:34:59 +01:00
Roger A. Light
0b5d524723 Update defer plugin function signatures. 2016-07-11 14:29:41 +01:00
Roger A. Light
e4db6a760f Backwards compatibility for auth plugins. 2016-07-10 23:17:30 +01:00
Roger A. Light
b40cedaf1d More client accessors. 2016-07-09 21:49:13 +01:00
Roger A. Light
025e56fd4c New mosquitto_auth_psk_key_get() 2016-07-08 13:52:02 +01:00
Roger A. Light
1a6d23feff Bump auth plugin version. 2016-07-08 13:27:31 +01:00
Roger A. Light
b3df015ea7 New mosquitto_unpwd_check(). 2016-07-08 13:27:14 +01:00
Roger A. Light
63f46a999f Add username accessor. 2016-07-08 11:50:50 +01:00
Roger A. Light
ccedc6d709 Moving towards new mosquitto_acl_check(). 2016-07-08 11:26:58 +01:00
Roger A. Light
45ad23c7be mosquitto_broker.h include file for end users. 2016-07-08 10:44:41 +01:00
Roger A. Light
017db6706f Rename mosquitto_broker.h -> mosquitto_broker_internal.h 2016-07-08 10:10:04 +01:00
Roger A. Light
8378fe44cf Update copyrights. 2016-07-08 09:42:24 +01:00
Roger A. Light
56d0f74725 Defer support for TLS-PSK. 2016-07-08 09:36:25 +01:00
Roger A. Light
8fcafcc6aa #define SYS_TREE_QOS 2016-07-08 09:15:28 +01:00
Roger A. Light
1b659b41de sys__ -> sys_tree__ 2016-07-08 09:14:11 +01:00
Roger A. Light
43bcf6799c Move static sys tree entries to sys_tree.c. 2016-07-08 08:46:24 +01:00
Karl Palsson
7cb8988192 websockets: fix compile fail after refactoring (#207)
A lot of function renaming was done in 663d50a016,
and this websockets patch was merged afterwards.  Autobuild testing
doesn't have websockets enabled, and missed this.

Fixes: d9142c3974
Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-07-07 14:19:54 +01:00
Roger A. Light
a04662265a Remove "mosq%d_vacuum" event as vacuum no longer done. 2016-07-03 22:42:43 +01:00
Roger A. Light
d54359598e Move signals/events code to own file. 2016-07-03 22:40:27 +01:00
Dmitry Kaukov
6bf8b59d89 Signalling mosquitto process on Win32, using named events: (#163)
mosqPID_shutdown
mosqPID_reload
mosqPID_backup
mosqPID_vacuum

where PID is the PID of the mosquitto process

Signed-off-by: Dmitry Kaukov <dkaukov@opentable.com>
2016-07-03 22:18:44 +01:00
Roger Light
6eb8b0c0e8 Merge pull request #190 from remakeelectric/db_dump-fixes
Db dump fixes
2016-07-01 15:34:12 +01:00
Roger A. Light
eaef3db142 O_DIRECTORY not supported everywhere, use O_RDONLY. 2016-06-27 20:58:25 +01:00
Roger A. Light
84df2bb923 [189] Call fsync after persisting data.
To ensure it is correctly written. Closes #189.

Thanks to thanhvtruong.

Bug: https://github.com/eclipse/mosquitto/issues/189
2016-06-26 22:48:16 +01:00
Roger A. Light
fff741613e Support for openssl 1.1.0. 2016-06-26 22:00:43 +01:00
Roger A. Light
2b2279363b Bridge defaults to mqtt3.1.1 as per documentation. 2016-06-22 00:04:47 +01:00
Roger A. Light
1c3988a397 Merge branch 'master' into develop 2016-06-21 23:33:58 +01:00
Roger A. Light
2c54104ce3 [191] Fix some $SYS messages being incorrectly persisted.
Closes #191.

Bug: https://github.com/eclipse/mosquitto/issues/191
2016-06-21 17:17:23 +01:00
Roger A. Light
63e3926987 Perform UTF-8 validation on will, sub, unsub topics in the broker. 2016-06-21 17:05:33 +01:00
Karl Palsson
339842b623 db_dump: (trivial) add missing newline in output
Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-06-21 12:29:58 +00:00
Karl Palsson
b1efd9a868 db_dump: properly print uint64_t
store id is a uint64_t, print it consistently.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2016-06-21 12:29:58 +00:00
Roger A. Light
d90cd585dd Add WITH_STRIP build option. 2016-06-13 21:36:41 +01:00
Roger A. Light
23113bb5f5 [7] Don't disconnect client on HUP before reading the pending data.
Closes #7.

Bug: https://github.com/eclipse/mosquitto/issues/7
2016-06-13 17:13:44 +01:00
Roger A. Light
8663d6aff7 Merge branch 'master' of github.com:eclipse/mosquitto 2016-06-07 16:54:53 +01:00
Roger A. Light
1cd40925b8 [184] Don't attempt to install docs when WITH_DOCS=no.
Thanks to minghuadev.

Bug: https://github.com/eclipse/mosquitto/issues/184
2016-06-06 16:11:42 +01:00
Roger A. Light
63416e6547 ; 2016-06-06 16:03:24 +01:00
Roger A. Light
5d96c3d7ba [186] Fix TLS operation with websockets listeners and libwebsockts 2.x.
Bug: https://github.com/eclipse/mosquitto/issues/186
2016-06-06 15:53:05 +01:00
Roger A. Light
ea2baa876c Fix rare possible crash when writing persistence file. 2016-05-31 22:17:27 +01:00
Roger A. Light
ff78cd7873 Fix publishing of $SYS/broker/clients/maximum. 2016-05-31 09:57:28 +01:00
Roger A. Light
6f5f445196 [169] mosquitto_passwd handles unknown cmd args properly.
Closes #169. Thanks to castorgodinho.

Bug: https://github.com/eclipse/mosquitto/issues/169
2016-05-26 09:25:41 +01:00
Roger A. Light
7761218d3c [170] Fix WS listeners not being able to bind to an IP.
Closes #170. Thanks to minghuadev.

Bug: https://github.com/eclipse/mosquitto/issues/170
2016-05-26 09:21:15 +01:00
Roger A. Light
afc2c9951c [57] File missed from previous commit.
Bug: https://github.com/eclipse/mosquitto/issues/57
2016-05-19 15:53:27 +01:00
Roger Light
dfeb2f9ba6 Merge pull request #141 from PierreF/large-queued-performance-2
Improve performance with lots of queued message
2016-05-15 22:31:35 +01:00
Roger A. Light
57da586703 Fix saving of persistence messages that start with a '/'.
Closes #151. Thanks to Andrew Chambers.

Signed-off-by: Roger A. Light <roger@atchoo.org>
2016-05-14 22:39:14 +01:00
Roger A. Light
3048c5ba0d Changelog update.
Fix reconnecting for bridges that use TLS on Windows.

Closes #154.

Thanks to Dmitry Kaukov.
2016-05-14 21:57:09 +01:00
Roger A. Light
6704df8061 Bridge config parameters can now contain a space
Closes #150.

Thanks to Sebastian Koch and Mikkel Kirkgaard Nielsen.

Bug: https://github.com/eclipse/mosquitto/issues/150
2016-04-28 21:54:50 +01:00
Ian Johnson
87112a7e21 On Mac, we don't want to run /sbin/ldconfig as it doesn't exist
Signed-off-by: Ian Johnson <ijohnson@wolfram.com>
2016-04-19 16:56:10 -05:00
Pierre Fersing
18cc0f5fc7 Fix bugs introduced by previous commit
Signed-off-by: Pierre Fersing <pierre.fersing@bleemeo.com>
2016-04-18 17:48:53 +02:00
Pierre Fersing
44f23252a0 Improve performance with lots of queued message
Split message queue in two queues: in-flight and queued to avoid the
need to iterate over all messages.

Signed-off-by: Pierre Fersing <pierre.fersing@bleemeo.com>
2016-04-18 16:24:13 +02:00
Frank Busse
10bb523854 fix 16 byte memory leak
Adds missing free for config->pid_file in mqtt3_config_cleanup.

Signed-off-by: Frank Busse <bb0xfb@gmail.com>
2016-03-24 13:34:39 +01:00
Frank Busse
defbfbd185 DOS: use-after-free in ACL message handling
Removing the last message in queue because of an ACL leaves last_msg
in a corrupted state. Therefore an unauthorized attacker may cause a
segfault of the broker.

Signed-off-by: Frank Busse <bb0xfb@gmail.com>
2016-03-24 13:19:45 +01:00
Roger A. Light
37dceb38f9 Fix some defects discovered by coverity. 2016-03-18 11:54:36 +00:00
Roger A. Light
09ea5cbf2c mosquitto_db_dump can now output some client stats.
This may be useful for finding out which clients are using significant
amounts of persistence space.
2016-03-15 00:18:40 +00:00
Roger A. Light
69a08ab905 Fix string quoting in CMakeLists.txt. Closes #4. 2016-03-13 20:33:08 +00:00
Roger A. Light
1b190b14f1 Fix auth deferring with no pwfile defined. 2016-03-13 07:21:31 +00:00
Roger A. Light
db2e66c543 Reorganise functions into separate files as appropriate. 2016-03-12 21:49:48 +00:00
Roger A. Light
6087d4bcb6 Fix incorrect calloc/mosquitto__free pair. 2016-03-12 13:27:25 +00:00
Roger A. Light
fda0cb3d45 Fix incorrect $SYS heap memory reporting when using ACLs. 2016-03-12 13:25:20 +00:00
Roger A. Light
abc2f3f9de Network errors are printed correctly on Windows. 2016-03-07 20:57:22 +00:00
Roger A. Light
a79412e3d8 Fix compile error from library keepalive handling. 2016-03-06 19:49:20 +00:00
Roger A. Light
1065a0f202 Will topic isn't truncated when using a mount_point. 2016-03-05 22:38:05 +00:00
Roger A. Light
6bac3f072c Reconnecting client doesn't start with mid=1 again. 2016-03-05 22:34:05 +00:00
Roger A. Light
d9142c3974 [476314] Deliver queued WS client msgs on reconnect.
Thanks to Joking Young and Christoph Krey.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=476314
2016-03-05 22:31:52 +00:00
Roger A. Light
af995d211d Fix client library keepalive handling.
Fix the case where a message received just before the keepalive timer
expired would cause the client to miss the keepalive timer.

Thanks to Graham Benton.
2016-02-28 17:24:43 +00:00
Roger A. Light
f588075931 [485589] Close stdin etc. when daemonised.
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=485589
2016-02-11 21:49:55 +00:00
Roger A. Light
eb514c9707 [487178] Obey mount_point when publishing wills.
Wills published by clients connected to a listener with mount_point defined
now correctly obey the mount point. This was a potential security risk
because it allowed clients to publish messages outside of their restricted
mount point. This is only affects brokers where the mount_point option is in
use.

Thanks to Lance Riley.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=487178
2016-02-11 21:17:55 +00:00
Roger A. Light
bd906e6753 Fix merge error. 2016-01-26 15:55:17 +00:00
Roger A. Light
b83c58763d Add mosquitto_subscribe_single()/multiple(). 2016-01-25 23:12:33 +00:00
Roger A. Light
af96c0b8fa [485143] Futher fix for broken win32 connections. 2016-01-19 14:05:39 +00:00
Roger A. Light
00491da031 [485143] Fix detection of broken connections on Windows.
Thanks to Pierre-Yves Boisbunon.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=485143
2016-01-14 21:15:02 +00:00
Roger A. Light
51f275bd02 Error messages for websockets init failure. 2016-01-07 21:56:16 +00:00
Roger A. Light
fca9ac84f7 Merge fixes into develop. 2016-01-06 21:10:34 +00:00
Roger A. Light
2549919413 Fix support for libwebsockets 1.22. 2015-12-21 11:32:02 +00:00
Roger A. Light
7aa653c42f Add support for libwebsockets 1.6. 2015-12-19 01:21:17 +00:00
Roger A. Light
559e2438cb Revert "Add support for sending direct messages to clients."
This reverts commit 8f54cde293.
2015-11-18 12:27:23 +00:00
Roger A. Light
8f54cde293 Add support for sending direct messages to clients.
This works through $CLIENT/direct/<client id>, using the
allow_direct_messages option.
2015-11-13 21:01:56 +00:00
Roger A. Light
80300f8fa1 [468987] Free unused topic tree elements.
Fix in 1.4.3 was incomplete.

Thanks to Guido Hinderberger et al.
2015-11-08 20:23:07 +00:00
Roger A. Light
4b9b792d16 Update all mqtt 3.1 references to 3.1.1 where appropriate. 2015-10-24 21:50:19 +01:00
Roger A. Light
26eac3c1ca Fix possible memory leak with bridges and SSL.
Fix possible memory leak if bridge using SSL attempts to connect to a
host that is not up.

Thanks to Ed Morris.
2015-10-12 14:48:52 +01:00
Roger A. Light
4afe1a1502 Swap plugin+built in order. 2015-10-02 21:44:39 +01:00
Roger A. Light
f5f5d3885d Fix incorrect defines. 2015-09-29 12:34:56 +01:00
Roger A. Light
0d449d31b8 strlen(x) == 0 -> STREMPTY(x) 2015-09-22 14:47:12 +01:00
Roger A. Light
b4fbe904d4 Remove more unnecessary "if(x) mosquitto__free(x)" checks. 2015-09-22 14:42:56 +01:00
Roger A. Light
436d3fac19 Merge branch 'fixes' into develop
Conflicts:
	CMakeLists.txt
	ChangeLog.txt
	config.mk
	installer/mosquitto.nsi
	installer/mosquitto64.nsi
	lib/mosquitto.c
	lib/mosquitto.h
	src/loop.c
2015-09-22 14:18:12 +01:00
Roger A. Light
ed97a3b2f1 Fix potential memory leaks. 2015-09-22 14:08:10 +01:00
Roger A. Light
9fb288d283 Fix malloc/_mosquitto_free mismatch. 2015-09-22 14:04:47 +01:00
Roger A. Light
9a2eb2038f Drop Windows XP support, misc fixes on Windows. 2015-09-22 10:03:57 +01:00
Roger A. Light
011de7ed19 Fix excessive calls to message retry check. 2015-09-16 22:14:26 +01:00
Roger A. Light
2597da17c2 [475807] Fix cross compiling of websockets.
Thanks to Tyler Brandon.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475807
2015-09-16 21:13:03 +01:00
Roger A. Light
0c0961f6a4 [477571] Fix socket leak with bridges.
Don't leak sockets when an outgoing bridge connection with multiple
addresses is rejected.

Thanks to Johnny Egeland.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=477571
2015-09-16 17:39:00 +01:00
Roger Light
e2324ff9bb Merge remote-tracking branch 'remotes/origin/master' into develop
Conflicts:
	CMakeLists.txt
	ChangeLog.txt
	THANKS.txt
	appveyor.yml
	config.mk
	installer/mosquitto-cygwin.nsi
	installer/mosquitto.nsi
	lib/messages_mosq.c
	lib/messages_mosq.h
	lib/mosquitto.c
	lib/mosquitto.h
	lib/net_mosq.c
	lib/net_mosq.h
	lib/send_client_mosq.c
	lib/send_mosq.c
	lib/socks_mosq.c
	lib/will_mosq.c
	src/bridge.c
	src/conf.c
	src/context.c
	src/database.c
	src/loop.c
	src/mosquitto.c
	src/mosquitto_broker.h
	src/net.c
	src/read_handle.c
	src/read_handle_server.c
	src/subs.c
2015-09-09 22:02:46 +01:00
Roger A. Light
201bb1a04a Fix potential crash on libwebsockets error. 2015-08-18 23:33:55 +01:00
Roger A. Light
3f86d316d8 Allow mosquitto__free(NULL).
Remove all unnecessary "if(X)" before a call to mosquitto__free.
2015-08-18 14:53:22 +01:00
Roger A. Light
2172ffb56c [470253] Fix potential memory leaks.
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=470253
Also-by: Wun Yu <wuyun1984_1984@163.com>
2015-08-17 22:10:26 +01:00
Roger A. Light
ab7f212b7e [468987] Free unused topic elements.
Reduces memory usage and CPU usage.

Thanks to Guido Hinderberger, Martin Rauscher and Michael Hekel.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=468987
2015-08-17 21:25:30 +01:00
Anmol Sarma
13d869b8df Avoid calls to strlen() when checking for empty strings.
Change-Id: I3de322006623483cbf20218da071a9da5d7b2e2b
Signed-off-by: Anmol Sarma <me@anmolsarma.in>
2015-08-17 16:00:16 -04:00
Roger A. Light
e49e398eb3 Fix handling of outgoing QoS>0 messages for bridges.
Fix handling of outgoing QoS>0 messages for bridges that could not be
sent because the bridge connection was down.
2015-08-17 20:50:41 +01:00
Anmol Sarma
343e833fd9 Remove superfluous branch.
Signed-off-by: Anmol Sarma <me@anmolsarma.in>
2015-08-10 09:33:05 -04:00
Roger A. Light
4c147309a4 Minimum supported libwebsockets version is now 1.3. 2015-07-08 09:07:48 +01:00
Roger A. Light
300034f868 Initialise all plugins, not just the first. 2015-07-02 10:26:57 +01:00
Roger A. Light
e773ea1bee [464543] Run default checks after plugins. 2015-06-29 23:31:39 +01:00
Roger A. Light
5c642c9cfd [464543] Add defer support for plugins.
Partial fix for 464543.
2015-06-29 22:33:01 +01:00
Roger A. Light
a4dad02064 [470246] Change sys tree print output on USR2.
Thanks to Yun Wu.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=470246
2015-06-29 21:24:16 +01:00
Roger A. Light
e0037b348f [465438] Fix incorrect behaviour for autosave_interval.
Thanks to Jaime Yu.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=465438
2015-06-29 17:11:16 +01:00
Roger A. Light
6f193de3a5 [470258] Don't make unnecessary copies of payload in db__messages_store.
Along with the previous commit this closes #470258.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=470258
2015-06-28 22:25:49 +01:00
Roger A. Light
9bccd31b36 Don't make unnecessary copies of topic in db__messages_store. 2015-06-28 21:16:48 +01:00
Roger A. Light
bfd743f42d Updated uhpa code with "move" function. 2015-06-28 16:59:03 +01:00
Roger Light
6fe5de46b4 Merge "[471053] Add systemd support and services." into develop 2015-06-26 06:45:42 -04:00
Tomas Novotny
29731b5e46 [471053] Add systemd support and services.
Add possibility to notify systemd that service is fully started. Also add
reference service files.

Change-Id: Ib4e39c8406ab6c15e1b88f197ae8f91c3e402023
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=471053
Signed-off-by: Tomas Novotny <novotny@rehivetech.com>
2015-06-26 10:29:39 +02:00
Roger A. Light
dc5abcac95 [470660] Handle fragmented TLS packets without a delay.
Thanks to Martin Rauscher.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=470660
2015-06-25 10:53:24 +01:00
Tomas Novotny
45d5686fdb Add missing CROSS_COMPILE.
CROSS_COMPILE variable is missing before websockets, so cross compilation
fails.

Signed-off-by: Tomas Novotny <novotny@rehivetech.com>
2015-06-22 20:18:35 +02:00
Roger A. Light
7657aac584 [469467] Fixes and documentation to use_subject_as_username patch.
This is for certificate based client authentication.

Thanks to Fabian Ruff.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=469467
2015-06-12 22:52:15 +01:00
Fabian Ruff
f0511d0ff7 Add user_subject_as_username option
This adds an alternative option to use_identity_as_username.
In contrast to use_identity_as_username this option uses the full x509 subject as the username.
The subject is formatted as an rfc4514 distingushed name e.g. CN=client,OU=unit,O=org

Signed-off-by: Fabian Ruff <fabian@progra.de>
2015-06-12 22:28:36 +01:00
Roger A. Light
e469843ed9 Produce an error if two bridges share the same local_clientid. 2015-06-09 23:18:13 +01:00
Roger A. Light
cdbe62c2bb Outgoing messages with QoS>0 are no longer retried after a timeout.
This change in behaviour can be justified by considering when the
timeout may have occurred.

* If a connection is unreliable and has dropped, but without one end
  noticing, the messages will be retried on reconnection. Sending
  additional PUBLISH or PUBREL would not have changed anything.

* If a client is overloaded/unable to respond/has a slow connection then
  sending additional PUBLISH or PUBREL would not help the client catch
  up. Once the backlog has cleared the client will respond. If it is not
  able to catch up, sending additional duplicates would not help either.
2015-05-24 11:59:53 +01:00
Roger A. Light
0733b3f68b Fix use of sprintf. 2015-05-21 17:15:10 +01:00
Roger A. Light
4195fde70b Last raft of renames for the moment. 2015-05-18 09:29:22 +01:00
Roger A. Light
21946ace6c mosquitto__log_printf -> log__printf 2015-05-18 08:53:21 +01:00
Roger A. Light
cdb1cf9b13 Remove typos. 2015-05-17 07:31:54 +01:00
Roger A. Light
15b291eaa4 Remove unsigned comparison against <0.
Coverity CID 1292471.
2015-05-17 07:04:41 +01:00
Roger A. Light
b67c90ec02 Rename internal datatypes. 2015-05-16 19:03:12 +01:00
Roger A. Light
3c703408f2 More function renaming. 2015-05-16 18:43:06 +01:00
Roger A. Light
94ef6ec7bb Big set of function renames. 2015-05-16 15:24:24 +01:00
Roger A. Light
1744477cf8 Rename/reorganise packet functions. 2015-05-16 14:16:40 +01:00
Roger A. Light
8049c4b7f8 Simplify code around SYS statistics gathering. 2015-05-16 12:25:35 +01:00
Roger A. Light
a6827df6c0 [467096] Fix incorrect bridge notification.
If a custom notification topic was used, the bridge status would be set
to 1 before a connection was attempted, this has been fixed.

Initial updates to the status topic are now only set once, when the
broker starts, rather than each time the bridge attempts to reconnect.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=467096
2015-05-16 12:05:17 +01:00
Roger A. Light
6f2fe06f0b [464811] Fix handling of payload lengths>4096 with websockets.
Thanks to Arjen van Elteren and Stephen Zeng.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=464811
2015-05-06 16:40:10 -05:00