Commit Graph

559 Commits

Author SHA1 Message Date
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
Roger A. Light
121c2ca002 Broker will return CONNACK rc=5 when a client is not authorised.
This was being incorrectly set as rc=4.
2015-05-06 04:54:11 -05:00
Roger A. Light
b598aec385 Sys -> user includes. 2015-04-29 21:37:47 +01:00
Roger A. Light
970ba58da6 Code reorganise. 2015-04-29 21:23:59 +01:00
Roger A. Light
ec2fcce43b Don't send websockets messages if the message is queued. 2015-04-29 10:16:59 +01:00
Roger A. Light
11d0d887f0 Fix parsing of auth_opt_ arguments with extra spaces/tabs. 2015-04-24 20:57:30 +01:00
Roger A. Light
cc7beb62a5 [465384] Fix crash on Windows when using bridges.
Thanks to Stefan Rosskopf.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=465384
2015-04-24 09:34:24 +01:00
Roger A. Light
11756d24c8 Change internal funcs _foo_bar() to foo__bar(). 2015-04-19 22:10:59 +01:00
Roger A. Light
21b372ed9e ACLs are now checked before sending a will message. 2015-04-18 22:16:57 +01:00
Roger A. Light
991f1173d7 Fix persistent db writing on Windows.
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=464779
2015-04-17 21:51:24 +01:00
Roger A. Light
1bdd6c36a8 Fix incorrect bridge connection notifications on local broker. 2015-04-17 21:51:21 +01:00
Roger A. Light
90dc6d8c4c Don't use uhpa for whole topics, unlikely to be of benefit. 2015-04-11 21:17:16 +01:00
Roger A. Light
0ddd438161 Helper macros. 2015-04-05 10:02:16 +01:00
Roger A. Light
c7d6c1a865 UHPA comments. 2015-04-04 23:58:18 +01:00
Roger A. Light
2da74ad043 Use uhpa for topics. 2015-04-04 21:15:27 +01:00
Roger A. Light
2ecee163ef Use uhpa for payloads. 2015-04-01 09:35:40 +01:00
Roger A. Light
960b3ef32d Fix possible minor memory leak on acl parsing. 2015-03-30 22:26:44 +01:00
Roger A. Light
dacee786be [463000] Use own type to simplify socket handling.
Means that SOCKET is used as the socket type everywhere on Windows.
2015-03-29 10:43:08 +01:00
Roger A. Light
7cd14725da Fix compiler warning. 2015-03-28 15:16:15 +00:00
Roger A. Light
502c3e7563 [461619] Disconnect idle websockets clients.
Websockets clients are now periodically disconnected if they have not
maintained their keepalive timer.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=461619
2015-03-27 20:50:16 +00:00
Roger A. Light
35b729909c [463241] Fix possible crash under heavy network load.
Thanks to Alexandre Zia.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=463241
2015-03-27 01:07:48 +00:00
Roger A. Light
ccc8a81187 Ignore multiple spaces when parsing acl files. 2015-03-26 22:37:01 +00:00
Roger A. Light
c6450ac265 [462154] Fix problems parsing config strings with leading spaces.
Thanks to Aidan Gill.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=462154
2015-03-15 20:49:18 +00:00
Roger A. Light
28404350c4 Fix possible crash when using pattern ACLs. 2015-03-08 21:00:15 +00:00
Roger A. Light
3a36ae843b Fix lws 1.3 detection. 2015-02-23 15:20:23 +00:00
Roger A. Light
fcf91f9cd9 Fix compiling on Linux with CMake. 2015-02-22 12:20:29 +00:00
Roger A. Light
279b67bf8d Minor packaging related fixes. 2015-02-18 01:34:43 +00:00
Roger A. Light
f04c10e609 Fix incorrectly committed change. 2015-02-17 23:23:13 +00:00
Roger A. Light
ff3ebd969b Fix building on OS X. 2015-02-17 23:21:14 +00:00
Roger A. Light
ff9c2087b1 Basic support for libwebsockets 1.2.x. 2015-02-16 22:02:34 +00:00
Roger A. Light
2098d6a392 Remove debug line. 2015-02-15 20:10:46 +00:00
Roger A. Light
91c1972c1f Consistent error message. 2015-02-14 13:08:49 +00:00
Roger A. Light
db86809ee9 Add websockets logging options. 2015-02-13 22:57:49 +00:00
Roger A. Light
6fd38b8c47 Windows fixes. 2015-02-13 21:18:52 +00:00
Roger A. Light
3ed5c94038 Struct optimisations. 2015-02-13 21:17:11 +00:00
Roger A. Light
8b1560def0 Parse config strings as entire line. 2015-02-12 22:48:28 +00:00
Roger A. Light
f781498c03 Ensure that file logging uses the correct username. 2015-02-08 22:06:11 +00:00
Roger A. Light
626857b20a Close and reopen log_dest file on HUP. 2015-02-05 22:44:38 +00:00
Roger A. Light
c276fd9572 When using "log_dest file" the output file is now flushed periodically. 2015-02-05 22:29:49 +00:00
Roger A. Light
22e09ae613 [455402] Fix potential hang with pattern acls.
Fix hang if pattern acl contains a %u but an anonymous client connect.

