streamlined debug output of integrity tests
This commit is contained in:
@@ -62,40 +62,48 @@ static plugin_t* load_plugin(private_plugin_loader_t *this,
|
||||
|
||||
snprintf(file, sizeof(file), "%s/libstrongswan-%s.so", path, name);
|
||||
|
||||
if (lib->integrity &&
|
||||
!lib->integrity->check_file(lib->integrity, name, file))
|
||||
if (lib->integrity)
|
||||
{
|
||||
DBG1("file integrity test of plugin '%s' failed", name);
|
||||
return NULL;
|
||||
if (!lib->integrity->check_file(lib->integrity, name, file))
|
||||
{
|
||||
DBG1("plugin '%s': failed file integrity test of"
|
||||
" 'libstrongswan-%s.so'", name, name);
|
||||
return NULL;
|
||||
}
|
||||
DBG1("plugin '%s': passed file integrity test of"
|
||||
" 'libstrongswan-%s.so'", name, name);
|
||||
}
|
||||
handle = dlopen(file, RTLD_LAZY);
|
||||
if (handle == NULL)
|
||||
{
|
||||
DBG1("loading plugin '%s' failed: %s", name, dlerror());
|
||||
DBG1("plugin '%s': failed to load '%s' - %s", name, file, dlerror());
|
||||
return NULL;
|
||||
}
|
||||
constructor = dlsym(handle, "plugin_create");
|
||||
if (constructor == NULL)
|
||||
{
|
||||
DBG1("loading plugin '%s' failed: no plugin_create() function", name);
|
||||
DBG1("plugin '%s': failed to load - no plugin_create() function", name);
|
||||
dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
if (lib->integrity &&
|
||||
!lib->integrity->check_segment(lib->integrity, name, constructor))
|
||||
if (lib->integrity)
|
||||
{
|
||||
DBG1("segment integrity test of plugin '%s' failed", name);
|
||||
dlclose(handle);
|
||||
return NULL;
|
||||
if (!lib->integrity->check_segment(lib->integrity, name, constructor))
|
||||
{
|
||||
DBG1("plugin '%s': failed segment integrity test", name);
|
||||
dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
DBG1("plugin '%s': passed segment integrity test", name);
|
||||
}
|
||||
plugin = constructor();
|
||||
if (plugin == NULL)
|
||||
{
|
||||
DBG1("loading plugin '%s' failed: plugin_create() returned NULL", name);
|
||||
DBG1("plugin '%s': failed to load - plugin_create() returned NULL", name);
|
||||
dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
DBG2("plugin '%s' loaded successfully", name);
|
||||
DBG2("plugin '%s': loaded successfully", name);
|
||||
|
||||
/* we do not store or free dlopen() handles, leak_detective requires
|
||||
* the modules to keep loaded until leak report */
|
||||
|
||||
Reference in New Issue
Block a user