mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 04:20:23 +01:00
settings: add other check to ensure no duplicates in load_plugins()
We already avoid loading duplicate plugins by checking find_plugin(). That iterates the plugins @list and checks for duplicate names. Additionally, also reject duplicates based on the @plugins list. Also, move the check for "keyfile" before, so that all explicit checks for (statically) known names are early and together.
This commit is contained in:
parent
9558560862
commit
f979124dc9
1 changed files with 11 additions and 4 deletions
|
|
@ -726,10 +726,6 @@ load_plugins (NMSettings *self, const char **plugins, GError **error)
|
|||
if (has_no_ibft && !strcmp (pname, "ibft"))
|
||||
continue;
|
||||
|
||||
obj = find_plugin (list, pname);
|
||||
if (obj)
|
||||
continue;
|
||||
|
||||
/* keyfile plugin is built-in now */
|
||||
if (strcmp (pname, "keyfile") == 0) {
|
||||
if (!keyfile_added) {
|
||||
|
|
@ -739,6 +735,17 @@ load_plugins (NMSettings *self, const char **plugins, GError **error)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (_nm_utils_strv_find_first ((char **) plugins,
|
||||
iter - plugins,
|
||||
pname) >= 0) {
|
||||
/* the plugin is already mentioned in the list previously.
|
||||
* Don't load a duplicate. */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (find_plugin (list, pname))
|
||||
continue;
|
||||
|
||||
load_plugin:
|
||||
{
|
||||
GModule *plugin;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue