Commit Graph

534 Commits (11b16756cb38f27eae61b23e3c5ee26bcb882635)

Author SHA1 Message Date
Roger A. Light 8cd2411ab6 Tests should typically use `listener` instead of `port`. 4 years ago
Roger A. Light 49065f03a8 Merge remote-tracking branch 'origin/fixes' into develop 4 years ago
Roger A. Light 192a092d50 Add support for pattern ACLs to dynsec un/subscription ACLs. 4 years ago
Roger A. Light a02aad0a9c Add mosquitto_sub_matches_acl_with_pattern. 4 years ago
Roger A. Light 09fe737038 $share subscription with no-local not allowed.
Return protocol error if a client attemps to subscribe to a shared
subscription and also sets no-local.
4 years ago
Roger A. Light 10045394cf Easier testing with different valgrind tools. 4 years ago
Roger A. Light f90e55bd36 Reduce memory allocations when sending packets. 4 years ago
Roger A. Light e0309acebc Add mosquitto_sub_matches_acl()
This moves the sub matching sub code from the dynsec plugin to the library and broker, and removes all of the malloc calls at the same time.
4 years ago
Roger A. Light b3045d1adf Fix pattern matching with invalid prefix. 4 years ago
Roger A. Light 0cd2619401 Add %c and %u support to dynsec publish ACLs. 4 years ago
Roger A. Light 6502d6e5f4 Add mosquitto_topic_matches_sub_with_pattern()
And use it in the default security checks.
4 years ago
Roger A. Light 1ab6b28e26 Add missing test file. 4 years ago
Roger A. Light 42163634c7 Fix leak on crafted MQTT v5 CONNECT.
If a MQTT v5 client connects with a crafted CONNECT packet a memory leak
will occur.

Thanks to Kathrin Kleinhammer.
4 years ago
Roger A. Light 906a515704 Simplify client message properties, only one is used. 4 years ago
Roger A. Light fb76fd66b9 Remove some unused struct members. 4 years ago
Roger A. Light 5177dd4d40 Use random last db id, unless later overwritten by persistence. 4 years ago
Roger A. Light cb2623db47 Check whether broker should be started. 4 years ago
Roger A. Light 0d3870585b Plugin delayed authentication. 4 years ago
Roger Light 0eb7391e71 Fix tests and db_dump compilation. 4 years ago
Roger A. Light 8a03b5ad5c Function for checking if a context is connected. 4 years ago
Roger Light ef7662ca8e Merge branch 'master' into develop 4 years ago
Roger A. Light 1677bb85f4 Fix test. 5 years ago
Roger A. Light 6a4a547892 Fix segfault on client sending malformed CONNACk.
CVE-xxxx-xxxx: If an authenticated client connected with MQTT v5 sent a
malformed CONNACK message to the broker a NULL pointer dereference occurred,
most likely resulting in a segfault. This will be updated with the CVE
number when it is assigned.
Affects versions 2.0.0 to 2.0.9 inclusive.

