clients: accept service without org.freedesktop.NetworkManager prefix
in nm_vpn_get_plugin_by_service()
This commit is contained in:
@@ -41,6 +41,7 @@ nm_vpn_get_plugin_by_service (const char *service, GError **error)
|
|||||||
{
|
{
|
||||||
NMVpnEditorPlugin *plugin = NULL;
|
NMVpnEditorPlugin *plugin = NULL;
|
||||||
NMVpnPluginInfo *plugin_info;
|
NMVpnPluginInfo *plugin_info;
|
||||||
|
char *type = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (service != NULL, NULL);
|
g_return_val_if_fail (service != NULL, NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
@@ -48,6 +49,9 @@ nm_vpn_get_plugin_by_service (const char *service, GError **error)
|
|||||||
if (G_UNLIKELY (!plugins_loaded))
|
if (G_UNLIKELY (!plugins_loaded))
|
||||||
nm_vpn_get_plugins ();
|
nm_vpn_get_plugins ();
|
||||||
|
|
||||||
|
if (!g_str_has_prefix (service, NM_DBUS_INTERFACE))
|
||||||
|
service = type = g_strdup_printf ("%s.%s", NM_DBUS_INTERFACE, service);
|
||||||
|
|
||||||
plugin_info = nm_vpn_plugin_info_list_find_by_service (plugins, service);
|
plugin_info = nm_vpn_plugin_info_list_find_by_service (plugins, service);
|
||||||
if (plugin_info) {
|
if (plugin_info) {
|
||||||
plugin = nm_vpn_plugin_info_get_editor_plugin (plugin_info);
|
plugin = nm_vpn_plugin_info_get_editor_plugin (plugin_info);
|
||||||
@@ -56,6 +60,7 @@ nm_vpn_get_plugin_by_service (const char *service, GError **error)
|
|||||||
} else
|
} else
|
||||||
g_set_error_literal (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
|
g_set_error_literal (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
|
||||||
_("could not get VPN plugin info"));
|
_("could not get VPN plugin info"));
|
||||||
|
g_free (type);
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user