Commit Graph

95 Commits

Author SHA1 Message Date
Roger A. Light
6028d0e33e mosquitto_sub and mosquitto_rr now open stdout in binary mode on Windows
This is so binary payloads are not modified when printing.

Thanks to Steve Mullock.
2021-06-09 21:16:57 +01:00
Roger A. Light
ec54bce037 Fix mosquitto_sub pipe close detection.
If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect
that the pipe has closed and disconnect.

Closes #2164. Thanks to Frantisek Fuka.
2021-04-06 23:01:48 +01:00
Roger Light
2de8c15bc9 Minor build fixes. 2021-03-21 09:18:43 +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
de141540fb Fix mosquitto_sub being unable to terminate with Ctrl-C.
This occured if a successful connection was not made.

Closes #1957. Thanks to Peoh.
2020-12-17 10:40:58 +00:00
Roger A. Light
3731535298 Add SPDX license identifiers. 2020-12-01 20:46:56 +00:00
Roger A. Light
29c771cdd4 Add lib and client support for OS CA certs
- Add `MOSQ_OPT_TLS_USE_OS_CERTS` option, to instruct the client to load and  trust OS provided CA certificates for use with TLS connections.
- All clients now load OS provided CA certificates if used with `-L
  mqtts://...`, or if port is set to 8883 and no other CA certificates are
  used. Closes #1824.
- Add the `--tls-use-os-certs` option to all clients.

Closes #1824. Thanks to Jens Reimann.
2020-12-01 11:51:13 +00:00
Roger A. Light
584cf51ba7 Update to EPL-2.0 2020-11-25 17:34:21 +00:00
Roger A. Light
c90e49af1b Merge remote-tracking branch 'origin/fixes' into develop 2020-09-24 17:03:14 +01:00
Roger A. Light
e2123b2561 Add --version for all clients. 2020-09-10 15:49:08 +01:00
Roger A. Light
9929ce0a26 All clients exit with an error exit code on CONNACK failure.
Closes #1778. Thanks to jflambert.
2020-08-12 09:44:42 +01:00
Roger A. Light
c766bdfeb0 Display time out message only on SIGALRM. 2020-05-06 22:23:06 +01:00
Roger A. Light
0da723c1ec Add --random-filter to mosquitto_sub. 2020-03-03 14:12:30 +00:00
Roger A. Light
d96543c0b8 Merge branch 'fixes' into develop 2020-03-03 12:54:57 +00:00
Roger A. Light
b0a065f790 Update changelog. Release page. Bump copyright. 2020-02-27 23:26:58 +00:00
Roger A. Light
56d0b950ac Fix --remove-retained not obeying the -T option.
This means `--remove-retained -t bbc/# -T bbc/one/#` would remove all
retained messages in `bbc/#`, instead of leaving all of the topics in
`bbc/one/#`.

Closes #1585. Thanks to Simon Moser.
2020-02-05 15:19:55 +00:00
Roger A. Light
3671a6dfdb Add -x argument to all clients.
This allows the session-expiry-interval property to be easily set for
MQTT v5 clients.
2020-01-30 11:19:09 +00:00
Roger A. Light
d60e86d2a3 Add TCP_NODELAY support to lib and clients.
Closes #1526. Thanks to Felix Moessbauer.
2019-12-18 17:04:43 +00:00
Roger A. Light
c0443637e8 Merge branch 'master'
Conflicts:
	ChangeLog.txt
	config.mk
	src/context.c
	src/loop.c
	src/subs.c
	test/broker/01-connect-bad-packet.py
	test/broker/02-subpub-qos1-bad-pubcomp.py
	test/broker/02-subpub-qos1-bad-pubrec.py
	test/broker/02-subpub-qos2-bad-puback-1.py
	test/broker/02-subpub-qos2-bad-puback-2.py
	test/broker/02-subpub-qos2-bad-pubcomp.py
	test/broker/02-subpub-qos2.py
	test/broker/07-will-null-topic.py
2019-12-03 13:59:05 +00:00
Basavesh Shivakumar
9bebab46ca In sub_client.c, call mosquitto_destroy()
Fixes: #1513 and frees resources when someone terminates
via SIGTERM or SIGINT.

Signed-off-by: Basavesh Shivakumar <basavesh.shivakumar@gmail.com>
2019-11-27 17:33:11 -05:00
Roger A. Light
9cdc822a19 Add changelog, change msg text for previous merge. 2019-11-06 13:17:23 +00:00
Roger Light
dc21bc513c
Merge pull request #1430 from abiliojr/exit-on-no-subscription
mosquitto_sub: Exit on all subscription denied
2019-11-06 13:13:38 +00:00
Roger A. Light
9e4226622f Add --pretty option to mosquitto_sub/rr
If active, this produces formatted JSON output rather than the normal
minimised output.
2019-10-15 14:44:25 +01:00
Roger Light
e5237ae7e5 Add support for sub/rr v5 prop output in JSON mode 2019-10-15 14:26:51 +01:00
Roger A. Light
499e2f2e98 Add support for unix sockets to broker, lib, and clients. 2019-10-08 20:55:31 +01:00
Abilio Marques
fb8d03db28 mosquitto_sub exits if no subscription is granted
Signed-off-by: Abilio Marques <abiliojr@gmail.com>
2019-09-26 08:36:54 +02:00
Roger A. Light
54ed3c0fc9 Merge branch 'master' into develop 2019-09-25 19:09:10 +01:00
Roger A. Light
0a8358243b mosquitto_sub: Fix -E not working unless -d was also specified.
Closes #1418. Thanks to Lichard Torman.
2019-09-21 22:30:21 +01:00
Roger A. Light
c1e488cb88 Add timeout return code (27) for sub/rr using -W.
Closes #275.
2019-09-04 14:29:26 +01:00
Roger A. Light
a22ccbd884 Clients: improve error msgs when connecting v3.x broker with v5 client
Closes #1344. Thanks to HowJMay.
2019-08-01 11:40:55 +01:00
YangHau
9bb9b6e721 Remove redundant initialization in clients
the `memset(&cfg, 0, sizeof(struct mosq_config));` already exsits in
`client_config_load()`'s `init_config()` function call.
So calling it in main function is totally unnecessary.

