Commit Graph

149 Commits

Author SHA1 Message Date
Roger A. Light
7ff9c3763b Fix socks build when using cmake. 2019-02-08 13:01:07 +00:00
Roger A. Light
f952ae3a67 Fixed durable clients being unable to receive messages when offline.
This occurred when per_listener_settings was set to true.

Closes #1081. Thanks to dwin-wangjt.
2019-02-08 13:01:07 +00:00
Matthias Stone
4325c44baf Don't clear SSL context when TLS connection is closed.
Previous behaviour would clear the external SSL_CTX provided by
MOSQ_OPT_SSL_CTX. This required the user to reset the SSL_CTX every
disconnect, and trust that they were not leaking references.

Recreating the SSL context for every connection is not necessary, and the
SSL context is freed in mosquitto_destroy, which is sufficient.

Signed-off-by: Matthias Stone <matthias@bellstone.ca>
2019-02-08 13:01:07 +00:00
Roger A. Light
e8320cbf19 Fix TLS connections not working over SOCKS.
Thanks to Mark Oeltjenbruns.
2019-02-08 13:01:07 +00:00
Roger A. Light
be9c1071b0 Fix compilation when openssl deprecated APIs are not available.
Closes #1094. Thanks to Rosen Penev.
2019-02-08 13:01:07 +00:00
Roger A. Light
fcf4cd0b27 Merge branch 'master' into mqtt5 2018-12-19 14:11:11 +00:00
Roger A. Light
a00dd29af8 Fix building where TLS-PSK is not available.
Closes #68.
2018-12-11 10:55:31 +00:00
Roger A. Light
e169f1c7c2 When using ADNS, don't ask for all network protocols when connecting.
This can lead to confusing "Protocol not supported" errors if the
network is down, because UDP sockets are provided.

Thanks to jsaak.

Closes #1062.

Bug: https://github.com/eclipse/mosquitto/issues/1062
2018-12-04 12:39:00 +00:00
Roger A. Light
0a9ee5b4cf Fix memory leak when reconnecting with TLS errors.
Fix memory leak that occurred if mosquitto_reconnect() was used when TLS
errors were present.

Closes #592. Thanks to smartdabao and aaronovz1.
2018-10-23 10:46:55 +01:00
Roger Light
6c9e8d51c2 Merge branch 'develop' into mqtt5 2018-10-02 11:28:03 +01:00
Roger A. Light
0bacff11df Rename mqtt3_protocol.h -> mqtt_protocol.h. 2018-09-19 10:58:12 +01:00
Fredrik Fornwall
915e91d9be Fix build with OPENSSL_NO_ENGINE
Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2018-09-18 15:02:32 +01:00
Roger A. Light
0ec090f31a Fixes for building on FreeBSD. 2018-08-15 17:02:56 +01:00
Roger A. Light
10b19a42ed Fixes for building on NetBSD.
Closes #258.

Thanks to Daniel Ölschlegel.
2018-08-09 15:21:40 +01:00
Roger A. Light
c757cb0912 Remove incorrect comment. 2018-08-09 15:01:39 +01:00
Roger A. Light
e185d18917 Better fix for #851.
Ensure all sockets that are closed are set to INVALID_SOCKET.

Signed-off-by: Roger A. Light <roger@atchoo.org>
2018-08-08 15:23:03 +01:00
Roger A. Light
575dce91f0 Fix segfault on startup if bridge CA certificates could not be read.
Closes #851.

Thanks to chelliwell.

Signed-off-by: Roger A. Light <roger@atchoo.org>
2018-08-02 15:06:09 +01:00
Roger A. Light
4bacbecb1b Fix some places where return codes were incorrect.
Closes #850.

Signed-off-by: Roger A. Light <roger@atchoo.org>
2018-08-02 14:41:04 +01:00
Roger A. Light
bcf76b9cb6 Remove use of AI_ADDRCONFIG.
Closes #869, #901.

Thanks to Alex Richman.

Signed-off-by: Roger A. Light <roger@atchoo.org>
2018-08-02 01:11:31 +01:00
Roger A. Light
286400abcf Use AF_UNSPEC etc. instead of PF_UNSPEC to comply with POSIX.
Closes #863.

Thanks to denigmus and Patrick TJ McPhee.

