libnm/vpn: search VPN plugin in NMPLUGINDIR

System Internals / NetworkManager - Thomas Haller [redhat.com] - 19 April 2016 07:59 UTC

In commit ca000cffbb9ef20c6dd965283df3f1babf0a7745, we changed to accept a plugin library name without path. One reason for that is to keep architecture dependent parts out of the .name file and possibly support multilib.

However, the shared libraries of VPN plugins are not installed in a global library search path, but for example into "/usr/lib64/NetworkManager/libnm-vpn-plugin-openvpn.so". In that case, specifying "plugin=libnm-vpn-plugin-openvpn.so" would not be enough to find plugin.

Instead, when configuring a plugin name without path, assume it is in NMPLUGINDIR directory. Modify nm_vpn_editor_plugin_load_from_file() to allow path-less plugin-names. Previously such names would be rejected as not being absolute. This API allows to do file verification before loading the plugin, but it now supports prepending NMPLUGINDIR to the plugin name. Basically, this function mangles the plugin_name argument and checks that such a file exists.

The recently added nm_vpn_editor_plugin_load() continues to behave as before: it does no checks whatsoever and passes the name directly to dlopen(). That way, it uses system search paths like LD_LIBRARY_PATH and performs no checks on the file.

Fixes: ca000cffbb9ef20c6dd965283df3f1babf0a7745

0b128ae libnm/vpn: search VPN plugin in NMPLUGINDIR
libnm-core/Makefile.am | 1 +
libnm-core/nm-core-internal.h | 8 ---
libnm-core/nm-vpn-editor-plugin.c | 121 ++++++++++++++++++-------------------
libnm-core/nm-vpn-editor-plugin.h | 2 +-
libnm-core/nm-vpn-plugin-info.c | 13 ++--
5 files changed, 68 insertions(+), 77 deletions(-)

Upstream: cgit.freedesktop.org


  • Share