diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-01-26 23:14:53 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-01-27 15:58:31 +0200 |
commit | 0bf5450365934c39ed0bb480712adaab2fa54386 (patch) | |
tree | 15b90e626ca7f29c9fa219addf17e9cf618b6496 /src | |
parent | Move compiler flags to meson.build from pkgbuild (diff) | |
download | smolbote-0bf5450365934c39ed0bb480712adaab2fa54386.tar.xz |
pluginloader: add test for PluginLoader::verify
Diffstat (limited to 'src')
-rw-r--r-- | src/browser.cpp | 8 | ||||
-rw-r--r-- | src/main.cpp | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index 61cd2c6..86d8f13 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -130,7 +130,13 @@ QPluginLoader *Browser::addPlugin(const QString &path) if(path.isEmpty()) return nullptr; - auto *loader = new PluginLoader(path, PluginLoader::SignatureMatchIfAvailable, this); + Configuration conf; + const PluginLoader::SignatureState state( + conf.value<bool>("plugins.signature.ignored").value(), + conf.value<bool>("plugins.signature.checked").value(), + conf.value<bool>("plugins.signature.enforced").value()); + + auto *loader = new PluginLoader(path, state, this); const bool loaded = loader->load(); spdlog::info("Loading plugin [{}]: {}", qUtf8Printable(path), loaded ? "passed" : "failed"); diff --git a/src/main.cpp b/src/main.cpp index 98e8ef9..3394a84 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -105,8 +105,14 @@ int main(int argc, char **argv) [&]() { Configuration conf; spdlog::debug("plugins.path={}", conf.value<std::string>("plugins.path").value()); + + const PluginLoader::SignatureState state( + conf.value<bool>("plugins.signature.ignored").value(), + conf.value<bool>("plugins.signature.checked").value(), + conf.value<bool>("plugins.signature.enforced").value()); + for(const QString &path : Util::files(conf.value<QString>("plugins.path").value(), { "*.so", "*.dll" })) { - auto *loader = new PluginLoader(path); + auto *loader = new PluginLoader(path, state); const bool loaded = loader->load(); spdlog::info("{} plugin {}", loaded ? "Loaded" : "Failed to load", qUtf8Printable(path)); |