Commit Graph

258 Commits (4a7da066e0c81a2daacb5fbe99805151d95a3b26)

Author SHA1 Message Date
Roger A. Light 9bb389dda1 Avoid compile error.
"a label can only be part of a statement and a declaration is not a
statement"
3 years ago
Roger A. Light 1a5cd9e849 Fix Coverity Scan 1499794. 3 years ago
Roger A. Light 9c2d0ce401 Fix copy paste error.
Coverity Scan 1499794.
3 years ago
Roger A. Light c5c7dd3f57 Fix payload check 3 years ago
Roger A. Light 65153eba45 Example plugin that bans based on payload 3 years ago
Roger A. Light a872c0466f Fix leak 3 years ago
Roger A. Light adf985bff8 Persistence: Store cmsg_id and sub id for client_msgs. 3 years ago
Roger A. Light cfd4aa1c95 sqlite: Consistent naming 3 years ago
Roger A. Light 2bfb0dc022 sqlite: client_msgs are only ever all cleared 3 years ago
Roger A. Light bdf8493e81 sqlite: base_msg can never have these properties 3 years ago
Roger A. Light 16feb14a57 Persistence interface updates and sqlite plugin fixes
The MOSQ_EVT_PERSIST_CLIENT_MSG_CLEAR event has been removed, due to
never being called. It is the responsibility of the plugin to remove
client subscriptions and client messages when the client is removed.

Lots of persist test improvements and additions - mostly checking item
counts.
3 years ago
Roger A. Light d4960d0ead sqlite: Save/restore binary properties. 3 years ago
Roger A. Light 86b314c624 Remove unused defs 3 years ago
Roger A. Light 1d230bd255 dynsec: Fix listClients/getClient crashing if an anon user present
This only affects the unreleased `develop` branch.
3 years ago
Roger A. Light fd68bf00c7 Merge branch 'master' into develop 3 years ago
Roger A. Light ba13edc6a4 dynsec: Forbid deleting the anon group. 3 years ago
Roger A. Light 9d9469cbec Merge branch 'fixes' 3 years ago
Roger A. Light 4d1b587e29 dynsec: Forbid deleting the anon group. 3 years ago
Roger A. Light df317ff71f Dynamic security: Fix the plugin being able to be loaded twice.
Currently only a single plugin can interact with a unique $CONTROL
topic. Using multiple instances of the plugin would produce duplicate
entries in the config file.

Closes #2601.
Closes #2470.
3 years ago
Roger A. Light 436f0b9348 dynsec: Fix modifyClient and modifyGroup commands
They will now not modify the client/group if a new group/client being
added is not valid, or on other failures.

Closes #2598. Thanks to Sebastian Szczepański.
3 years ago
Roger A. Light b22df5140e Clear errno before check. 3 years ago
Roger A. Light 80c7726d5c Fix confusing error message when dynamic security config file was a directory.
Closes #2520. Thanks to sezanzeb
3 years ago
Roger A. Light a2f91babdf Fix incorrect format specifier 3 years ago
Kai Buschulte 8b67883548 Remove old compatibility header support
Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Roger A. Light 7794001ce2 Don't free arrays. 3 years ago
Roger A. Light 832e51cb57 dynsec: reduce memory allocations 3 years ago
Roger A. Light e5d6bbb907 dynsec: don't leave in partial state on error 3 years ago
Roger A. Light dd34b707ac Fix Coverity Scan 1490914. 3 years ago
Roger A. Light c397d080b4 Merge branch 'fix-corrupted-dynsec-config' of https://github.com/NorbertHeusser/mosquitto into NorbertHeusser-fix-corrupted-dynsec-config 3 years ago
Roger A. Light ca61baf5e3 Merge branch 'add-common-options-target-to-enable-compiler-warnings' of https://github.com/buschulte/mosquitto into buschulte-add-common-options-target-to-enable-compiler-warnings 3 years ago
Roger A. Light 11b16756cb Windows fixes. 3 years ago
Norbert Heusser 621d74fd6a Created new helper function mosquitto_write_file in common/misc_mosq.h to consolidate
saving config files in failsafe manner

Signed-off-by: Norbert Heusser <norbert.heusser@cedalo.com>
3 years ago
Kai Buschulte 71456077ad Introduce a common-options cmake target
this makes it possible to explicitly share compile options, without
using the `add_definition` function. This function declares options for
the current directory and below (in our case also for `deps`).