Signed-off-by: Roger A. Light <roger@atchoo.org>
2018-08-02 00:27:52 +01:00
Roger A. Light
e90a32835b Merge branch 'fixes' into develop 2018-05-02 22:24:49 +01:00
Roger A. Light
6c7ecd7e97 Fix compiling without TLS. 2018-05-02 21:04:42 +01:00
Thomas Beckmann (M-Way)
ee610ab19a _mosquitto_net_read must call WSASetLastError when changing errno so that the error code can be picked up by _mosquitto_packet_read
Signed-off-by: Thomas Beckmann (M-Way) <t.beckmann@mwaysolutions.com>
2018-04-13 12:09:26 +01:00
Roger A. Light
e961bc9301 Comment to aid init_ssl_ctx understanding. 2018-04-12 21:37:44 +01:00
Roger A. Light
b649799c78 Protect mosq->ssl_ctx against double initialisation. 2018-04-12 01:11:46 +01:00
Roger A. Light
943b311344 Don't use deprecated openssl functions. 2018-04-11 22:10:48 +01:00
Roger A. Light
24d68b5af8 Remove support for openssl 1.0.0 and 1.0.1.
These are no longer supported by openssl.
2018-04-11 17:12:25 +01:00
Roger A. Light
8470ca89b9 Add MOSQ_OPT_SSL_CTX and MOSQ_OPT_SSL_CTX_WITH_DEFAULTS options.
Closes #567 and #715.
2018-04-11 16:34:24 +01:00
Roger A. Light
f4d238be18 Bump copyright years. 2018-04-11 15:24:29 +01:00
Thomas Beckmann (M-Way)
8e3c2d9af7 _mosquitto_net_read must call WSASetLastError when changing errno so that the error code can be picked up by _mosquitto_packet_read
Signed-off-by: Thomas Beckmann (M-Way) <t.beckmann@mwaysolutions.com>
2018-04-09 22:46:53 +01:00
Viktor Gotwig
e90afb8526 Adding tls host name extension (SNI)
Signed-off-by: Viktor Gotwig <viktor.gotwig@q-loud.de>
2018-03-13 23:25:28 +00:00
Roger A. Light
81cb7ab547 Merge branch 'fixes' into develop 2018-02-13 14:16:47 +00:00
JonoJensen
7d8d04bc39 Fix issue when SSL_connect() returns SSL_ERROR_WANT_READ. A call to SSL_write here will later transmit a new client hello and make ssl connection fail.
Signed-off-by: JonoJensen <jono.jensen@yahoo.se>
2018-01-14 23:18:28 +00:00
Roger A. Light
b193918ca0 [649] Don't close socket again if nonblock fails.
Thanks to Edwin van den Oetelaar.

Bug: https://github.com/eclipse/mosquitto/issues/649
2017-12-21 21:56:01 +00:00
Roger A. Light
124ee1af91 [490] Further fix for auth related crashes.
Bug: https://github.com/eclipse/mosquitto/issues/490
2017-07-27 14:56:10 +01:00
Roger A. Light
22063013be [490] Fix auth plugin+WS client+MOSQ_ERR_AUTH related crash.
Thanks to "hasunperera".

Bug: https://github.com/eclipse/mosquitto/issues/490
2017-07-27 00:12:32 +01:00
Roger A. Light
e74203de2c Merge branch 'master' into develop 2017-07-16 22:52:01 +01:00
Dr. Lars Voelker
74adb43cc1 Adding OCSP Stapling support to mosquitto
Adding OCSP Stapling support to mosquitto, so that the TLS client side
requests the certificate status and checks it.
This code uses the OpenSSL-based OCSP implementation and is somewhat
based on the libcurl code for OCSP stapling.

Signed-off-by: Dr. Lars Voelker <lars.voelker@bmw.de>
2017-07-07 13:05:17 +02: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
Jelle van der Waa
ab266e7f5f lib: fix OpenSSL 1.1 deprecation warning for ERR_remove_state
ERR_remove_state has been marked deprecated in OpenSSL 1.1.0 and do
nothing, as the OpenSSL libraries now normally do all thread
initialization and deinitialisation automatically.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
2017-05-05 22:49:05 +01:00
Roger A. Light
91b308a11d Merge branch 'master' into develop 2017-03-06 21:19:53 +00:00
Roger A. Light
ac981782db Fix typo and use net__print_ssl_error() as available. 2017-03-06 10:58:56 +00:00
Jiří Pinkava
cd0985c3e2 Log more TLS error details
Signed-off-by: Jiří Pinkava <j-pi@seznam.cz>
2017-03-06 10:56:45 +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
6f45ab9624 [344] Only do async dns on glibc. 2017-02-20 23:48:30 +00:00
Roger A. Light
5eae4b56d6 [344] More leak fixes. 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
Roger A. Light
98ea684906 [323] Allow outgoing IPv6 connections to use TLS.
Bug: https://github.com/eclipse/mosquitto/issues/323
2017-02-20 23:48:30 +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
3d40ffe18b [344] Only do async dns on glibc. 2017-02-08 15:40:44 +00:00
Roger A. Light
ee543a25f5 [344] More leak fixes. 2017-02-07 16:11:57 +00:00
Roger A. Light
ef7a230365 Start of fix for [344]. 2017-02-06 22:41:34 +00:00
Roger A. Light
6f7a0bff4b [323] Allow outgoing IPv6 connections to use TLS.
Bug: https://github.com/eclipse/mosquitto/issues/323
2016-11-30 11:31:30 +00: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
1c3988a397 Merge branch 'master' into develop 2016-06-21 23:33:58 +01:00
Roger A. Light
e8185ddaa7 [166] Don't cancel external threads.
libmosquitto shouldn't cancel threads it didn't create. This change
allows us to keep track of whether threads were created by the library
or by external code.