Closes #2163. Thanks to Bryan Pearson.
5 years ago
Roger A. Light 7842323c0d Test fixes. 5 years ago
Roger A. Light de9780343b Add support for MQTT v5 broker->client topic aliases.
This is on a first-come-first-served basis for now.
Also broker to bridge topic aliases.
5 years ago
Roger A. Light 1289d23b66 Convert tests to be able to run on the same broker where possible. 5 years ago
Roger Light 4c60fad52b Enforce receive maximum on MQTT v5. 5 years ago
Roger Light fecf550cad Fix test. 5 years ago
Roger A. Light fd036b9435 Merge branch 'fixes' into develop 5 years ago
Roger A. Light e401def06d Fix QoS 0 messages not being delivered when max_queued_bytes was configured.
Closes #2123. Thanks to quackgizmo.
5 years ago
Roger A. Light 7baca428da Remove obsolete tests. 5 years ago
Roger A. Light 3f84ad006d Add `on_pre_connect()` callback.
This allows clients to update usernames/passwords/TLS parameters prior
to reconnecting.
5 years ago
Roger A. Light 706a1f3f29 Fix more minor compiler warnings. 5 years ago
Roger A. Light cf1098eff1 Send protocol error on topic alias not found.
The error topic-alias-invalid was being sent if an MQTT v5 client published
a message with empty topic and topic alias set, but the topic alias hadn't
already been configured on the broker. This has been fixed to send a
protocol error, as per section 3.3.4 of the specification.
5 years ago
Roger A. Light 3c58ac9308 Fix `message_size_limit` not applying to the Will payload.
Closes #2022. Thanks to Umberto Morelli.
5 years ago
Roger A. Light 0aecb51fcd Rename reload_type -> bridge_reload_type, plus doc updates. 5 years ago
Abilio Marques 008342c2f3 allow bridge configuration reload
Signed-off-by: Abilio Marques <abiliojr@gmail.com>
5 years ago
Roger A. Light 5e6b34f81a Fix test. 5 years ago
Roger Light 113603168b Fix LWT not being sent on client takeover.
This was not happening for the case when the existing session wasn't
being continued.

Closes #1946. Thanks to Rory Piper.
5 years ago
Roger A. Light 04c110183c Bridge support for MQTT v5 maximum-qos. 5 years ago
Roger A. Light 7d05f70fe1 Fix mosq_test.py to_string() on Python 3 5 years ago
Roger A. Light ed28c416e9 Null checks in client tests. 5 years ago
Roger A. Light 6bd45f0092 dynsec: Better test coverage 5 years ago
Roger A. Light aaf30dc622 dynsec: Fix incorrect test command. 5 years ago
Roger A. Light 31e3fa4d07 dynsec: Invalid UTF-8 tests, plus some fixes. 5 years ago
Roger A. Light c303c67461 dynsec: Return group not found on getGroup. 5 years ago
Roger A. Light ad8cf9fc03 dynsec: Start of invalid role commands tests. 5 years ago
Roger A. Light 423e1a00d2 dynsec: Tests for group commands with invalid params, plus fixes. 5 years ago
Roger A. Light 7ccf4c44fd dynsec: Tests for invalid client command input. 5 years ago
Roger A. Light f6e17b81b9 dynsec: More modifyRole test coverage. 5 years ago
Roger A. Light 6cffd4264e dynsec: ACL tests. 5 years ago
Roger A. Light d8775b7d9c dynsec: Consistent behaviour when setting clientid. 5 years ago
Roger A. Light 047c09bd32 dynsec: Anon group tests 5 years ago
Roger A. Light 2d7f146dfc These tests shouldn't allow anon access. 5 years ago
Roger A. Light 15c6e58fa0 Only run dynsec tests if CJSON and TLS are available. 5 years ago
Roger A. Light c3daa247c2 dynsec: Cover setClientId in 14-dynsec-auth test. 5 years ago
Roger A. Light c1f0cb69d1 dynsec: ACL default access test. 5 years ago
Roger A. Light 81c4e2b6ac dynsec: Commit client auth tests. 5 years ago
Roger A. Light 584cf51ba7 Update to EPL-2.0 5 years ago
Roger A. Light fdd624cec4 Fix tests now uhpa has been removed. 5 years ago
Roger A. Light f2630f9c58 Attempt to fix travis on osx and unreliable test. 5 years ago
Roger A. Light eee34613b4 Fix building of old tests. 5 years ago
Roger A. Light b816d46508 Use db as a global var instead of passing to functions.
This allows a big swath of ifdefs to be removed. It also means savings as the db var is not passed around all of the time, and makes it easier to remove the final broker call to mosquitto_time() call in packet_mosq.c. In one test this reduced the calls to mosquitto_time() from 295k to 48k.
5 years ago
Roger A. Light 255ae24a6d Fix basic dynsec tests. 5 years ago
Roger A. Light 4d9afc835b Fix missing functions in test. 5 years ago
Roger A. Light 042c2733f2 Test and fix for message expiry not increasing send quota. 5 years ago
Roger A. Light a1ad4cfcc4 Dynsec: Rename ACL types for clarity.
publishBrokerToClient -> publishClientReceive
publishClientToBroker -> publishClientSend
5 years ago
Roger A. Light e3ed8879f2 Fix test compilation. 5 years ago
Roger A. Light fdff255916 New dynamic security plugin. 5 years ago
Roger A. Light 3eb39b38da Use atomics in test. 5 years ago
Roger A. Light e104645279 msgps clients now report continuously. 5 years ago
Roger A. Light 899695261a Fix invalid character conversions in test. 5 years ago
Roger A. Light 4ae8971ce1 The broker now sends the receive-maximum property for MQTT v5 CONNACKs. 5 years ago
Roger A. Light 4f61f6c161 Fix conversion errors. 5 years ago
Roger A. Light f18f1a08a9 Merge branch 'feature/add-deny-option-for-acl' of git://github.com/BrandtHill/mosquitto into BrandtHill-feature/add-deny-option-for-acl 5 years ago
Roger A. Light c6b94f6266 Fix running of basic client tests. 5 years ago
Roger A. Light 79028bcb14 Fix duplicate frees in tests. 5 years ago
Roger A. Light a65f946e83 Move headers to own directory. 5 years ago
Roger A. Light c90e49af1b Merge remote-tracking branch 'origin/fixes' into develop 5 years ago
Roger A. Light 54b9571516 Enable TLS with certfile+keyfile, not capath/cafile. 5 years ago
Roger A. Light cf1c156765 New plugin interface
This is not specific to authentication, and allows plugins greater flexibility in what events they are interested in. It also adds message handling, and $CONTROL handling.
5 years ago
Roger A. Light 97bd527df0 Breaking: allow_anonymous defaults to false. 5 years ago
Roger A. Light 1b269270bc Sort failed tests when reporting. 5 years ago
Roger A. Light 4372a2b925 Default test timeout of 60s by default is too long. 5 years ago
Roger A. Light f87ef68fae Detect closed socket in tests. 5 years ago
Roger A. Light cec24116d8 Add very basic client tests. 5 years ago
Roger A. Light 5daa5ee162 Add support for $CONTROL/ topics in plugins. 5 years ago
Roger A. Light 748e5f69c8 Fix acl-access-variants test. 5 years ago
Brandt Hill 16eecfcbc5 Add 'deny' as an option for topics/patterns in acl file to allow certain topics to be explicitly denied when they might otherwise be allowed through a more open read/write/readwrite option. Example: 'topic readwrite test/#' and 'topic deny test/hello/#' may be added so that a user can read/write to all test/# topics, except for test/hello/#.
Signed-off-by: Brandt Hill <brandtlarsonhill@gmail.com>