Adding -Wall, -Wconversion and -Wextra to at least make compiler
warnings visible for the cmake build.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Kai Buschulte 8b5a86fd52 Introduce config-header cmake target
This is an interface cmake target which specifies include directories
required by the config.h places in the root of the project.

This header is a "public" header visible to plugins linking the
mosquitto exports.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Roger A. Light 34391080d6 Add dynsec init by simple file. 3 years ago
Roger A. Light 546df9db85 Build fixes, particularly pedantic compiler warnings. 3 years ago
Roger A. Light 2c8dc3968e Migrate persist-sqlite to use persistence_location. 3 years ago
Roger A. Light 4ac8c0bcc3 Add deny-protocol-version example plugin, for 2.0 only. 3 years ago
Roger A. Light 51f9a76f03 Merge branch 'macos-cmake-build' of https://github.com/buschulte/mosquitto into buschulte-macos-cmake-build 3 years ago
Kai Buschulte 7e4746aac4 Fix missing symbols MacOS
Core symbols needed by plugins are now properly linked to their objects

 * Remove link_directories() call:

This specification is not necessary for our own libraries as cmake
shares this information over the targets.

If needed they should be specified target specific, like done for
the external DLT library.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Kai Buschulte 0e9df05d0d Add imported target for cJSON
Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Kai Buschulte 15208e55cc Use preinstalled CMake find module for SQLite3
CMake >= 3.14 comes with a preinstalled FindSQLite3 module, which now
replaces the self-written one.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Roger A. Light ab1803d72f Fix casting. 3 years ago
Abilio Marques 82b6eaa31d Persist-sqlite: add flush_period and page_size options
Signed-off-by: Abilio Marques <abiliojr@gmail.com>
3 years ago
Norbert Heusser d4216c8cb6 Fixed CMakeLists.txt
* Addded missing files plugin_subscribe and plugin_unsubscribe to src/CMakeLists.txt
* Aligned mixed usage of all-keyword and all-plain in target_link_libra…ry definition in in CMakeLists.txt

Signed-off-by: Norbert Heusser <norbert.heusser@cedalo.com>
4 years ago
Roger A. Light 40d8015837 Add MOSQ_EVT_SUBSCRIBE and MOSQ_EVT_UNSUBSCRIBE events.
These are called when subscribe/unsubscribes actually succeed.
4 years ago
Roger A. Light af42640d60 Dynsec: Allow initial password generation from environment variable. 4 years ago
Roger A. Light 5ab7603811 Fix Coverity Scan 1486934 Unchecked return value 4 years ago
Roger A. Light 27b4a6aa33 Fix Coverity Scan 1487012 Resource leak 4 years ago
Roger A. Light b3096982b5 Fix Coverity Scan 1486953 Use after free 4 years ago
Roger A. Light 07b7533b1e Fix Coverity Scan 1486947 Double free 4 years ago
Roger A. Light c661f475b4 Coverity Scan fixes - Invalid type in argument to printf format specifier
1453805
1453806
1486939
1486954
1486955
1486956
1486960
4 years ago
Roger A. Light 7939633114 Optimise persist client msg clearing. 4 years ago
Roger A. Light bf1d39746a dynsec: admin should have sys-observe role 4 years ago
Roger A. Light 0a4a029fbf Persist plugin: Simplify cases where we don't take a copy.
Some members of the persist plugin interface are only used to find a
client struct, for example. There is no need for the plugin to allocate
a new copy and the broker to free it in that case.
4 years ago
Roger A. Light 3122d3e2c5 Simplify some dynsec config functions. 4 years ago
Roger A. Light 5279a424b1 Dynsec: Kick clients in tick event rather than immediately
This means that PUBACK/PUBREC should be sent to clients that modify
their own roles.

Closes #2474. Thanks to Stefano Berlato.
4 years ago
Roger A. Light 0deaae286e NULL after freeing. 4 years ago
Roger A. Light 051fbadb99 Move some CONTROL code to plugin common. 4 years ago
Roger A. Light cbb01193a0 Rename persist retain_add to retain_set 4 years ago
Roger A. Light 8d94fdc688 Minor housekeeping. 4 years ago
Roger A. Light 2d3b152a22 Rename of mosquitto_msg_store struct.
struct mosquitto_msg_store -> struct mosquitto_base_msg

This is the base message which client messages and retained messages
refer to. The base messages are still held in the message store.

