handle plugin loading failures
This commit is contained in:
+5
-2
@@ -491,8 +491,11 @@ static bool initialize(private_daemon_t *this, bool syslog, level_t levels[])
|
||||
this->public.traps = trap_manager_create();
|
||||
|
||||
/* load plugins, further infrastructure may need it */
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "charon.load", PLUGINS));
|
||||
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "charon.load", PLUGINS)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
print_plugins();
|
||||
|
||||
|
||||
@@ -634,20 +634,23 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "integrity check of pool failed\n");
|
||||
exit(SS_RC_DAEMON_INTEGRITY);
|
||||
}
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "pool.load", PLUGINS));
|
||||
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "pool.load", PLUGINS)))
|
||||
{
|
||||
exit(SS_RC_INITIALIZATION_FAILED);
|
||||
}
|
||||
|
||||
uri = lib->settings->get_str(lib->settings, "charon.plugins.sql.database", NULL);
|
||||
if (!uri)
|
||||
{
|
||||
fprintf(stderr, "database URI charon.plugins.sql.database not set.\n");
|
||||
exit(-1);
|
||||
exit(SS_RC_INITIALIZATION_FAILED);
|
||||
}
|
||||
db = lib->db->create(lib->db, uri);
|
||||
if (!db)
|
||||
{
|
||||
fprintf(stderr, "opening database failed.\n");
|
||||
exit(-1);
|
||||
exit(SS_RC_INITIALIZATION_FAILED);
|
||||
}
|
||||
atexit(cleanup);
|
||||
|
||||
@@ -677,7 +680,7 @@ int main(int argc, char *argv[])
|
||||
switch (c)
|
||||
{
|
||||
case EOF:
|
||||
break;
|
||||
break;
|
||||
case 'h':
|
||||
break;
|
||||
case 'w':
|
||||
|
||||
+5
-2
@@ -35,8 +35,11 @@ int main (int arc, char *argv[])
|
||||
int threads, timeout;
|
||||
|
||||
library_init(STRONGSWAN_CONF);
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "manager.load", PLUGINS));
|
||||
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "manager.load", PLUGINS)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
socket = lib->settings->get_str(lib->settings, "manager.socket", NULL);
|
||||
debug = lib->settings->get_bool(lib->settings, "manager.debug", FALSE);
|
||||
|
||||
+5
-2
@@ -34,8 +34,11 @@ int main(int arc, char *argv[])
|
||||
int timeout, threads;
|
||||
|
||||
library_init(STRONGSWAN_CONF);
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "medsrv.load", PLUGINS));
|
||||
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "medsrv.load", PLUGINS)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
socket = lib->settings->get_str(lib->settings, "medsrv.socket", NULL);
|
||||
debug = lib->settings->get_bool(lib->settings, "medsrv.debug", FALSE);
|
||||
|
||||
+6
-4
@@ -220,20 +220,22 @@ int main(int argc, char **argv)
|
||||
openlog("openac", 0, LOG_AUTHPRIV);
|
||||
|
||||
/* initialize library */
|
||||
atexit(library_deinit);
|
||||
if (!library_init(STRONGSWAN_CONF))
|
||||
{
|
||||
library_deinit();
|
||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||
}
|
||||
if (lib->integrity &&
|
||||
!lib->integrity->check_file(lib->integrity, "openac", argv[0]))
|
||||
{
|
||||
fprintf(stderr, "integrity check of openac failed\n");
|
||||
library_deinit();
|
||||
exit(SS_RC_DAEMON_INTEGRITY);
|
||||
}
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "openac.load", PLUGINS));
|
||||
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "openac.load", PLUGINS)))
|
||||
{
|
||||
exit(SS_RC_INITIALIZATION_FAILED);
|
||||
}
|
||||
|
||||
/* initialize optionsfrom */
|
||||
options_t *options = options_create();
|
||||
|
||||
+5
-2
@@ -747,8 +747,11 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "integrity check of pki failed\n");
|
||||
exit(SS_RC_DAEMON_INTEGRITY);
|
||||
}
|
||||
lib->plugins->load(lib->plugins, PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "pki.load", PLUGINS));
|
||||
if (!lib->plugins->load(lib->plugins, PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "pki.load", PLUGINS)))
|
||||
{
|
||||
exit(SS_RC_INITIALIZATION_FAILED);
|
||||
}
|
||||
|
||||
switch (getopt_long(argc, argv, "", long_opts, NULL))
|
||||
{
|
||||
|
||||
@@ -652,8 +652,11 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* load plugins, further infrastructure may need it */
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "pluto.load", PLUGINS));
|
||||
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "pluto.load", PLUGINS)))
|
||||
{
|
||||
exit(SS_RC_INITIALIZATION_FAILED);
|
||||
}
|
||||
print_plugins();
|
||||
|
||||
init_builder();
|
||||
|
||||
@@ -759,8 +759,11 @@ int main(int argc, char **argv)
|
||||
init_log("scepclient");
|
||||
|
||||
/* load plugins, further infrastructure may need it */
|
||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "scepclient.load", PLUGINS));
|
||||
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||
lib->settings->get_str(lib->settings, "scepclient.load", PLUGINS)))
|
||||
{
|
||||
exit_scepclient("plugin loading failed");
|
||||
}
|
||||
print_plugins();
|
||||
|
||||
if ((filetype_out == 0) && (!request_ca_certificate))
|
||||
|
||||
Reference in New Issue
Block a user