diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2016-07-16 15:19:53 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2016-07-16 15:19:53 +0200 |
commit | a4ab9f7f145c94a5eeb950b92b95c3d362baee67 (patch) | |
tree | b3490a4d2054b18dd1549416216557c8114329aa /src/libstrongswan/plugins/plugin_loader.c | |
parent | 7c6a8194526dc1035140a3157a07b2d9dbfedc59 (diff) | |
parent | bf372706c469764d59e9f29c39e3ecbebd72b8d2 (diff) | |
download | vyos-strongswan-a4ab9f7f145c94a5eeb950b92b95c3d362baee67.tar.gz vyos-strongswan-a4ab9f7f145c94a5eeb950b92b95c3d362baee67.zip |
Merge tag 'upstream/5.5.0'
Upstream version 5.5.0
Diffstat (limited to 'src/libstrongswan/plugins/plugin_loader.c')
-rw-r--r-- | src/libstrongswan/plugins/plugin_loader.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/libstrongswan/plugins/plugin_loader.c b/src/libstrongswan/plugins/plugin_loader.c index 01d0495be..5787eac00 100644 --- a/src/libstrongswan/plugins/plugin_loader.c +++ b/src/libstrongswan/plugins/plugin_loader.c @@ -1024,6 +1024,15 @@ static int plugin_priority_cmp(const plugin_priority_t *a, return diff; } +/** + * Convert enumerated plugin_priority_t to a plugin name + */ +static bool plugin_priority_filter(void *null, plugin_priority_t **prio, + char **name) +{ + *name = (*prio)->name; + return TRUE; +} /** * Determine the list of plugins to load via load option in each plugin's @@ -1036,12 +1045,7 @@ static char *modular_pluginlist(char *list) plugin_priority_t item, *current, found; char *plugin, *plugins = NULL; int i = 0, max_prio; - - if (!lib->settings->get_bool(lib->settings, "%s.load_modular", FALSE, - lib->ns)) - { - return list; - } + bool load_def = FALSE; given = array_create(sizeof(plugin_priority_t), 0); final = array_create(sizeof(plugin_priority_t), 0); @@ -1058,16 +1062,26 @@ static char *modular_pluginlist(char *list) /* the maximum priority used for plugins not found in this list */ max_prio = i + 1; - enumerator = lib->settings->create_section_enumerator(lib->settings, + if (lib->settings->get_bool(lib->settings, "%s.load_modular", FALSE, + lib->ns)) + { + enumerator = lib->settings->create_section_enumerator(lib->settings, "%s.plugins", lib->ns); + } + else + { + enumerator = enumerator_create_filter(array_create_enumerator(given), + (void*)plugin_priority_filter, NULL, NULL); + load_def = TRUE; + } while (enumerator->enumerate(enumerator, &plugin)) { item.prio = lib->settings->get_int(lib->settings, - "%s.plugins.%s.load", 0, lib->ns, plugin); + "%s.plugins.%s.load", 0, lib->ns, plugin); if (!item.prio) { if (!lib->settings->get_bool(lib->settings, - "%s.plugins.%s.load", FALSE, lib->ns, plugin)) + "%s.plugins.%s.load", load_def, lib->ns, plugin)) { continue; } @@ -1083,7 +1097,6 @@ static char *modular_pluginlist(char *list) array_insert(final, ARRAY_TAIL, &item); } enumerator->destroy(enumerator); - array_destroy_function(given, (void*)plugin_priority_free, NULL); array_sort(final, (void*)plugin_priority_cmp, NULL); @@ -1100,6 +1113,7 @@ static char *modular_pluginlist(char *list) free(prev); } enumerator->destroy(enumerator); + array_destroy_function(given, (void*)plugin_priority_free, NULL); array_destroy(final); return plugins; } |