[network-manager-openconnect] Fix import/export with empty cacert/cert/privkey options
- From: dwmw2 <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openconnect] Fix import/export with empty cacert/cert/privkey options
- Date: Wed, 15 Mar 2017 10:20:23 +0000 (UTC)
commit f58893e15fc7bac199f5afa95287f5101b6cbdb0
Author: David Woodhouse <dwmw2 infradead org>
Date: Wed Mar 15 10:17:51 2017 +0000
Fix import/export with empty cacert/cert/privkey options
We were writing a filename of literally "(null") to the exported config
when these were unset, then complaining of being unable to open a file
with that name on subsequent import.
https://bugs.launchpad.net/ubuntu/+bug/1673015
properties/nm-openconnect-editor-plugin.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/properties/nm-openconnect-editor-plugin.c b/properties/nm-openconnect-editor-plugin.c
index c7af0e4..9137d46 100644
--- a/properties/nm-openconnect-editor-plugin.c
+++ b/properties/nm-openconnect-editor-plugin.c
@@ -153,9 +153,10 @@ import (NMVpnEditorPlugin *iface, const char *path, GError **error)
if (buf)
g_object_set (s_con, NM_SETTING_CONNECTION_ID, buf, NULL);
- /* CA Certificate */
+ /* CA Certificate. We have an exception for filename "(null)" because
+ * the exporter used to do that wrongly. */
buf = g_key_file_get_string (keyfile, "openconnect", "CACert", NULL);
- if (buf)
+ if (buf && strcmp(buf, "(null)"))
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_CACERT, buf);
/* Protocol */
@@ -180,12 +181,12 @@ import (NMVpnEditorPlugin *iface, const char *path, GError **error)
/* User Certificate */
buf = g_key_file_get_string (keyfile, "openconnect", "UserCertificate", NULL);
- if (buf)
+ if (buf && strcmp(buf, "(null)"))
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_USERCERT, buf);
/* Private Key */
buf = g_key_file_get_string (keyfile, "openconnect", "PrivateKey", NULL);
- if (buf)
+ if (buf && strcmp(buf, "(null)"))
nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_PRIVKEY, buf);
/* FSID */
@@ -325,13 +326,13 @@ export (NMVpnEditorPlugin *iface,
"StokenString=%s\n",
/* Description */ nm_setting_connection_get_id (s_con),
/* Host */ gateway,
- /* CA Certificate */ cacert,
+ /* CA Certificate */ cacert ? cacert : "",
/* Protocol */ protocol ? protocol : "anyconnect",
/* Proxy */ proxy ? proxy : "",
/* Cisco Secure Desktop */ csd_enable ? "1" : "0",
/* CSD Wrapper Script */ csd_wrapper ? csd_wrapper : "",
- /* User Certificate */ usercert,
- /* Private Key */ privkey,
+ /* User Certificate */ usercert ? usercert : "",
+ /* Private Key */ privkey ? privkey : "",
/* FSID */ pem_passphrase_fsid ? "1" : "0",
/* Prevent invalid cert */ prevent_invalid_cert ? "1" : "0",
/* Soft token mode */ token_mode ? token_mode : "",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]