Change variable name for clarity. Remember to initialize bool (I'm bad at C).

Signed-off-by: Brandt Hill <brandtlarsonhill@gmail.com>

Add documentation to config man page

Signed-off-by: Brandt Hill <brandtlarsonhill@gmail.com>

Add test case for deny option

Signed-off-by: Brandt Hill <brandtlarsonhill@gmail.com>

Add deny acls to top of the list to preserve early exit

Signed-off-by: Brandt Hill <brandtlarsonhill@gmail.com>

change comments

Signed-off-by: Brandt Hill <brandtlarsonhill@gmail.com>
5 years ago
Roger Light 58aa41c813 Optimise use of db__message_write()
New messages are now queued for clients when old ones are sent, rather than on every iteration of the main loop. This produces good performance improvements.
5 years ago
Roger A. Light 69f84bbca9 Simplify "expect_packet" tests. 5 years ago
Roger A. Light ba2c00137d Fix client test leaks. 5 years ago
Roger A. Light 2dc8d2a19a Allow plugins to send messages to specific clients. 5 years ago
Roger A. Light c94e111d73 expect_packet now raises an exception
This should allow tests to be simpler - no more nested ifs.
5 years ago
david-beinder c11d20f82c Database v6 tests
keep v5 client read test to test for backwards compatability
adds username="usrname" and listener_port=1883 for v6 tests

Signed-off-by: david-beinder <david.beinder@mce.li>
5 years ago
Roger A. Light 84e4ba2c1e Send DISCONNECT with malformed-packet reason code on bad PUBLISHes. 5 years ago
Roger A. Light b1e9377a20 Send DISCONNECT with malformed-packet reason code on bad SUBSCRIBEs. 5 years ago
Roger A. Light 8416b007ec Send DISCONNECT with malformed-packet reason code on bad UNSUBSCRIBEs. 5 years ago
Roger A. Light 0edb3e49e7 Remove debug mode 5 years ago
Roger A. Light b5be4fb4af Fix test 5 years ago
Roger A. Light 6deb417804 Simplify db__message_store() interface. 5 years ago
Roger A. Light e3e8dc4ea4 Allow send__pub{ack,rec,rel,comp} to send properties. 5 years ago
Roger A. Light c343812c42 Improve client test for unexpected pubrel. 5 years ago
Roger A. Light ee7d1981ff Merge branch 'rfc-bridge-local-clean' of git://github.com/etactica/mosquitto into etactica-rfc-bridge-local-clean 5 years ago
Roger A. Light bb0e5bb7d3 Add missing header. 5 years ago
Roger A. Light b2e72a7e7c Fix memory leaks only in tests. 5 years ago
Roger A. Light cef9d891ae Tidy up main(). 6 years ago
Roger A. Light fdaeaee6dd Fix test. 6 years ago
Roger A. Light 904284595f Add missing test file. 6 years ago
Roger A. Light 21f203b91a Don't treact unexpected PUBACK/COMP as fatal. 6 years ago
Karl Palsson 07d73c7e3a bridge: support bridge local clean session
This adds the ability to separating bridge clean session settings between
the local and remote endpoints.  Some broker implmentations refuse to allow
non-clean sessions, as they don't support storing messages to be sent to
the connecting broker.  However, this doesn't mean that the local
broker can't be queueing messages to send _out_ to the remote broker.

This PR adds a new bridge connection setting, local_cleansession, that
allows controlling this split. Naming is chosen to be local_ in keeping
with the other local_ settings for bridges.

A test for the six cases of queued/not queued messages in both
directions is added, but v5 testing is currently disabled.  The changes
to support the split are ~independent of protocol version.

Signed-off-by: Karl Palsson <karlp@etactica.com>
6 years ago
Karl Palsson 1a93bab80a mosq_test: add do_receive_send counterpart
Like do_send_receive() but aimed for mocking the other side.

Signed-off-by: Karl Palsson <karlp@etactica.com>
6 years ago
Karl Palsson e700c1c523 mosq_test: print stderr from failure to start broker
Doesn't matter when the tests are running, but useful when you're
writing tests.

Signed-off-by: Karl Palsson <karlp@etactica.com>
6 years ago
Karl Palsson 3d45c3186c test/broker: align identical code
06-bridge-b2br-disconnect-qos1 and
06-bridge-br2b-disconnect-qos1 have ~identical header code.

unify the identical bits to make it easier to visually see this.

Signed-off-by: Karl Palsson <karlp@etactica.com>
6 years ago
Roger A. Light a16d7e0661 iDon't treat an unexpected PUBREL as fatal.
Issue #1629. Thanks to radcrabs.
6 years ago
Michael 4d658bd569 Fix compile error/warning
Signed-off-by: Michael Liu <michael.liu.point@gmail.com>
6 years ago
Roger A. Light d96543c0b8 Merge branch 'fixes' into develop 6 years ago
Roger A. Light c2ec6f002e Fix test to match fixed protocol check. 6 years ago
Roger A. Light 3ff0d04910 Update test key length to 2048 to avoid new openssl rejections. 6 years ago
Roger A. Light 8d5fd7d1e2 Fix `mosquitto_topic_matches_sub()` behaviour with wildcards in topic.
It was not returning MOSQ_ERR_INVAL if the topic contains a wildcard.

Closes #1589. Thanks to mdelete.
6 years ago
Gianfranco Costamagna 7a5c2d4da5 Bugfix: include "deps" directory only if BUNDLED_DEPS has been provided and set to true
Signed-off-by: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
6 years ago
Roger A. Light 27b4518d7e Improve password file parsing in the broker and mosqitto_passwd.
Closes #1584. Thanks to panava.
6 years ago
Roger A. Light 70fd600c3a Fix trailing whitespace not being trimmed on acl users.
Closes #1539. Thanks to CliveJL and LeonPoon.
6 years ago
Roger A. Light 17db97584e Fix client keepalive test using too low keepalive. 6 years ago
Roger A. Light c8789180f3 Fix session expiry with very large expiry intervals.
Closes #1525. Thanks to Christoph Krey.
6 years ago
Roger A. Light 3f0c202aa5 Reduce heap allocation churn when tokenising topics. 6 years ago
Roger A. Light 9ee6e2725c Start of tests for adding subscriptions. 6 years ago
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
6 years ago
Roger Light d92360dd8e Split sub and retain trees. 6 years ago
Roger A. Light 16dc5456bd Enable MQTT v5 in outgoing retain test. 6 years ago
Roger A. Light 2af260ba58 Add `bridge_outgoing_retain` option
This allows outgoing messages from a bridge to have the retain bit
completely disabled, which is useful when bridging to e.g. Amazon or
Google.
6 years ago
Roger A. Light 28c11f4cce Fix tests where broker suddenly disconnects client
This seems to be required just on more modern Python versions.
6 years ago
Roger A. Light aceabcdef2 Tidy up async test outputs. 6 years ago
Jerome Malinge fba1f6bc0a Fix test on invalid null will topic value in connect packet
Signed-off-by: Jerome Malinge <gromgromm@yahoo.com>
6 years ago
Jerome Malinge 11dc077d15 Fix test on invalid reserved bit value in connect packet
Signed-off-by: Jerome Malinge <gromgromm@yahoo.com>
6 years ago
Jerome Malinge ce0b0d23d6 Add send of pubcomp in 02-subpub-qos2 script
To keep the broker session working while launching several tests on
the same broker, the last packet of this transaction must be sent.

Signed-off-by: Jerome Malinge <gromgromm@yahoo.com>
6 years ago
Jerome Malinge d76e5fd199 Fix way of sending packets in compliance tests
According to the documentation of python 3 socket::send method
(https://docs.python.org/3/library/socket.html#socket.socket.send),
the call to send must be retry until all data is sent while sending
packet with a "large" amount of data.

Signed-off-by: Jerome Malinge <gromgromm@yahoo.com>
6 years ago
Roger A. Light b2a9daf1db 02 broker subpub tests with v5 support 6 years ago
Roger A. Light b966455f21 02 broker subscribe tests with v5 support 6 years ago
Roger A. Light 3261c30d08 02 broker unsubscribe tests with v5 support 6 years ago
Roger A. Light e0d0af54a5 01 broker tests with v5 support 6 years ago
Roger A. Light 7b73cd2bf7 04 broker tests with v5 support 6 years ago
Roger A. Light b9360bb147 Fixes for 06 broker v5 tests 6 years ago
Roger A. Light cae7ddeec1 10 broker tests with v5 support 6 years ago
Roger A. Light feb79d5880 11 broker tests with v5 support 6 years ago
Roger A. Light c453d2cb3e 07 broker tests with v5 support 6 years ago
Roger A. Light 48f1ca8538 05 broker tests with v5 support 6 years ago
Roger A. Light 16f57cc834 Simpler v5 session expiry in tests. 6 years ago
Roger A. Light 98d600099b 03 broker tests with v5 support 6 years ago
Roger A. Light 7ea5ba845b Add "ready" message to will takeover test. 6 years ago