[network-manager-openvpn/th/export-bgo764132: 20/23] properties: refactor do_export() (refactor writing "keysize")



commit 84a7ae3ebc0a6bef89dfb620960ad9cc65188647
Author: Thomas Haller <thaller redhat com>
Date:   Thu Mar 24 11:45:39 2016 +0100

    properties: refactor do_export() (refactor writing "keysize")

 properties/import-export.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index d87a359..fa69b75 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;
        const char *local_ip = NULL;
        const char *remote_ip = NULL;
-       gboolean keysize_exists = FALSE;
-       guint32 keysize = 0;
        const char *proxy_type = NULL;
        const char *proxy_server = NULL;
        const char *proxy_port = NULL;
@@ -1690,15 +1688,6 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
 
        connection_type = _arg_is_set (nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE));
 
-       /* Advanced values start */
-       value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_KEYSIZE);
-       if (_arg_is_set (value)) {
-               keysize_exists = TRUE;
-               keysize = strtol (value, NULL, 10);
-       }
-
-       /* Advanced values end */
-
        f = g_string_sized_new (512);
 
        args_write_line (f, "client");
@@ -1801,8 +1790,9 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
 
        args_write_line_setting_value (f, "cipher", s_vpn, NM_OPENVPN_KEY_CIPHER);
 
-       if (keysize_exists)
-               args_write_line_int64 (f, "keysize", keysize);
+       value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_KEYSIZE);
+       if (_arg_is_set (value))
+               args_write_line_int64_str (f, "keysize", value);
 
        if (nm_streq0 (nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO), "yes"))
                args_write_line (f, "comp-lzo", "yes");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]