Signed-off-by: YangHau <vulxj0j8j8@gmail.com>
2019-07-12 16:53:29 +08:00
Roger A. Light
b4dfeb3767 Fix MQTT v5 clients not being able to specify a password without a username.
Thanks to Erik Moqvist.

Closes #1274.
2019-05-21 23:56:22 +01:00
Roger A. Light
7a33a129d6 Stop some error messages being printed even when --quiet was used.
Thanks to Rob de Jonge.

Closes #1284.
2019-05-21 11:23:00 +01:00
Roger A. Light
dec769ce33 Client and doc ALPN additions
Add ALPN support for all clients, update documentation, and add to ChangeLog.
2019-04-11 11:52:34 +01:00
Roger A. Light
ec3fd361be https links where possible. 2019-03-30 20:34:40 +00:00
Roger A. Light
320ddc1303 Merge branch 'master'
Conflicts:
	CMakeLists.txt
	ChangeLog.txt
	client/Makefile
	config.mk
	installer/mosquitto.nsi
	installer/mosquitto64.nsi
	lib/mosquitto.h
	lib/mqtt3_protocol.h
	lib/util_mosq.c
	set-version.sh
	snap/snapcraft.yaml
	src/bridge.c
	src/database.c
	src/handle_connack.c
	src/loop.c
	src/persist.c
	test/broker/Makefile
2019-03-16 10:05:38 +00:00
Roger A. Light
2dd24449ad Fix "unused parameter" warnings. 2019-03-13 14:46:05 +00:00
Roger A. Light
1ce1bce941 Add --remove-retained to mosquitto_sub
This can be used to clear retained messages on a broker.
2019-03-02 22:14:54 +00:00
Roger A. Light
ce31269e05 Update changelog, bump version, bump copyright year. 2019-02-28 16:56:15 +00:00
Roger A. Light
1924afe49e Add explicit support for TLS v1.3 and drop TLS v1.0. 2019-02-27 22:50:01 +00:00
Roger A. Light
5aabc171b0 Merge branch 'mqtt5' into develop 2019-02-26 18:51:31 +00:00
Roger A. Light
e862a047a8 Rework TLS engine support. 2019-02-26 17:11:29 +00:00
Nicolás Pernas Maradei
20894fcbce Add engine private key password support
Some OpenSSL engines (selectable via tls_engine option) may require a
password to make use of private keys created with them in the first place.

The TPM engine for example, will require a password to access the underlying
TPM's Storage Root Key (SRK), which is the root key of a hierarchy of keys
associated with a TPM; it is generated within a TPM and is a non-migratable
key. Each owned TPM contains a SRK, generated by the TPM at the request
of the Owner. [1]

By default, the engine will prompt the user to introduce the SRK password
before any private keys created with the engine can be used. This could
be inconvenient when running on an unattended system.

Here's where the new tls_engine_kpass_sha option comes in handy. The user
can specify a SHA1 hash of its engine private key password via command
line or config file and it will be passed on to the engine directly.

This commit adds support for both clients (libmosquitto) and broker.

[1] https://goo.gl/qQoXBY

Signed-off-by: Nicolás Pernas Maradei <nicopernas@gmail.com>
2019-02-26 15:50:37 +00:00
Nicolás Pernas Maradei
f88cc06435 Add TLS engine and keyform support to libmosquitto
- Clients can now offload crypto tasks to an external crypto device through
  the OpenSSL ENGINE API.
- The keyfiles can now be treated as PEM or ENGINE keys.
- Two new functions were added to libmosquitto to set up the previously
  mentioned features.
- Both mosquitto_sub and mosquitto_pub include support to turn on the mentioned
  features through command line options.

Signed-off-by: Nicolás Pernas Maradei <nicopernas@gmail.com>
2019-02-26 15:48:00 +00:00
Roger Light
930a314caf Add reason_code to on_publish_v5 callback. 2019-01-09 17:06:43 +00:00
Roger A. Light
fcf4cd0b27 Merge branch 'master' into mqtt5 2018-12-19 14:11:11 +00:00
Roger A. Light
db7901884f Retain-as-published support. 2018-12-14 13:36:02 +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
5073d83bf8 Don't generate client ids in v5 mode. 2018-12-05 21:26:22 +00:00