diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2019-04-19 17:27:39 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2019-04-19 17:27:39 +0300 |
commit | c5576c85c92c464ff3aa53f680ce18d8b51f60ab (patch) | |
tree | 042c50df8fc1b9bb9a08656ca7200fa3af5b1086 /src/browser.cpp | |
parent | Use scdoc to generate manpages (diff) | |
download | smolbote-c5576c85c92c464ff3aa53f680ce18d8b51f60ab.tar.xz |
Add plugin signature verification policies
Diffstat (limited to 'src/browser.cpp')
-rw-r--r-- | src/browser.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index db75fa1..e11a1da 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -38,7 +38,7 @@ #include "adblock/adblocklist.h" #include "hostlist/hostlist.h" #include <spdlog/spdlog.h> -#include "plugin/pluginloader.h" +#include <pluginloader.h> Browser::Browser(int &argc, char *argv[], bool allowSecondary) : SingleApplication(argc, argv, allowSecondary, SingleApplication::User | SingleApplication::SecondaryNotification | SingleApplication::ExcludeAppVersion) @@ -151,9 +151,14 @@ QPluginLoader *Browser::addPlugin(const QString &path) if(path.isEmpty()) return nullptr; - auto *loader = new PluginLoader(path, this); - spdlog::info("Verifying plugin: {}", loader->verify() ? "passed" : "failed"); - loader->load(); + auto *loader = new PluginLoader(path, PluginLoader::SignatureMatchIfAvailable, this); + const bool loaded = loader->load(); + spdlog::info("Loading plugin [{}]: {}", qUtf8Printable(path), loaded ? "passed" : "failed"); + + if(!loaded) { + delete loader; + return nullptr; + } auto *info = new PluginInfo(loader); m_plugins.append(info); |