This change comes about because the persistence interface exposes these
message types. Prior to this commit the different messages were "msg",
"client_msg", and "retain". After this commit there is "base_msg",
"client_msg", and and "retain_msg" in the persist interface.
4 years ago
Roger A. Light d2f598b6f6 persist-sqlite: commit transactions once every 5 seconds 4 years ago
Roger A. Light 68c002bc55 Plugin event counter example plugin. 4 years ago
Roger A. Light 14d1c32f9d Update changelog. Style, whitespace and, linker fixes. 4 years ago
Roger A. Light 96931643a4 Use strings.h for strcasecmp, except on Windows.
Closes #2420. Thanks to Frédéric Fauberteau.
4 years ago
Norbert Heusser e7e8b6e832 * Added list of connections to dynsec/getClient response
* Added new helper function mosquitto_apply_on_all_clients to broker
* Refactoring in dynamic-security plugin

Signed-off-by: Norbert Heusser <norbert.heusser@cedalo.com>
4 years ago
Roger A. Light 02d08b9889 wildcard-temp: Don't attempt to delete from an empty list. 4 years ago
Roger A. Light a0f58f20c3 Update threaded builds.
Most specifically use -pthread instead of -lpthread.
4 years ago
Roger A. Light ffb7661d86 Move shared code to common directory
This is currently limited to "utility" type functions and does not include code common to the library and broker that are protocol related.
4 years ago
Roger A. Light 5a3b42d4a4 Use path vars in Makefiles. 4 years ago
Roger A. Light aae7c406fe wildcard-temp plugin: Fix use after free. 4 years ago
Roger A. Light d3f0d28d65 Persist-sqlite: Default to "normal" synchronous mode. 4 years ago
Roger A. Light 374f547b64 Persist sqlite: Store client connection time. 4 years ago
Roger A. Light bc1adfd46d CMake fixes.
Builtin websockets support.
Persist sqlite plugin build.
Broker cJSON support
Add wildcard-temp plugin.
4 years ago
Roger A. Light 6b32cf61b2 CMake build fixes, including sqlite support. 4 years ago
Roger A. Light 8d073771c3 Make some plugin code shared for future use. 4 years ago
Roger A. Light d032c94d14 Remove global vars. 4 years ago
Roger A. Light 4adce6d0da Add anonymous group when generating dynsec config. 4 years ago
Roger A. Light 11c5cf039f Simplify memory use for dynsec. 4 years ago
Roger A. Light 34dc62be86 Document wildcard_temp plugin. 4 years ago
Roger A. Light dc906c5221 Sqlite persistence plugin. 4 years ago
Roger A. Light 5b2e181c9f Example client lifetime and payload size stat plugins. 4 years ago
Roger A. Light f43f136af8 Plugin for wildcard subscription blocking. 4 years ago
Roger A. Light cd28187e5e Minor refactor to separate files. 4 years ago
Roger A. Light 17fd1929eb Move config load/save to own file. 4 years ago
Roger A. Light 2501a64035 Merge branch 'master' into develop 4 years ago
Roger A. Light 2976dffa71 Plugin template CMakeLists. 4 years ago
Roger A. Light 34b41a3b01 Dynsec: Add ability to deny wildcard subscriptions for a role 4 years ago
Konstantin Podsvirov c4d51f0835 Fix DESTINATION for mosquitto_dynamic_security MODULE
On Windows MODULE will be installed as LIBRARY component
to `lib` folder that is not prefer for dynamic loaded modules
but can be found in RUNTIME DESTINATION (`bin` folder) too.

Signed-off-by: Konstantin Podsvirov <konstantin@podsvirov.pro>
4 years ago
Roger Light cd07f1136b Bump copyrights. 4 years ago
Roger A. Light 8ac11929cc Merge branch 'master' into develop 4 years ago
Roger A. Light b9b065d2cc Compiler pedantry, and more checks in tests. 4 years ago
Roger A. Light 91e8344a3e Windows build fixes. 4 years ago
Roger A. Light 799cdead15 Experimental custom websockets support. 4 years ago
Roger A. Light a1a190b482 Pointless whitespace tidy. 4 years ago
Roger A. Light 55d5d2e5f2 Fix for building when uthash not available. 4 years ago
Roger A. Light 2bfc7e7cc8 Do plugin callback unregistering automatically. 4 years ago
Roger A. Light 6763d94962 Add plugin version helper. 4 years ago
Roger A. Light 0f2f77c945 Improve idle / mux timeout performance. 4 years ago