Thanks to Josip Ćavar.

Bug: https://github.com/eclipse/mosquitto/issues/166
2016-05-18 14:05:08 +01:00
Roger A. Light
c6ef86bd1f Print openssl errors when debugging enabled. 2016-05-16 21:57:31 +01:00
Dmitry Kaukov
606aa5b4fa Workaround for Windows SSL (#160)
Closes #154.

Signed-off-by: Dmitry Kaukov <dkaukov@opentable.com>
2016-05-14 21:45:02 +01: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
d5abf5a18a Outgoing connections can use any TLS version. 2016-02-09 23:02:46 +00:00
Roger A. Light
c7d4f4bcff mosq->want_write should be cleared immediately before a call to SSL_write.
This allows clients using mosquitto_want_write() to get accurate results.
2016-01-13 21:32:01 +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
148df82144 [484693] Fix _mosquitto_socketpair() on Windows.
Thanks to Steve Woods and Roman Bogus.

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=484693
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=479143
2015-12-18 22:09:36 +00:00
Roger A. Light
9a2eb2038f Drop Windows XP support, misc fixes on Windows. 2015-09-22 10:03:57 +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
290ea87828 Build fixes for OpenBSD. 2015-05-21 17:15:33 +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
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
11756d24c8 Change internal funcs _foo_bar() to foo__bar(). 2015-04-19 22:10:59 +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
c9a924e95e [462780] Fix crash on multiple calls to lib init/clean.
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=462780
2015-03-27 21:02:49 +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
3ed5c94038 Struct optimisations. 2015-02-13 21:17:11 +00:00
Roger A. Light
39ffd6fa36 Handle "error" codes from SSL_connect() correctly. 2015-01-27 23:33:36 +00:00
Roger A. Light
8a18f577a6 Remove more unnecessary uses of calloc. 2015-01-14 21:56:57 +00:00
Roger A. Light
66f147749d Fix missing mutex unlock. 2014-11-16 22:36:31 +00:00
Roger A. Light
36f88d902d Fix errors from big code import. 2014-11-12 20:47:16 +00:00
Roger A. Light
ab49b96db1 Windows related fixes. 2014-10-26 21:17:08 +00:00
Roger A. Light
041f60c03e Make bridge connections non-blocking for TLS connections. 2014-10-24 22:39:09 +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
ae1477c08f Windows fixes. 2014-07-22 10:28:55 +01:00
Roger A. Light
13f94f3511 More reconnect fixes. 2014-07-03 01:00:57 +01:00
Roger A. Light
a831281b3d Delete clients after socket close. 2014-07-02 20:49:06 +01:00
Roger A. Light
d75903b0ae Fix reconnect support for websockets. 2014-06-30 23:30:43 +01:00
Roger A. Light
bdb3e74100 More memory fixes. 2014-06-29 23:16:10 +01:00
Roger A. Light
15efd2d072 Various memory fixes. 2014-06-28 01:38:58 +01:00
Roger A. Light
764b7e0a91 Use hash functions to store client data. 2014-06-23 17:57:35 +01:00
Roger A. Light
4430228855 Be consistent about removing listener counts on socket close. 2014-06-03 16:21:46 +01:00
Roger A. Light
25dd5d88ed Don't leak socket here. 2014-05-27 22:03:01 +01:00
Roger A. Light
063928bbfe Merge websockets -> 1.4. 2014-05-26 17:22:52 +01:00
Roger A. Light
b6f2d3e087 Fix callback deadlocks after calling mosquitto_disconnect(), when using the threaded interfaces. Closes bug #1313725.
Thanks to Michael Frommberger.
2014-05-16 10:20:45 +01:00
Roger Light
0364bd1be7 Initial contribution. 2014-05-07 23:27:00 +01:00
Roger A. Light
4bb7a45b71 Crude, hard coded websockets support. No TLS. 2014-05-06 10:47:00 +01:00