diff options
| author | Michael Biebl <biebl@debian.org> | 2026-02-22 00:40:03 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2026-02-22 00:40:03 +0100 |
| commit | ccdb9117cca7141ee709afca8b25c966ff4fa18e (patch) | |
| tree | 3b7377c95e1d4049c13dd9101ae923fee70ab91d /src/contrib/nm-vpn-plugin-utils.c | |
| parent | d0ea10125cc04f55c1864451198d87fb801d1457 (diff) | |
| parent | 067fb576988f685e83ac8b0ae690334aff547c85 (diff) | |
Update upstream source from tag 'upstream/1.56.0'
Update to upstream version '1.56.0' with Debian dir 15fab61a7abf1fd4e2ba46785f96d935e87d32bb
Diffstat (limited to 'src/contrib/nm-vpn-plugin-utils.c')
| -rw-r--r-- | src/contrib/nm-vpn-plugin-utils.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/contrib/nm-vpn-plugin-utils.c b/src/contrib/nm-vpn-plugin-utils.c index a9407608..24b08ac6 100644 --- a/src/contrib/nm-vpn-plugin-utils.c +++ b/src/contrib/nm-vpn-plugin-utils.c @@ -155,3 +155,33 @@ nm_vpn_plugin_utils_load_editor(const char *module_path, g_return_val_if_fail(NM_IS_VPN_EDITOR(editor), NULL); return editor; } + +char * +nm_vpn_plugin_utils_get_cert_path(const char *plugin) +{ + const char *path; + + g_return_val_if_fail(plugin, NULL); + + /* Users can set NM_CERT_PATH=~/.cert to be compatible with the certificate + * directory used in the past. */ + path = g_getenv("NM_CERT_PATH"); + if (path) + return g_build_filename(path, plugin, NULL); + + /* Otherwise use XDG_DATA_HOME. We use subdirectory "networkmanagement/certificates" + * because the SELinux policy already has rules to set the correct labels in that + * directory. */ + path = g_getenv("XDG_DATA_HOME"); + if (path) + return g_build_filename(path, "networkmanagement", "certificates", plugin, NULL); + + /* Use the default value for XDG_DATA_HOME */ + return g_build_filename(g_get_home_dir(), + ".local", + "share", + "networkmanagement", + "certificates", + plugin, + NULL); +} |