Thanks to Christoph Krey.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=455402
2015-01-27 23:33:36 +00:00
Roger A. Light
45b8220a82 [458690] Fix build for WITH_BRIDGE=no
Thanks to Alexandre Zia.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458690
2015-01-27 23:33:36 +00:00
Roger A. Light
8eda59c1d9 [452927] Fix bind()/listen() error reporting on Windows.
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=452927
2015-01-28 20:56:51 +00:00
Roger A. Light
1b4903b41e [431780] ACL files can contain a space in username/topic.
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=431780
2015-01-27 23:33:36 +00:00
Roger A. Light
153e6e6211 [452914] Drop root privileges after listeners started.
This means that TLS private keys can be restricted to the root user.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=452914
2015-01-27 23:33:36 +00:00
Roger A. Light
87d8e1f705 Bridge support for MQTT v3.1.1. 2015-01-27 17:12:36 +00:00
Roger A. Light
34176359c9 [452913] Prevent dereferencing of NULL string.
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=452913
2015-01-26 21:02:53 +00:00
Roger A. Light
96d98e620b Fix compiling on Apple. 2015-01-24 22:18:28 +00:00
Roger A. Light
0adb2ed217 [425835] Support for "hour client expiration times.
This allows shorter values for the persistent_client_expiration option.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=425835
2015-01-15 21:57:03 +00:00
Roger A. Light
aca979a473 [457371] Fix building for WITH_TLS=no
Thanks to Micheal Laing.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=457371
2015-01-15 20:11:14 +00:00
Roger A. Light
8a18f577a6 Remove more unnecessary uses of calloc. 2015-01-14 21:56:57 +00:00
Roger A. Light
97849e8825 Remove unnecessary uses of calloc. 2015-01-14 21:43:39 +00:00
Roger A. Light
cfe1156eb7 Reference count store structs when reloading from db.
Without this increment, a message could be incorrectly freed in rare
circumstances.
2015-01-08 18:41:14 +00:00
Roger A. Light
b52e3311d2 Disconnect websockets clients properly.
context->state was being overwritten when websockets clients
attempted to disconnect, leaving them in limbo. This has been fixed.

Thanks to FeelyChau.
2015-01-07 23:33:31 +00:00
Roger A. Light
faaf3edd02 Fix library linking with CMake.
When using CMake it wasn't possible to use libwrap due to a
configuration error. This has been fixed.

