plugin-loader: Removed unused path argument of load() method
Multiple additional search paths can be added with the add_path() method.
This commit is contained in:
@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
library_init(NULL);
|
library_init(NULL);
|
||||||
lib->plugins->load(lib->plugins, NULL, PLUGINS);
|
lib->plugins->load(lib->plugins, PLUGINS);
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
|
|
||||||
printf("loaded: %s\n", PLUGINS);
|
printf("loaded: %s\n", PLUGINS);
|
||||||
|
|||||||
+1
-1
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
library_init(NULL);
|
library_init(NULL);
|
||||||
lib->plugins->load(lib->plugins, NULL, argv[1]);
|
lib->plugins->load(lib->plugins, argv[1]);
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
|
|
||||||
rounds = atoi(argv[2]);
|
rounds = atoi(argv[2]);
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
dbg = dbg_dnssec;
|
dbg = dbg_dnssec;
|
||||||
|
|
||||||
if (!lib->plugins->load(lib->plugins, NULL, PLUGINS))
|
if (!lib->plugins->load(lib->plugins, PLUGINS))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
library_init(NULL);
|
library_init(NULL);
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
lib->plugins->load(lib->plugins, NULL, PLUGINS);
|
lib->plugins->load(lib->plugins, PLUGINS);
|
||||||
|
|
||||||
if (argc != 3 || (!streq(argv[1], "a") && !streq(argv[1], "s")))
|
if (argc != 3 || (!streq(argv[1], "a") && !streq(argv[1], "s")))
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ int main(int argc, char *argv[])
|
|||||||
int limit = 0, i = 0;
|
int limit = 0, i = 0;
|
||||||
|
|
||||||
library_init(NULL);
|
library_init(NULL);
|
||||||
lib->plugins->load(lib->plugins, NULL, PLUGINS);
|
lib->plugins->load(lib->plugins, PLUGINS);
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
|
|
||||||
printf("loaded: %s\n", PLUGINS);
|
printf("loaded: %s\n", PLUGINS);
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
|
|||||||
int read;
|
int read;
|
||||||
|
|
||||||
library_init(NULL);
|
library_init(NULL);
|
||||||
lib->plugins->load(lib->plugins, NULL, PLUGINS);
|
lib->plugins->load(lib->plugins, PLUGINS);
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
|
|
||||||
read = fread(buf, 1, sizeof(buf), stdin);
|
read = fread(buf, 1, sizeof(buf), stdin);
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
|
|||||||
int read, n;
|
int read, n;
|
||||||
|
|
||||||
library_init(NULL);
|
library_init(NULL);
|
||||||
lib->plugins->load(lib->plugins, NULL, PLUGINS);
|
lib->plugins->load(lib->plugins, PLUGINS);
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
|
|
||||||
read = fread(buf, 1, sizeof(buf), stdin);
|
read = fread(buf, 1, sizeof(buf), stdin);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
library_init(NULL);
|
library_init(NULL);
|
||||||
lib->plugins->load(lib->plugins, NULL, argv[1]);
|
lib->plugins->load(lib->plugins, argv[1]);
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
|
|
||||||
keydata = chunk_create(buf, 0);
|
keydata = chunk_create(buf, 0);
|
||||||
|
|||||||
+1
-1
@@ -255,7 +255,7 @@ static void init()
|
|||||||
|
|
||||||
dbg = dbg_tls;
|
dbg = dbg_tls;
|
||||||
|
|
||||||
lib->plugins->load(lib->plugins, NULL, PLUGINS);
|
lib->plugins->load(lib->plugins, PLUGINS);
|
||||||
|
|
||||||
creds = mem_cred_create();
|
creds = mem_cred_create();
|
||||||
lib->credmgr->add_set(lib->credmgr, &creds->set);
|
lib->credmgr->add_set(lib->credmgr, &creds->set);
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
load_loggers(logger);
|
load_loggers(logger);
|
||||||
|
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
conftest->test->get_str(conftest->test, "preload", "")))
|
conftest->test->get_str(conftest->test, "preload", "")))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ METHOD(daemon_t, initialize, bool,
|
|||||||
countof(features), TRUE);
|
countof(features), TRUE);
|
||||||
|
|
||||||
/* load plugins, further infrastructure may need it */
|
/* load plugins, further infrastructure may need it */
|
||||||
if (!lib->plugins->load(lib->plugins, NULL, plugins))
|
if (!lib->plugins->load(lib->plugins, plugins))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1260,7 +1260,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "integrity check of pool failed\n");
|
fprintf(stderr, "integrity check of pool failed\n");
|
||||||
exit(SS_RC_DAEMON_INTEGRITY);
|
exit(SS_RC_DAEMON_INTEGRITY);
|
||||||
}
|
}
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "pool.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "pool.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
exit(SS_RC_INITIALIZATION_FAILED);
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
|
|||||||
+1
-1
@@ -124,7 +124,7 @@ bool libimcv_init(bool is_imv)
|
|||||||
dbg = imcv_dbg;
|
dbg = imcv_dbg;
|
||||||
openlog("imcv", 0, LOG_DAEMON);
|
openlog("imcv", 0, LOG_DAEMON);
|
||||||
|
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "libimcv.load",
|
lib->settings->get_str(lib->settings, "libimcv.load",
|
||||||
"random nonce gmp pubkey x509")))
|
"random nonce gmp pubkey x509")))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "imv_policy_manager_usage.h"
|
#include "imv_policy_manager_usage.h"
|
||||||
#include "imv_workitem.h"
|
#include "imv_workitem.h"
|
||||||
|
|
||||||
#include <library.h>
|
#include <library.h>
|
||||||
#include <utils/debug.h>
|
#include <utils/debug.h>
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
}
|
}
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "imv_policy_manager.load",
|
lib->settings->get_str(lib->settings, "imv_policy_manager.load",
|
||||||
"sqlite")))
|
"sqlite")))
|
||||||
{
|
{
|
||||||
@@ -285,7 +285,7 @@ int main(int argc, char *argv[])
|
|||||||
exit(SS_RC_INITIALIZATION_FAILED);
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
}
|
}
|
||||||
session_id = atoi(tnc_session_id);
|
session_id = atoi(tnc_session_id);
|
||||||
|
|
||||||
/* attach IMV database */
|
/* attach IMV database */
|
||||||
uri = lib->settings->get_str(lib->settings, "libimcv.database", NULL);
|
uri = lib->settings->get_str(lib->settings, "libimcv.database", NULL);
|
||||||
if (!uri)
|
if (!uri)
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
}
|
}
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "attest.load", "sqlite")))
|
lib->settings->get_str(lib->settings, "attest.load", "sqlite")))
|
||||||
{
|
{
|
||||||
exit(SS_RC_INITIALIZATION_FAILED);
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
}
|
}
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "attest.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "attest.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
exit(SS_RC_INITIALIZATION_FAILED);
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
|
|||||||
@@ -937,17 +937,14 @@ static bool find_plugin(char *path, char *name, char *buf, char **file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
METHOD(plugin_loader_t, load_plugins, bool,
|
METHOD(plugin_loader_t, load_plugins, bool,
|
||||||
private_plugin_loader_t *this, char *default_path, char *list)
|
private_plugin_loader_t *this, char *list)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
char *token;
|
char *default_path = NULL, *token;
|
||||||
bool critical_failed = FALSE;
|
bool critical_failed = FALSE;
|
||||||
|
|
||||||
#ifdef PLUGINDIR
|
#ifdef PLUGINDIR
|
||||||
if (default_path == NULL)
|
default_path = PLUGINDIR;
|
||||||
{
|
|
||||||
default_path = PLUGINDIR;
|
|
||||||
}
|
|
||||||
#endif /* PLUGINDIR */
|
#endif /* PLUGINDIR */
|
||||||
|
|
||||||
enumerator = enumerator_create_token(list, " ", " ");
|
enumerator = enumerator_create_token(list, " ", " ");
|
||||||
|
|||||||
@@ -57,25 +57,24 @@ struct plugin_loader_t {
|
|||||||
bool critical);
|
bool critical);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a list of plugins from a directory.
|
* Load a list of plugins.
|
||||||
*
|
*
|
||||||
* Each plugin in list may have a ending exclamation mark (!) to mark it
|
* Each plugin in list may have an ending exclamation mark (!) to mark it
|
||||||
* as a critical plugin. If loading a critical plugin fails, plugin loading
|
* as a critical plugin. If loading a critical plugin fails, plugin loading
|
||||||
* is aborted and FALSE is returned.
|
* is aborted and FALSE is returned.
|
||||||
*
|
*
|
||||||
* Additional paths can be added with add_path(), these will be searched
|
* Additional paths can be added with add_path(), these will be searched
|
||||||
* for the plugins first, in the order they were added, then the given path
|
* for the plugins first, in the order they were added, then the default
|
||||||
* or the default follow.
|
* path follows.
|
||||||
*
|
*
|
||||||
* @note Even though this method could be called multiple times this is
|
* @note Even though this method could be called multiple times this is
|
||||||
* currently not really supported in regards to plugin features and their
|
* currently not really supported in regards to plugin features and their
|
||||||
* dependencies (in particular soft dependencies).
|
* dependencies (in particular soft dependencies).
|
||||||
*
|
*
|
||||||
* @param path path containing loadable plugins, NULL for default
|
|
||||||
* @param list space separated list of plugins to load
|
* @param list space separated list of plugins to load
|
||||||
* @return TRUE if all critical plugins loaded successfully
|
* @return TRUE if all critical plugins loaded successfully
|
||||||
*/
|
*/
|
||||||
bool (*load)(plugin_loader_t *this, char *path, char *list);
|
bool (*load)(plugin_loader_t *this, char *list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an additional search path for plugins.
|
* Add an additional search path for plugins.
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ static bool load_plugins()
|
|||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
|
||||||
return lib->plugins->load(lib->plugins, NULL, PLUGINS);
|
return lib->plugins->load(lib->plugins, PLUGINS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ int main (int arc, char *argv[])
|
|||||||
int threads, timeout;
|
int threads, timeout;
|
||||||
|
|
||||||
library_init(NULL);
|
library_init(NULL);
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "manager.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "manager.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ int main(int arc, char *argv[])
|
|||||||
int timeout, threads;
|
int timeout, threads;
|
||||||
|
|
||||||
library_init(NULL);
|
library_init(NULL);
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "medsrv.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "medsrv.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
+1
-1
@@ -238,7 +238,7 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, "integrity check of openac failed\n");
|
fprintf(stderr, "integrity check of openac failed\n");
|
||||||
exit(SS_RC_DAEMON_INTEGRITY);
|
exit(SS_RC_DAEMON_INTEGRITY);
|
||||||
}
|
}
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "openac.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "openac.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
exit(SS_RC_INITIALIZATION_FAILED);
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
|
|||||||
+1
-1
@@ -167,7 +167,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "integrity check of pki failed\n");
|
fprintf(stderr, "integrity check of pki failed\n");
|
||||||
exit(SS_RC_DAEMON_INTEGRITY);
|
exit(SS_RC_DAEMON_INTEGRITY);
|
||||||
}
|
}
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "pki.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "pki.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
exit(SS_RC_INITIALIZATION_FAILED);
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
|
|||||||
@@ -924,7 +924,7 @@ int main(int argc, char **argv)
|
|||||||
init_log("scepclient");
|
init_log("scepclient");
|
||||||
|
|
||||||
/* load plugins, further infrastructure may need it */
|
/* load plugins, further infrastructure may need it */
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "scepclient.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "scepclient.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
exit_scepclient("plugin loading failed");
|
exit_scepclient("plugin loading failed");
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ bool starter_netkey_init(void)
|
|||||||
|
|
||||||
void starter_netkey_cleanup(void)
|
void starter_netkey_cleanup(void)
|
||||||
{
|
{
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins,
|
||||||
lib->settings->get_str(lib->settings, "starter.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "starter.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
DBG1(DBG_APP, "unable to load kernel plugins");
|
DBG1(DBG_APP, "unable to load kernel plugins");
|
||||||
|
|||||||
Reference in New Issue
Block a user