| 1 | From d3026a6d331298003ccc6cd9d2e20dcb7fa9ae1d Mon Sep 17 00:00:00 2001
|
| 2 | From: =?UTF-8?q?Tom=C3=A1=C5=A1=20=C4=8Cech?= <[email protected]>
|
| 3 | Date: Wed, 3 Jul 2019 13:31:54 +0200
|
| 4 | Subject: [PATCH] respect NM_VPN_PLUGIN_DIR
|
| 5 |
|
| 6 | Rebased by Maxim Cournoyer on 2022/08/23.
|
| 7 |
|
| 8 | diff --git a/src/core/vpn/nm-vpn-manager.c b/src/core/vpn/nm-vpn-manager.c
|
| 9 | index 6bf8edaee5..9bd960ba86 100644
|
| 10 | |
| 11 | |
| 12 | @@ -209,8 +209,9 @@ nm_vpn_manager_init(NMVpnManager *self)
|
| 13 | NMVpnManagerPrivate *priv = NM_VPN_MANAGER_GET_PRIVATE(self);
|
| 14 | GFile *file;
|
| 15 | GSList *infos, *info;
|
| 16 | - const char *conf_dir_etc = _nm_vpn_plugin_info_get_default_dir_etc();
|
| 17 | - const char *conf_dir_lib = _nm_vpn_plugin_info_get_default_dir_lib();
|
| 18 | + const char *conf_dir_etc = _nm_vpn_plugin_info_get_default_dir_etc();
|
| 19 | + const char *conf_dir_lib = _nm_vpn_plugin_info_get_default_dir_lib();
|
| 20 | + const char *conf_dir_user = _nm_vpn_plugin_info_get_default_dir_user();
|
| 21 |
|
| 22 | /* Watch the VPN directory for changes */
|
| 23 | file = g_file_new_for_path(conf_dir_lib);
|
| 24 | @@ -229,6 +230,14 @@ nm_vpn_manager_init(NMVpnManager *self)
|
| 25 | g_signal_connect(priv->monitor_etc, "changed", G_CALLBACK(vpn_dir_changed), self);
|
| 26 | }
|
| 27 |
|
| 28 | + file = g_file_new_for_path(conf_dir_user);
|
| 29 | + priv->monitor_etc = g_file_monitor_directory(file, G_FILE_MONITOR_NONE, NULL, NULL);
|
| 30 | + g_object_unref(file);
|
| 31 | + if (priv->monitor_etc) {
|
| 32 | + priv->monitor_id_etc =
|
| 33 | + g_signal_connect(priv->monitor_etc, "changed", G_CALLBACK(vpn_dir_changed), self);
|
| 34 | + }
|
| 35 | +
|
| 36 | /* first read conf_dir_lib. The name files are not really user configuration, but
|
| 37 | * plugin configuration. Hence we expect ~newer~ plugins to install their files
|
| 38 | * in /usr/lib/NetworkManager. We want to prefer those files.
|
| 39 | @@ -243,6 +252,11 @@ nm_vpn_manager_init(NMVpnManager *self)
|
| 40 | try_add_plugin(self, info->data);
|
| 41 | g_slist_free_full(infos, g_object_unref);
|
| 42 |
|
| 43 | + infos = _nm_vpn_plugin_info_list_load_dir(conf_dir_user, TRUE, 0, NULL, NULL);
|
| 44 | + for (info = infos; info; info = info->next)
|
| 45 | + try_add_plugin(self, info->data);
|
| 46 | + g_slist_free_full(infos, g_object_unref);
|
| 47 | +
|
| 48 | priv->active_services = g_hash_table_new_full(nm_str_hash, g_str_equal, g_free, NULL);
|
| 49 | }
|
| 50 |
|