Commit graph

210 commits

Author SHA1 Message Date
Roger A. Light
ae14eb34e1 Fix Coverity Scan 1499817 2022-10-16 23:23:43 +01:00
Roger A. Light
403f6443be Sqlite: Provide logs on restore errors 2022-10-16 21:23:15 +01:00
Roger A. Light
9bb389dda1 Avoid compile error.
"a label can only be part of a statement and a declaration is not a
statement"
2022-10-16 08:13:46 +01:00
Roger A. Light
1a5cd9e849 Fix Coverity Scan 1499794. 2022-10-16 07:39:50 +01:00
Roger A. Light
9c2d0ce401 Fix copy paste error.
Coverity Scan 1499794.
2022-10-16 07:29:50 +01:00
Roger A. Light
c5c7dd3f57 Fix payload check 2022-10-15 21:55:49 +01:00
Roger A. Light
65153eba45 Example plugin that bans based on payload 2022-10-15 20:41:51 +01:00
Roger A. Light
a872c0466f Fix leak 2022-10-13 20:41:01 +01:00
Roger A. Light
adf985bff8 Persistence: Store cmsg_id and sub id for client_msgs. 2022-10-11 21:51:43 +01:00
Roger A. Light
cfd4aa1c95 sqlite: Consistent naming 2022-10-11 21:50:03 +01:00
Roger A. Light
2bfb0dc022 sqlite: client_msgs are only ever all cleared 2022-10-11 21:49:33 +01:00
Roger A. Light
bdf8493e81 sqlite: base_msg can never have these properties 2022-10-11 21:48:51 +01:00
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.
2022-10-09 22:17:47 +01:00
Roger A. Light
d4960d0ead sqlite: Save/restore binary properties. 2022-10-09 22:02:59 +01:00
Roger A. Light
86b314c624 Remove unused defs 2022-09-30 19:26:54 +01:00
Roger A. Light
1d230bd255 dynsec: Fix listClients/getClient crashing if an anon user present
This only affects the unreleased `develop` branch.
2022-08-22 10:50:10 +01:00
Roger A. Light
fd68bf00c7 Merge branch 'master' into develop 2022-08-17 16:18:24 +01:00
Roger A. Light
ba13edc6a4 dynsec: Forbid deleting the anon group. 2022-08-17 12:10:24 +01:00
Roger A. Light
9d9469cbec Merge branch 'fixes' 2022-08-16 13:13:06 +01:00
Roger A. Light
4d1b587e29 dynsec: Forbid deleting the anon group. 2022-08-16 12:55:48 +01:00
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.
2022-08-16 01:27:55 +01:00
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.
2022-08-16 00:48:02 +01:00
Roger A. Light
b22df5140e Clear errno before check. 2022-08-16 00:23:06 +01:00
Roger A. Light
80c7726d5c Fix confusing error message when dynamic security config file was a directory.
Closes #2520. Thanks to sezanzeb
2022-08-12 08:34:56 +01:00
Roger A. Light
a2f91babdf Fix incorrect format specifier 2022-08-11 14:19:23 +01:00
Kai Buschulte
8b67883548 Remove old compatibility header support
Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
2022-08-08 09:25:16 +00:00
Roger A. Light
7794001ce2 Don't free arrays. 2022-08-07 08:24:34 +01:00
Roger A. Light
832e51cb57 dynsec: reduce memory allocations 2022-08-05 13:08:55 +01:00
Roger A. Light
e5d6bbb907 dynsec: don't leave in partial state on error 2022-08-04 19:16:30 +01:00
Roger A. Light
dd34b707ac Fix Coverity Scan 1490914. 2022-08-01 23:06:23 +01:00
Roger A. Light
c397d080b4 Merge branch 'fix-corrupted-dynsec-config' of https://github.com/NorbertHeusser/mosquitto into NorbertHeusser-fix-corrupted-dynsec-config 2022-07-21 20:18:38 +01:00
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 2022-07-21 16:21:29 +01:00
Roger A. Light
11b16756cb Windows fixes. 2022-07-21 15:51:52 +01:00
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>
2022-07-19 17:22:19 +00:00
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>
2022-07-04 11:16:01 +02:00
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>
2022-06-22 23:56:09 +01:00
Roger A. Light
34391080d6 Add dynsec init by simple file. 2022-06-22 17:33:39 +01:00
Roger A. Light
546df9db85 Build fixes, particularly pedantic compiler warnings. 2022-06-14 22:29:05 +01:00
Roger A. Light
2c8dc3968e Migrate persist-sqlite to use persistence_location. 2022-05-18 15:11:13 +01:00
Roger A. Light
4ac8c0bcc3 Add deny-protocol-version example plugin, for 2.0 only. 2022-05-17 21:11:46 +01:00
Roger A. Light
51f9a76f03 Merge branch 'macos-cmake-build' of https://github.com/buschulte/mosquitto into buschulte-macos-cmake-build 2022-05-12 12:10:11 +01:00
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>
2022-05-11 07:01:22 +00:00
Kai Buschulte
0e9df05d0d Add imported target for cJSON
Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
2022-05-11 07:01:17 +00:00
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>
2022-05-10 16:44:34 +02:00
Roger A. Light
ab1803d72f Fix casting. 2022-04-29 22:12:55 +01:00
Abilio Marques
82b6eaa31d Persist-sqlite: add flush_period and page_size options
Signed-off-by: Abilio Marques <abiliojr@gmail.com>
2022-04-29 07:35:47 +02:00
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>
2022-04-06 10:26:03 +00:00
Roger A. Light
40d8015837 Add MOSQ_EVT_SUBSCRIBE and MOSQ_EVT_UNSUBSCRIBE events.
These are called when subscribe/unsubscribes actually succeed.
2022-03-31 14:24:11 +01:00
Roger A. Light
af42640d60 Dynsec: Allow initial password generation from environment variable. 2022-03-24 22:40:40 +00:00
Roger A. Light
5ab7603811 Fix Coverity Scan 1486934 Unchecked return value 2022-03-24 10:17:15 +00:00