[network-manager-openvpn: 10/27] properties: refactor do_export() (refactor writing "secret")
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn: 10/27] properties: refactor do_export() (refactor writing "secret")
- Date: Tue, 29 Mar 2016 11:32:08 +0000 (UTC)
commit 2003d3e103b98f8529c3c6bd5b42e1245b4fb110
Author: Thomas Haller <thaller redhat com>
Date: Thu Mar 24 10:59:32 2016 +0100
properties: refactor do_export() (refactor writing "secret")
properties/import-export.c | 23 +++++++++--------------
1 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index d08f31e..ede7e12 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -1648,8 +1648,6 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
const char *connection_type = NULL;
gs_free char *user_cert = NULL;
gs_free char *private_key = NULL;
- gs_free char *static_key = NULL;
- const char *static_key_direction = NULL;
const char *local_ip = NULL;
const char *remote_ip = NULL;
gs_free char *tls_auth = NULL;
@@ -1729,16 +1727,6 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
private_key = nmv_utils_str_utf8safe_unescape (value);
}
- if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_STATIC_KEY)) {
- value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY);
- if (_arg_is_set (value))
- static_key = nmv_utils_str_utf8safe_unescape (value);
-
- value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY_DIRECTION);
- if (_arg_is_set (value))
- static_key_direction = value;
- }
-
/* Advanced values start */
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS);
if (_arg_is_set (value)) {
@@ -1861,8 +1849,15 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
args_write_line (f, "auth-user-pass");
if (!strcmp (connection_type, NM_OPENVPN_CONTYPE_STATIC_KEY)) {
- if (static_key)
- args_write_line (f, "secret", static_key, static_key_direction);
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_STATIC_KEY);
+ if (_arg_is_set (value)) {
+ gs_free char *s_free = NULL;
+
+ args_write_line (f,
+ "secret",
+ nmv_utils_str_utf8safe_unescape_c (value, &s_free),
+ _arg_is_set (nm_setting_vpn_get_data_item (s_vpn,
NM_OPENVPN_KEY_STATIC_KEY_DIRECTION)));
+ }
}
if (reneg_exists)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]