Thanks to Markus Rathgeb.
2015-01-07 22:18:39 +00:00
Roger A. Light
175794826b [456899] Broker: Add bridge_attempt_unsubscribe option.
The bridge_attempt_unsubscribe option has been added, to allow the sending
of UNSUBSCRIBE requests to be disabled for topics with "out" direction.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=456899
2015-01-07 21:50:10 +00:00
Roger A. Light
778bd4ca25 Clear store variable correctly here. 2015-01-06 17:37:56 +00:00
Roger A. Light
0e72d3cc32 Should check acl result for lack of success, not presence of error. 2015-01-06 17:35:46 +00:00
Roger A. Light
f8f794c531 Allow expiring clients to be cleaned up. 2015-01-06 17:35:12 +00:00
Roger A. Light
b30adbf792 Remove incorrectly committed file. 2015-01-06 11:25:25 +00:00
Roger A. Light
fb588ef434 Print dlerror on library loading errors. 2014-11-20 22:33:40 +00:00
Roger A. Light
85a294922e Protect stored messages from removal when queing. 2014-11-20 21:13:21 +00:00
Roger A. Light
5b6f6976c7 Fix use of "dup" with pubrel, subscribe, unsubscribe.
Thanks to Paolo Patierno.
2014-11-19 21:28:52 +00:00
Roger A. Light
2ce4d94282 Fix dereferencing of msg store items. 2014-11-19 20:59:10 +00:00
Roger A. Light
db3c016fdd Don't use bridge hash in each client.
Store a DB wide array of bridges. There shouldn't be many of them, so
iterating/searching isn't a problem. Saves 56 bytes in the client
struct.
2014-11-18 23:34:54 +00:00
Roger A. Light
1e64bb171a More memory efficient message store than with hashes.
Also frees messages from the message store after removing...
2014-11-18 19:12:08 +00:00
Roger A. Light
d30d711c3b Improve struct layouts for memory usage. 2014-11-18 07:42:49 +00:00
Roger A. Light
ea8537c048 Remove unused messages from store immediately.
This removes the need for *store_clean*.
2014-11-17 23:46:02 +00:00
Roger A. Light
4374170c40 Use hash for message store to speed up loading.
Comes at the expense of increased memory usage. This could be countered
by using a hash just for loading (increased memory usage during loading,
reduced afterwards) but this approach does allow the immediate removal
of messages from the store.
2014-11-17 22:54:39 +00:00
Roger A. Light
9b9f1c7613 Remove unnecessary callocs. 2014-11-17 22:00:00 +00:00
Roger A. Light
975b127d17 Sanitise password file argv input. 2014-11-17 21:00:33 +00:00
Roger A. Light
36f88d902d Fix errors from big code import. 2014-11-12 20:47:16 +00:00
Roger A. Light
00d951e6d6 Allow plugins to call mosquitto_log_printf() (Linux only at the moment). 2014-11-03 08:45:56 +00:00
Roger A. Light
fc1e514ad4 Add log_facility for non-Windows OSs. 2014-11-02 21:49:33 +00:00
Roger A. Light
0a86aee5fb Authentication plugin acl_check function is passed local_username for local bridges. 2014-10-29 22:11:18 +00:00
Roger A. Light
ab49b96db1 Windows related fixes. 2014-10-26 21:17:08 +00:00
Roger A. Light
6524115f45 Error if websockets not available. 2014-10-25 00:46:58 +01:00
Roger A. Light
052c2d7766 Fix for Windows. 2014-10-24 22:49:48 +01:00
Roger A. Light
041f60c03e Make bridge connections non-blocking for TLS connections. 2014-10-24 22:39:09 +01:00
Roger A. Light
c92e2f5581 Declare variables before code. 2014-10-24 21:57:33 +01:00
Roger A. Light
a1f18323d1 Make bridge connections non-blocking for non-TLS connections. 2014-10-24 21:28:24 +01:00
Roger A. Light
4ff6a6aa49 Remove duplicate strlen check. 2014-10-23 17:30:09 +01:00
Roger A. Light
66443c14bd Assign to NULL to prevent double free later. 2014-10-21 23:11:31 +01:00
Roger A. Light
7a2dd634cb Protect against possible NULL dereference after unsubscribing. 2014-10-20 18:01:45 +01:00
Roger A. Light
372b64a290 More "client has disconnected but is not freed" protections. 2014-10-17 00:08:10 +01:00
Roger A. Light
c8dffcbfbb Fixes for clientid stealing situation. 2014-10-16 23:48:56 +01:00
Roger A. Light
02be4965ea Don't rearrange leaves here until we are sure we have all the memory allocated. 2014-10-16 23:18:12 +01:00
Roger A. Light
eb01459571 Protect against client->id NULL dereference. 2014-10-16 23:06:47 +01:00
Roger A. Light
065c6356d4 Don't derefence NULLs. 2014-10-16 23:04:26 +01:00
Roger A. Light
7746427b07 Record client subs correctly. 2014-10-16 22:35:05 +01:00
Roger A. Light
43b1ea8050 Memory leak and id stealing fixes. 2014-10-12 23:58:49 +01:00
Roger A. Light
e3bf10cd9a Change the way that new clients with match client ids are dealt with.
This change means that the connection isn't swapped from new context to
old, which makes dealing with websockets lots easier. It does require
that clients storing a list of their subscriptons.
2014-10-12 11:38:21 +01:00
Roger A. Light
d2dbe16d68 Client structs store sub information to make _subs_clean_session more efficient. 2014-10-09 23:28:16 +01:00
Roger A. Light
070d783c9f Merge 1.3.2-1.3.5 into 1.4. 2014-10-12 11:17:13 +01:00
Roger A. Light
1a47f86648 Typo fix. 2014-10-08 22:48:47 +01:00
Roger A. Light
8cb9b195e5 When using -v and the broker receives a SIGHUP, verbose logging was being disabled. This has been fixed. 2014-10-08 21:38:01 +01:00
Roger A. Light
bad7ec75f0 Temporarily disable ACL checks on subscriptions when using MQTT v3.1.1.
This is due to the complexity of checking wildcard ACLs against wildcard
subscriptions. This does not have a negative impact on security because
checks are still made before a message is sent to a client.  Fixes bug

