vpn: add nm_vpn_plugin_info_supports_safe_private_file_access()

The new API indicates that the VPN plugin supports reading files
(certificates, keys) of private connections in a safe way
(i.e. checking user permissions), or that it doesn't need to read any
file from disk.

(cherry picked from commit 10db4baeb6)
(cherry picked from commit 8437e14758)
(cherry picked from commit 15346f1a4f)
This commit is contained in:
Beniamino Galvani 2025-10-10 15:08:34 +02:00 committed by Íñigo Huguet
parent 425fd0d031
commit 29d190ef95
4 changed files with 31 additions and 0 deletions

View file

@ -2048,3 +2048,8 @@ global:
nm_setting_ethtool_fec_mode_get_type;
nm_ethtool_optname_is_fec;
} libnm_1_50_0;
libnm_1_52_2 {
global:
nm_vpn_plugin_info_supports_safe_private_file_access;
} libnm_1_52_0;

View file

@ -93,6 +93,7 @@ def syms_from_ver(verfile):
# hardcode it.
c_syms["nm_ethtool_optname_is_feature"] = "1.20"
c_syms["nm_setting_bond_port_get_prio"] = "1.44"
c_syms["nm_vpn_plugin_info_supports_safe_private_file_access"] = "1.56"
return c_syms

View file

@ -913,6 +913,29 @@ nm_vpn_plugin_info_supports_multiple(NMVpnPluginInfo *self)
return _nm_utils_ascii_str_to_bool(s, FALSE);
}
/**
* nm_vpn_plugin_info_supports_safe_private_file_access:
* @self: plugin info instance
*
* Returns: %TRUE if the service supports reading files (certificates, keys) of
* private connections in a safe way (i.e. checking user permissions), or
if the service doesn't need to read any file from disk.
*
* Since: 1.56, 1.52.2
*/
gboolean
nm_vpn_plugin_info_supports_safe_private_file_access(NMVpnPluginInfo *self)
{
const char *s;
g_return_val_if_fail(NM_IS_VPN_PLUGIN_INFO(self), FALSE);
s = nm_vpn_plugin_info_lookup_property(self,
NM_VPN_PLUGIN_INFO_KF_GROUP_CONNECTION,
"supports-safe-private-file-access");
return _nm_utils_ascii_str_to_bool(s, FALSE);
}
/**
* nm_vpn_plugin_info_get_aliases:
* @self: plugin info instance

View file

@ -64,6 +64,8 @@ NM_AVAILABLE_IN_1_4
gboolean nm_vpn_plugin_info_supports_hints(NMVpnPluginInfo *self);
NM_AVAILABLE_IN_1_42
gboolean nm_vpn_plugin_info_supports_multiple(NMVpnPluginInfo *self);
NM_AVAILABLE_IN_1_52_2
gboolean nm_vpn_plugin_info_supports_safe_private_file_access(NMVpnPluginInfo *self);
NM_AVAILABLE_IN_1_4
const char *const *nm_vpn_plugin_info_get_aliases(NMVpnPluginInfo *self);
NM_AVAILABLE_IN_1_2