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();
|
this->public.traps = trap_manager_create();
|
||||||
|
|
||||||
/* load plugins, further infrastructure may need it */
|
/* load plugins, further infrastructure may need it */
|
||||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||||
lib->settings->get_str(lib->settings, "charon.load", PLUGINS));
|
lib->settings->get_str(lib->settings, "charon.load", PLUGINS)))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
print_plugins();
|
print_plugins();
|
||||||
|
|
||||||
|
|||||||
@@ -634,20 +634,23 @@ 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);
|
||||||
}
|
}
|
||||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||||
lib->settings->get_str(lib->settings, "pool.load", PLUGINS));
|
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);
|
uri = lib->settings->get_str(lib->settings, "charon.plugins.sql.database", NULL);
|
||||||
if (!uri)
|
if (!uri)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "database URI charon.plugins.sql.database not set.\n");
|
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);
|
db = lib->db->create(lib->db, uri);
|
||||||
if (!db)
|
if (!db)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "opening database failed.\n");
|
fprintf(stderr, "opening database failed.\n");
|
||||||
exit(-1);
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
}
|
}
|
||||||
atexit(cleanup);
|
atexit(cleanup);
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -35,8 +35,11 @@ int main (int arc, char *argv[])
|
|||||||
int threads, timeout;
|
int threads, timeout;
|
||||||
|
|
||||||
library_init(STRONGSWAN_CONF);
|
library_init(STRONGSWAN_CONF);
|
||||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||||
lib->settings->get_str(lib->settings, "manager.load", PLUGINS));
|
lib->settings->get_str(lib->settings, "manager.load", PLUGINS)))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
socket = lib->settings->get_str(lib->settings, "manager.socket", NULL);
|
socket = lib->settings->get_str(lib->settings, "manager.socket", NULL);
|
||||||
debug = lib->settings->get_bool(lib->settings, "manager.debug", FALSE);
|
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;
|
int timeout, threads;
|
||||||
|
|
||||||
library_init(STRONGSWAN_CONF);
|
library_init(STRONGSWAN_CONF);
|
||||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||||
lib->settings->get_str(lib->settings, "medsrv.load", PLUGINS));
|
lib->settings->get_str(lib->settings, "medsrv.load", PLUGINS)))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
socket = lib->settings->get_str(lib->settings, "medsrv.socket", NULL);
|
socket = lib->settings->get_str(lib->settings, "medsrv.socket", NULL);
|
||||||
debug = lib->settings->get_bool(lib->settings, "medsrv.debug", FALSE);
|
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);
|
openlog("openac", 0, LOG_AUTHPRIV);
|
||||||
|
|
||||||
/* initialize library */
|
/* initialize library */
|
||||||
|
atexit(library_deinit);
|
||||||
if (!library_init(STRONGSWAN_CONF))
|
if (!library_init(STRONGSWAN_CONF))
|
||||||
{
|
{
|
||||||
library_deinit();
|
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
}
|
}
|
||||||
if (lib->integrity &&
|
if (lib->integrity &&
|
||||||
!lib->integrity->check_file(lib->integrity, "openac", argv[0]))
|
!lib->integrity->check_file(lib->integrity, "openac", argv[0]))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "integrity check of openac failed\n");
|
fprintf(stderr, "integrity check of openac failed\n");
|
||||||
library_deinit();
|
|
||||||
exit(SS_RC_DAEMON_INTEGRITY);
|
exit(SS_RC_DAEMON_INTEGRITY);
|
||||||
}
|
}
|
||||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||||
lib->settings->get_str(lib->settings, "openac.load", PLUGINS));
|
lib->settings->get_str(lib->settings, "openac.load", PLUGINS)))
|
||||||
|
{
|
||||||
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize optionsfrom */
|
/* initialize optionsfrom */
|
||||||
options_t *options = options_create();
|
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");
|
fprintf(stderr, "integrity check of pki failed\n");
|
||||||
exit(SS_RC_DAEMON_INTEGRITY);
|
exit(SS_RC_DAEMON_INTEGRITY);
|
||||||
}
|
}
|
||||||
lib->plugins->load(lib->plugins, PLUGINDIR,
|
if (!lib->plugins->load(lib->plugins, PLUGINDIR,
|
||||||
lib->settings->get_str(lib->settings, "pki.load", PLUGINS));
|
lib->settings->get_str(lib->settings, "pki.load", PLUGINS)))
|
||||||
|
{
|
||||||
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
switch (getopt_long(argc, argv, "", long_opts, NULL))
|
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 */
|
/* load plugins, further infrastructure may need it */
|
||||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||||
lib->settings->get_str(lib->settings, "pluto.load", PLUGINS));
|
lib->settings->get_str(lib->settings, "pluto.load", PLUGINS)))
|
||||||
|
{
|
||||||
|
exit(SS_RC_INITIALIZATION_FAILED);
|
||||||
|
}
|
||||||
print_plugins();
|
print_plugins();
|
||||||
|
|
||||||
init_builder();
|
init_builder();
|
||||||
|
|||||||
@@ -759,8 +759,11 @@ 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 */
|
||||||
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
if (!lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,
|
||||||
lib->settings->get_str(lib->settings, "scepclient.load", PLUGINS));
|
lib->settings->get_str(lib->settings, "scepclient.load", PLUGINS)))
|
||||||
|
{
|
||||||
|
exit_scepclient("plugin loading failed");
|
||||||
|
}
|
||||||
print_plugins();
|
print_plugins();
|
||||||
|
|
||||||
if ((filetype_out == 0) && (!request_ca_certificate))
|
if ((filetype_out == 0) && (!request_ca_certificate))
|
||||||
|
|||||||
Reference in New Issue
Block a user