[NetworkManager-libreswan/nm-1-0: 49/51] service: disable agresive mode when there's no group name



commit cb73377478f33ec064029ff1cbf00776a8d3ff3c
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Thu Jan 21 21:46:58 2016 +0100

    service: disable agresive mode when there's no group name
    
    (cherry picked from commit 2c510b631d5bec3cbd130cde308a5cff00adcd2e)

 properties/nm-openswan.c  | 10 ----------
 src/nm-openswan-service.c | 19 ++++++++++++++-----
 2 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/properties/nm-openswan.c b/properties/nm-openswan.c
index f9687ed..b94a863 100644
--- a/properties/nm-openswan.c
+++ b/properties/nm-openswan.c
@@ -137,16 +137,6 @@ check_validity (OpenswanPluginUiWidget *self, GError **error)
                return FALSE;
        }
 
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_entry"));
-       str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
-       if (!str || !strlen (str)) {
-               g_set_error (error,
-                            OPENSWAN_PLUGIN_UI_ERROR,
-                            OPENSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY,
-                            NM_OPENSWAN_LEFTID);
-               return FALSE;
-       }
-
        return TRUE;
 }
 
diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c
index 85c145b..4362bdb 100644
--- a/src/nm-openswan-service.c
+++ b/src/nm-openswan-service.c
@@ -661,16 +661,20 @@ nm_openswan_config_write (gint fd,
        const char *default_username;
        const char *phase1_alg_str;
        const char *phase2_alg_str;
+       const char *leftid;
 
        g_assert (fd >= 0);
        g_assert (s_vpn);
        g_assert (con_name);
 
+       leftid = nm_setting_vpn_get_data_item (s_vpn, NM_OPENSWAN_LEFTID);
        write_config_option (fd, "conn %s\n", con_name);
-       write_config_option (fd, " aggrmode=yes\n");
+       if (leftid) {
+               write_config_option (fd, " aggrmode=yes\n");
+               write_config_option (fd, " leftid=@%s\n", leftid);
+       }
        write_config_option (fd, " authby=secret\n");
        write_config_option (fd, " left=%%defaultroute\n");
-       write_config_option (fd, " leftid=@%s\n", nm_setting_vpn_get_data_item (s_vpn, NM_OPENSWAN_LEFTID));
        write_config_option (fd, " leftxauthclient=yes\n");
        write_config_option (fd, " leftmodecfgclient=yes\n");
 
@@ -723,7 +727,7 @@ nm_openswan_config_psk_write (NMSettingVPN *s_vpn,
                               const char *secrets_path,
                               GError **error)
 {
-       const char *pw_type, *psk, *leftid;
+       const char *pw_type, *psk, *leftid, *right;
        int fd;
 
        /* Check for ignored group password */
@@ -748,8 +752,13 @@ nm_openswan_config_psk_write (NMSettingVPN *s_vpn,
        }
 
        leftid = nm_setting_vpn_get_data_item (s_vpn, NM_OPENSWAN_LEFTID);
-       g_assert (leftid);
-       write_config_option (fd, "@%s: PSK \"%s\"\n", leftid, psk);
+       if (leftid) {
+               write_config_option (fd, "@%s: PSK \"%s\"\n", leftid, psk);
+       } else {
+               right = nm_setting_vpn_get_data_item (s_vpn, NM_OPENSWAN_RIGHT);
+               g_assert (right);
+               write_config_option (fd, "%s %%any: PSK \"%s\"\n", right, psk);
+       }
 
        close (fd);
        return TRUE;


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