Thanks to Jan-Piet Mens and Christoph Krey.
2014-10-08 21:16:34 +01:00
Roger A. Light
429c892557 Fix saving persistent database on Windows.
Thanks to Daniel Degasperi.
2014-10-08 20:51:17 +01:00
Roger A. Light
43556537e3 Don't ask for client cert when require_certificate is false. 2014-10-07 23:20:46 +01:00
Roger A. Light
4a19d9ae3a Fix possible memory leak when using a topic that has a leading slash.
Fixes bug #1360986.
2014-10-05 21:24:08 +01:00
Roger A. Light
950c4ed9c6 Check return value of fseek for errors. 2014-09-23 00:45:12 +01:00
Roger A. Light
84214bcd99 Simplify appending of topics when tokenising. Helps remove dead code. 2014-09-23 00:42:25 +01:00
Roger A. Light
aa2e6a8d29 Fix possible NULL derefence. 2014-09-23 00:35:51 +01:00
Roger A. Light
db9d6b9f3d Fix potential memory leak from context->current_out_packet. 2014-09-23 00:32:34 +01:00
Roger A. Light
154b2fc264 Must remove memory reference here. 2014-09-22 23:37:19 +01:00
Roger A. Light
dcd469c177 Use own linked list for storing disused contexts for freeing.
Seemed to be a problem with getting it to work under a hash and there
isn't really any need for a hash.
2014-09-22 23:35:09 +01:00
Roger A. Light
2a922e9f06 Fix verbose logging on reload. 2014-09-22 23:05:29 +01:00
Roger A. Light
e561b5ea08 Windows fix. 2014-09-19 10:43:14 +01:00
Roger A. Light
7fb629d818 Fix potential leak. 2014-09-19 00:56:37 +01:00
Roger A. Light
58c857c473 Fix for windows. 2014-09-19 00:35:10 +01:00
Roger A. Light
58a7565a2b Check http request directories on Windows. 2014-09-17 23:14:22 +01:00
Roger A. Light
99779c03c7 Fix reporting of local bridge status. 2014-09-17 22:40:49 +01:00
Roger A. Light
65526d2746 No need to call lws_partial_buffered() here. It is never set at the start of a callback. 2014-09-17 22:27:18 +01:00
Roger A. Light
f61a8cbf74 Get address for websockets clients. 2014-09-17 22:19:45 +01:00
Roger A. Light
91fa1c9625 Disable ipv6 websockets. 2014-09-17 21:55:02 +01:00
Roger A. Light
2bf7a8fb13 Prevent NULL derefencing and accessing of freed memory. 2014-09-17 21:53:39 +01:00
Roger A. Light
3d58f5ed82 Some minor memory leak fixes. 2014-09-17 21:50:08 +01:00
Roger A. Light
1fb5a3edc6 Use hash counts to calculate numbers of clients. 2014-09-17 00:03:14 +01:00
Roger A. Light
3eead8c507 retained_ and subscription_count only used with sys tree. 2014-09-16 23:48:26 +01:00
Roger A. Light
7b1ee68ef1 Remove compilation warnings for various configurations. 2014-09-15 22:13:13 +01:00
Roger A. Light
dd36c4b273 Don't attempt to find real path of NULL. 2014-09-15 21:43:44 +01:00
Roger A. Light
9286da192e Fix unused var. 2014-09-14 18:12:30 +01:00
Roger A. Light
f9951595c8 Fix missing headers. 2014-09-14 18:08:09 +01:00
Roger A. Light
06bec1083d Expose mosquitto_pub_topic_check() and mosquitto_sub_topic_check(). 2014-09-10 15:57:20 +01:00
Roger A. Light
3c5ca95c81 File serving from http on *nix. 2014-09-08 23:25:02 +01:00
Roger A. Light
b84ca80052 Skeleton callback_http() function. 2014-09-08 18:39:51 +01:00
Roger A. Light
f500ff78b8 no_buffer_all_partial_tx not in latest LWS. 2014-09-08 18:24:12 +01:00
Roger A. Light
c4e7233159 Add http_dir option (not yet used). 2014-09-08 18:21:53 +01:00