diff options
| author | Michael Biebl <biebl@debian.org> | 2026-02-22 00:39:58 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2026-02-22 00:39:58 +0100 |
| commit | 067fb576988f685e83ac8b0ae690334aff547c85 (patch) | |
| tree | 204c7c8a0300691c53627cd3418cf54671ada1a8 /src/contrib/nm-vpn-plugin-utils.c | |
| parent | 6de29285e533f4fec22a219013f3687edb6b7399 (diff) | |
New upstream version 1.56.0 upstream/1.56.0
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); +} |