Update to NetworkManager-libreswan 1.2-beta2

This commit is contained in:
Lubomir Rintel 2016-03-01 17:45:52 +01:00
parent 47a45549e8
commit 19f89a6e16
17 changed files with 8 additions and 2402 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ NetworkManager-openswan-0.8.tar.gz
/NetworkManager-openswan-1.2.0.tar.xz
/NetworkManager-libreswan-1.2.0.tar.xz
/NetworkManager-libreswan-1.1.90.tar.xz
/NetworkManager-libreswan-1.1.91.tar.xz

View File

@ -1,47 +0,0 @@
From b939d37b1333f74434bbf8f550ad55c7aef0138c Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 22 Jan 2016 17:19:43 +0100
Subject: [PATCH 02/17] trivial: rename a badly named subroutine
---
properties/nm-libreswan.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/properties/nm-libreswan.c b/properties/nm-libreswan.c
index 5634d53..2240883 100644
--- a/properties/nm-libreswan.c
+++ b/properties/nm-libreswan.c
@@ -315,9 +315,9 @@ init_one_pw_combo (LibreswanEditor *self,
static gboolean
init_editor_plugin (LibreswanEditor *self,
- NMConnection *connection,
- gboolean new_connection,
- GError **error)
+ NMConnection *connection,
+ gboolean new_connection,
+ GError **error)
{
LibreswanEditorPrivate *priv = LIBRESWAN_EDITOR_GET_PRIVATE (self);
NMSettingVpn *s_vpn = NULL;
@@ -559,7 +559,7 @@ is_new_func (const char *key, const char *value, gpointer user_data)
}
static NMVpnEditor *
-nm_vpn_editor_interface_new (NMConnection *connection, GError **error)
+nm_vpn_editor_new (NMConnection *connection, GError **error)
{
NMVpnEditor *object;
LibreswanEditorPrivate *priv;
@@ -712,7 +712,7 @@ get_capabilities (NMVpnEditorPlugin *iface)
static NMVpnEditor *
get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
{
- return nm_vpn_editor_interface_new (connection, error);
+ return nm_vpn_editor_new (connection, error);
}
static void
--
2.5.0

View File

@ -1,26 +0,0 @@
From e3c8b338d0e511a8b208627de34295d7321185dc Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 25 Jan 2016 10:15:00 +0100
Subject: [PATCH 03/17] import/export: add a terminating newline
A comspetic thing.
---
common/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/utils.c b/common/utils.c
index 53c3878..5d573f4 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -150,7 +150,7 @@ nm_libreswan_config_write (gint fd,
* libreswan fails parsing the configuration if you include the \n.
* WTF?
*/
- if (openswan)
+ if (openswan || !bus_name)
(void) write (fd, "\n", 1);
if (debug)
g_print ("\n");
--
2.5.0

View File

@ -1,95 +0,0 @@
From 2c510b631d5bec3cbd130cde308a5cff00adcd2e Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Thu, 21 Jan 2016 21:46:58 +0100
Subject: [PATCH 04/17] service: disable agresive mode when there's no group
name
---
common/utils.c | 9 +++++++--
properties/nm-libreswan.c | 10 ----------
src/nm-libreswan-service.c | 11 ++++++++---
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/common/utils.c b/common/utils.c
index 5d573f4..eff64fb 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -91,6 +91,7 @@ nm_libreswan_config_write (gint fd,
const char *default_username;
const char *phase1_alg_str;
const char *phase2_alg_str;
+ const char *leftid;
/* We abuse the presence of bus name to decide if we're exporting
* the connection or actually configuring Pluto. */
@@ -103,11 +104,15 @@ nm_libreswan_config_write (gint fd,
g_assert (s_vpn);
g_assert (con_name);
+ leftid = nm_setting_vpn_get_data_item (s_vpn, NM_LIBRESWAN_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_LIBRESWAN_LEFTID));
write_config_option (fd, " leftxauthclient=yes\n");
write_config_option (fd, " leftmodecfgclient=yes\n");
diff --git a/properties/nm-libreswan.c b/properties/nm-libreswan.c
index 2240883..d3b4cf8 100644
--- a/properties/nm-libreswan.c
+++ b/properties/nm-libreswan.c
@@ -119,16 +119,6 @@ check_validity (LibreswanEditor *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,
- LIBRESWAN_EDITOR_PLUGIN_ERROR,
- LIBRESWAN_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
- NM_LIBRESWAN_LEFTID);
- return FALSE;
- }
-
return TRUE;
}
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index 335dd7b..e2a217f 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -622,7 +622,7 @@ nm_libreswan_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 */
@@ -647,8 +647,13 @@ nm_libreswan_config_psk_write (NMSettingVpn *s_vpn,
}
leftid = nm_setting_vpn_get_data_item (s_vpn, NM_LIBRESWAN_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_LIBRESWAN_RIGHT);
+ g_assert (right);
+ write_config_option (fd, "%s %%any: PSK \"%s\"\n", right, psk);
+ }
close (fd);
return TRUE;
--
2.5.0

View File

@ -1,24 +0,0 @@
From fa7fc65ad032027a69d1a3b5cd13680feb92a8f7 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Thu, 21 Jan 2016 21:48:16 +0100
Subject: [PATCH 05/17] service: always set modecfgpull=yes
---
common/utils.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/utils.c b/common/utils.c
index eff64fb..1af8558 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -130,6 +130,7 @@ nm_libreswan_config_write (gint fd,
write_config_option (fd, " remote_peer_type=cisco\n");
write_config_option (fd, " rightxauthserver=yes\n");
write_config_option (fd, " rightmodecfgserver=yes\n");
+ write_config_option (fd, " modecfgpull=yes\n");
phase1_alg_str = nm_setting_vpn_get_data_item (s_vpn, NM_LIBRESWAN_IKE);
if (!phase1_alg_str || !strlen (phase1_alg_str))
--
2.5.0

View File

@ -1,24 +0,0 @@
From d942f394bfaa6ecdb9edaee1bcc3ceb4eecc8a85 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 25 Jan 2016 16:48:28 +0100
Subject: [PATCH 06/17] service: avoid setting the default route to the tunnel
---
common/utils.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/utils.c b/common/utils.c
index 1af8558..2ef0bb1 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -131,6 +131,7 @@ nm_libreswan_config_write (gint fd,
write_config_option (fd, " rightxauthserver=yes\n");
write_config_option (fd, " rightmodecfgserver=yes\n");
write_config_option (fd, " modecfgpull=yes\n");
+ write_config_option (fd, " rightsubnet=0.0.0.0/0\n");
phase1_alg_str = nm_setting_vpn_get_data_item (s_vpn, NM_LIBRESWAN_IKE);
if (!phase1_alg_str || !strlen (phase1_alg_str))
--
2.5.0

View File

@ -1,164 +0,0 @@
From e79f2cfc67013c819e392f883af7f987fc3ebd2d Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 22 Jan 2016 16:23:03 +0100
Subject: [PATCH 07/17] properties: don't use depreacted GtkBox subclasses
---
properties/nm-libreswan-dialog.ui | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/properties/nm-libreswan-dialog.ui b/properties/nm-libreswan-dialog.ui
index 56f6816..9f6f9fb 100644
--- a/properties/nm-libreswan-dialog.ui
+++ b/properties/nm-libreswan-dialog.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Tue Jan 7 14:29:05 2014 -->
+<!-- Generated with glade 3.19.0 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<object class="GtkListStore" id="model1">
<columns>
<!-- column-name gchararray -->
@@ -24,23 +24,25 @@
</row>
</data>
</object>
- <object class="GtkVBox" id="libreswan-vbox">
+ <object class="GtkBox" id="libreswan-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
+ <property name="orientation">vertical</property>
<property name="spacing">16</property>
<child>
- <object class="GtkVBox" id="vbox8">
+ <object class="GtkBox" id="vbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label22">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
<property name="use_markup">True</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -146,10 +148,10 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">Gro_up password:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">group_entry</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="top_attach">3</property>
@@ -162,10 +164,10 @@
<object class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">_Gateway:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">gateway_entry</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -176,10 +178,10 @@
<object class="GtkLabel" id="label24">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">G_roup name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">group_entry</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="top_attach">1</property>
@@ -216,10 +218,10 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">_User password:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">group_entry</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="top_attach">2</property>
@@ -259,17 +261,18 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox11">
+ <object class="GtkBox" id="vbox11">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label25">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Optional&lt;/b&gt;</property>
<property name="use_markup">True</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -298,8 +301,8 @@
<object class="GtkLabel" id="label26">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">User name:</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -322,8 +325,8 @@
<object class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">Phase1 Algorithms:</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="top_attach">1</property>
@@ -350,8 +353,8 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">Phase2 Algorithms:</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="top_attach">2</property>
@@ -378,8 +381,8 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">Domain:</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="top_attach">3</property>
--
2.5.0

View File

@ -1,288 +0,0 @@
From 6ee64ada349fdcd07a6df6d238ae0df57e3ce358 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 22 Jan 2016 16:30:17 +0100
Subject: [PATCH 08/17] properties: don't use depreacted GtkGrid
---
properties/nm-libreswan-dialog.ui | 99 ++++++++++++---------------------------
1 file changed, 29 insertions(+), 70 deletions(-)
diff --git a/properties/nm-libreswan-dialog.ui b/properties/nm-libreswan-dialog.ui
index 9f6f9fb..f6d01e6 100644
--- a/properties/nm-libreswan-dialog.ui
+++ b/properties/nm-libreswan-dialog.ui
@@ -56,22 +56,12 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkTable" id="table2">
+ <object class="GtkGrid" id="table2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">5</property>
- <property name="n_columns">3</property>
- <property name="column_spacing">6</property>
+ <property name="orientation">vertical</property>
<property name="row_spacing">6</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
+ <property name="column_spacing">6</property>
<child>
<object class="GtkComboBox" id="group_pass_type_combo">
<property name="visible">True</property>
@@ -86,9 +76,7 @@
</object>
<packing>
<property name="left_attach">2</property>
- <property name="right_attach">3</property>
<property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
</packing>
</child>
<child>
@@ -105,15 +93,10 @@
</object>
<packing>
<property name="left_attach">2</property>
- <property name="right_attach">3</property>
<property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<object class="GtkCheckButton" id="show_passwords_checkbutton">
<property name="label" translatable="yes">Show passwords</property>
<property name="use_action_appearance">False</property>
@@ -125,9 +108,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
</packing>
</child>
<child>
@@ -138,10 +119,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -154,10 +132,8 @@
<property name="xalign">0</property>
</object>
<packing>
+ <property name="left_attach">0</property>
<property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -170,8 +146,8 @@
<property name="xalign">0</property>
</object>
<packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
@@ -184,10 +160,8 @@
<property name="xalign">0</property>
</object>
<packing>
+ <property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -197,8 +171,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"/>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
@@ -208,10 +181,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -224,10 +194,8 @@
<property name="xalign">0</property>
</object>
<packing>
+ <property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -238,12 +206,21 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"/>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
</object>
@@ -290,13 +267,11 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkTable" id="table3">
+ <object class="GtkGrid" id="table3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">4</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">6</property>
<property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="label26">
<property name="visible">True</property>
@@ -305,8 +280,8 @@
<property name="xalign">0</property>
</object>
<packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
@@ -317,8 +292,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"/>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
@@ -329,10 +303,8 @@
<property name="xalign">0</property>
</object>
<packing>
+ <property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -343,10 +315,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -357,10 +326,8 @@
<property name="xalign">0</property>
</object>
<packing>
+ <property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -371,10 +338,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -385,10 +349,8 @@
<property name="xalign">0</property>
</object>
<packing>
+ <property name="left_attach">0</property>
<property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
</packing>
</child>
<child>
@@ -399,10 +361,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options"/>
</packing>
</child>
</object>
--
2.5.0

View File

@ -1,717 +0,0 @@
From fafdb6c24a437038738be2e2613f28f827881575 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 22 Jan 2016 16:36:56 +0100
Subject: [PATCH 09/17] properties: use the new nma-based password widgets
---
properties/Makefile.am | 8 +-
properties/nm-libreswan-dialog.ui | 194 +++++++++++++++-----------------------
properties/nm-libreswan.c | 189 ++++++++++++-------------------------
3 files changed, 142 insertions(+), 249 deletions(-)
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 0e318da..b7f19d0 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -15,12 +15,14 @@ common_CFLAGS = \
libnm_vpn_plugin_libreswan_la_CFLAGS = \
$(common_CFLAGS) \
- $(LIBNM_CFLAGS)
+ $(LIBNM_CFLAGS) \
+ $(LIBNMA_CFLAGS)
libnm_libreswan_properties_la_CFLAGS = \
-DNM_LIBRESWAN_OLD \
$(common_CFLAGS) \
- $(LIBNM_GLIB_CFLAGS)
+ $(LIBNM_GLIB_CFLAGS) \
+ $(LIBNM_GTK_CFLAGS)
libnm_vpn_plugin_libreswan_la_SOURCES = \
nm-libreswan.c \
@@ -32,11 +34,13 @@ libnm_libreswan_properties_la_SOURCES = \
libnm_vpn_plugin_libreswan_la_LIBADD = \
$(GTK_LIBS) \
$(LIBNM_LIBS) \
+ $(LIBNMA_LIBS) \
$(top_builddir)/common/libnm-libreswan-common.la
libnm_libreswan_properties_la_LIBADD = \
$(GTK_LIBS) \
$(LIBNM_GLIB_LIBS) \
+ $(LIBNM_GTK_LIBS) \
$(top_builddir)/common/libnm-vpn-plugin-libreswan-common.la
libnm_vpn_plugin_libreswan_la_LDFLAGS = \
diff --git a/properties/nm-libreswan-dialog.ui b/properties/nm-libreswan-dialog.ui
index f6d01e6..a5e6c74 100644
--- a/properties/nm-libreswan-dialog.ui
+++ b/properties/nm-libreswan-dialog.ui
@@ -2,28 +2,6 @@
<!-- Generated with glade 3.19.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
- <object class="GtkListStore" id="model1">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes"> </col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model2">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes"> </col>
- </row>
- </data>
- </object>
<object class="GtkBox" id="libreswan-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -63,37 +41,27 @@
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
- <object class="GtkComboBox" id="group_pass_type_combo">
+ <object class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="model">model1</property>
- <child>
- <object class="GtkCellRendererText" id="renderer1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <property name="label" translatable="yes">_Gateway:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">gateway_entry</property>
+ <property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">3</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="user_pass_type_combo">
+ <object class="GtkEntry" id="gateway_entry">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">model2</property>
- <child>
- <object class="GtkCellRendererText" id="renderer2"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <property name="can_focus">True</property>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">2</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
@@ -108,7 +76,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
</packing>
</child>
<child>
@@ -119,59 +87,57 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Gro_up password:</property>
+ <property name="label" translatable="yes">_Secret:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">group_entry</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label23">
+ <object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">_Gateway:</property>
+ <property name="label" translatable="yes">_User password:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">gateway_entry</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label24">
+ <object class="GtkEntry" id="user_password_entry">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">G_roup name:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">group_entry</property>
- <property name="xalign">0</property>
+ <property name="can_focus">True</property>
+ <property name="visibility">False</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="gateway_entry">
+ <object class="GtkLabel" id="label24">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">G_roup name:</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
</packing>
</child>
<child>
@@ -181,46 +147,35 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">3</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label3">
+ <object class="GtkLabel" id="label26">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">_User password:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">group_entry</property>
+ <property name="label" translatable="yes">User name:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">1</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="user_password_entry">
+ <object class="GtkEntry" id="user_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="visibility">False</property>
+ <property name="invisible_char">●</property>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
@@ -247,7 +202,7 @@
<object class="GtkLabel" id="label25">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Optional&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Advanced&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
@@ -273,10 +228,10 @@
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
- <object class="GtkLabel" id="label26">
+ <object class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">User name:</property>
+ <property name="label" translatable="yes">Phase1 Algorithms:</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -285,21 +240,10 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="user_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label27">
+ <object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Phase1 Algorithms:</property>
+ <property name="label" translatable="yes">Phase2 Algorithms:</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -308,21 +252,10 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="phase1_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
+ <object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Phase2 Algorithms:</property>
+ <property name="label" translatable="yes">Domain:</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -331,26 +264,25 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="phase2_entry">
+ <object class="GtkEntry" id="phase1_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label2">
+ <object class="GtkEntry" id="phase2_entry">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Domain:</property>
- <property name="xalign">0</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
</packing>
</child>
<child>
@@ -361,7 +293,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">2</property>
</packing>
</child>
</object>
@@ -383,4 +315,26 @@
</packing>
</child>
</object>
+ <object class="GtkListStore" id="model1">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes"> </col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="model2">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes"> </col>
+ </row>
+ </data>
+ </object>
</interface>
diff --git a/properties/nm-libreswan.c b/properties/nm-libreswan.c
index d3b4cf8..7f4cf26 100644
--- a/properties/nm-libreswan.c
+++ b/properties/nm-libreswan.c
@@ -38,10 +38,12 @@
#ifdef NM_LIBRESWAN_OLD
#define NM_VPN_LIBNM_COMPAT
+
#include <nm-vpn-plugin-ui-interface.h>
#include <nm-setting-vpn.h>
#include <nm-setting-connection.h>
#include <nm-setting-ip4-config.h>
+#include <nm-ui-utils.h>
#define LIBRESWAN_EDITOR_PLUGIN_ERROR NM_SETTING_VPN_ERROR
#define LIBRESWAN_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY NM_SETTING_VPN_ERROR_INVALID_PROPERTY
@@ -49,6 +51,7 @@
#else /* !NM_LIBRESWAN_OLD */
#include <NetworkManager.h>
+#include <nma-ui-utils.h>
#define LIBRESWAN_EDITOR_PLUGIN_ERROR NM_CONNECTION_ERROR
#define LIBRESWAN_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY NM_CONNECTION_ERROR_INVALID_PROPERTY
@@ -136,13 +139,9 @@ setup_password_widget (LibreswanEditor *self,
gboolean new_connection)
{
LibreswanEditorPrivate *priv = LIBRESWAN_EDITOR_GET_PRIVATE (self);
- NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
GtkWidget *widget;
const char *value;
- if (new_connection)
- secret_flags = NM_SETTING_SECRET_FLAG_AGENT_OWNED;
-
widget = (GtkWidget *) gtk_builder_get_object (priv->builder, entry_name);
g_assert (widget);
gtk_size_group_add_widget (priv->group, widget);
@@ -150,10 +149,7 @@ setup_password_widget (LibreswanEditor *self,
if (s_vpn) {
value = nm_setting_vpn_get_secret (s_vpn, secret_name);
gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
- nm_setting_get_secret_flags (NM_SETTING (s_vpn), secret_name, &secret_flags, NULL);
}
- secret_flags &= ~(NM_SETTING_SECRET_FLAG_NOT_SAVED | NM_SETTING_SECRET_FLAG_NOT_REQUIRED);
- g_object_set_data (G_OBJECT (widget), "flags", GUINT_TO_POINTER (secret_flags));
g_signal_connect (widget, "changed", G_CALLBACK (stuff_changed_cb), self);
}
@@ -177,48 +173,13 @@ show_toggled_cb (GtkCheckButton *button, LibreswanEditor *self)
}
static void
-pw_type_changed_helper (LibreswanEditor *self, GtkWidget *combo)
-{
- LibreswanEditorPrivate *priv = LIBRESWAN_EDITOR_GET_PRIVATE (self);
- const char *entry = NULL;
- GtkWidget *widget;
-
- /* If the user chose "Not required", desensitize and clear the correct
- * password entry.
- */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_pass_type_combo"));
- if (combo == widget)
- entry = "user_password_entry";
- else {
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_pass_type_combo"));
- if (combo == widget)
- entry = "group_password_entry";
- }
- if (!entry)
- return;
-
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, entry));
- g_assert (widget);
-
- switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combo))) {
- case PW_TYPE_ASK:
- case PW_TYPE_UNUSED:
- gtk_entry_set_text (GTK_ENTRY (widget), "");
- gtk_widget_set_sensitive (widget, FALSE);
- break;
- default:
- gtk_widget_set_sensitive (widget, TRUE);
- break;
- }
-}
-
-static void
-pw_type_combo_changed_cb (GtkWidget *combo, gpointer user_data)
+password_storage_changed_cb (GObject *entry,
+ GParamSpec *pspec,
+ gpointer user_data)
{
LibreswanEditor *self = LIBRESWAN_EDITOR (user_data);
- pw_type_changed_helper (self, combo);
- stuff_changed_cb (combo, self);
+ stuff_changed_cb (NULL, self);
}
static const char *
@@ -237,72 +198,40 @@ secret_flags_to_pw_type (NMSettingVpn *s_vpn, const char *key)
}
static void
-init_one_pw_combo (LibreswanEditor *self,
- NMSettingVpn *s_vpn,
- const char *combo_name,
- const char *secret_key,
- const char *type_key,
- const char *entry_name)
+init_password_icon (LibreswanEditor *self,
+ NMSettingVpn *s_vpn,
+ const char *secret_key,
+ const char *type_key,
+ const char *entry_name)
{
LibreswanEditorPrivate *priv = LIBRESWAN_EDITOR_GET_PRIVATE (self);
- int active = -1;
- GtkWidget *widget;
- GtkListStore *store;
- GtkTreeIter iter;
- const char *value = NULL;
- guint32 default_idx = 1;
+ GtkWidget *entry;
+ const char *value;
+ const char *flags = NULL;
- /* If there's already a password and the password type can't be found in
- * the VPN settings, default to saving it. Otherwise, always ask for it.
- */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, entry_name));
- if (widget) {
- const char *tmp;
+ entry = GTK_WIDGET (gtk_builder_get_object (priv->builder, entry_name));
+ g_assert (entry);
- tmp = gtk_entry_get_text (GTK_ENTRY (widget));
- if (tmp && strlen (tmp))
- default_idx = 0;
- }
+ nma_utils_setup_password_storage (entry, 0, (NMSetting *) s_vpn, secret_key,
+ TRUE, FALSE);
- store = gtk_list_store_new (1, G_TYPE_STRING);
+ /* If there's no password and no flags in the setting,
+ * initialize flags as "always-ask".
+ */
if (s_vpn) {
- value = secret_flags_to_pw_type (s_vpn, secret_key);
- if (!value)
- value = nm_setting_vpn_get_data_item (s_vpn, type_key);
- }
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("Saved"), -1);
- if ((active < 0) && value) {
- if (!strcmp (value, NM_LIBRESWAN_PW_TYPE_SAVE))
- active = 0;
+ flags = secret_flags_to_pw_type (s_vpn, secret_key);
+ if (!flags || !strcmp (flags, NM_LIBRESWAN_PW_TYPE_SAVE))
+ flags = nm_setting_vpn_get_data_item (s_vpn, type_key);
}
+ value = gtk_entry_get_text (GTK_ENTRY (entry));
+ if ((!value || !*value) && !flags)
+ nma_utils_update_password_storage (entry, NM_SETTING_SECRET_FLAG_NOT_SAVED,
+ (NMSetting *) s_vpn, secret_key);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("Always Ask"), -1);
- if ((active < 0) && value) {
- if (!strcmp (value, NM_LIBRESWAN_PW_TYPE_ASK))
- active = 1;
- }
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("Not Required"), -1);
- if ((active < 0) && value) {
- if (!strcmp (value, NM_LIBRESWAN_PW_TYPE_UNUSED))
- active = 2;
- }
-
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, combo_name));
- g_assert (widget);
- gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
- g_object_unref (store);
- gtk_combo_box_set_active (GTK_COMBO_BOX (widget), active < 0 ? default_idx : active);
- pw_type_changed_helper (self, widget);
-
- g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (pw_type_combo_changed_cb), self);
+ g_signal_connect (entry, "notify::secondary-icon-name",
+ G_CALLBACK (password_storage_changed_cb), self);
}
-
static gboolean
init_editor_plugin (LibreswanEditor *self,
NMConnection *connection,
@@ -352,18 +281,16 @@ init_editor_plugin (LibreswanEditor *self,
NM_LIBRESWAN_PSK_VALUE,
new_connection);
- init_one_pw_combo (self,
- s_vpn,
- "user_pass_type_combo",
- NM_LIBRESWAN_XAUTH_PASSWORD,
- NM_LIBRESWAN_XAUTH_PASSWORD_INPUT_MODES,
- "user_password_entry");
- init_one_pw_combo (self,
- s_vpn,
- "group_pass_type_combo",
- NM_LIBRESWAN_PSK_VALUE,
- NM_LIBRESWAN_PSK_INPUT_MODES,
- "group_password_entry");
+ init_password_icon (self,
+ s_vpn,
+ NM_LIBRESWAN_XAUTH_PASSWORD,
+ NM_LIBRESWAN_XAUTH_PASSWORD_INPUT_MODES,
+ "user_password_entry");
+ init_password_icon (self,
+ s_vpn,
+ NM_LIBRESWAN_PSK_VALUE,
+ NM_LIBRESWAN_PSK_INPUT_MODES,
+ "group_password_entry");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_entry"));
g_return_val_if_fail (widget != NULL, FALSE);
@@ -434,33 +361,32 @@ static void
save_one_password (NMSettingVpn *s_vpn,
GtkBuilder *builder,
const char *entry_name,
- const char *combo_name,
const char *secret_key,
const char *type_key)
{
- NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
+ NMSettingSecretFlags flags;
const char *data_val = NULL, *password;
- GtkWidget *entry, *combo;
+ GtkWidget *entry;
+ /* Get secret flags */
entry = GTK_WIDGET (gtk_builder_get_object (builder, entry_name));
- flags = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (entry), "flags"));
+ flags = nma_utils_menu_to_secret_flags (entry);
- combo = GTK_WIDGET (gtk_builder_get_object (builder, combo_name));
- switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combo))) {
- case PW_TYPE_SAVE:
+ /* Save password and convert flags to legacy data items */
+ switch (flags) {
+ case NM_SETTING_SECRET_FLAG_NONE:
+ case NM_SETTING_SECRET_FLAG_AGENT_OWNED:
password = gtk_entry_get_text (GTK_ENTRY (entry));
if (password && strlen (password))
nm_setting_vpn_add_secret (s_vpn, secret_key, password);
data_val = NM_LIBRESWAN_PW_TYPE_SAVE;
break;
- case PW_TYPE_UNUSED:
+ case NM_SETTING_SECRET_FLAG_NOT_REQUIRED:
data_val = NM_LIBRESWAN_PW_TYPE_UNUSED;
- flags |= NM_SETTING_SECRET_FLAG_NOT_REQUIRED;
break;
- case PW_TYPE_ASK:
+ case NM_SETTING_SECRET_FLAG_NOT_SAVED:
default:
data_val = NM_LIBRESWAN_PW_TYPE_ASK;
- flags |= NM_SETTING_SECRET_FLAG_NOT_SAVED;
break;
}
@@ -525,13 +451,11 @@ update_connection (NMVpnEditor *iface,
save_one_password (s_vpn,
priv->builder,
"user_password_entry",
- "user_pass_type_combo",
NM_LIBRESWAN_XAUTH_PASSWORD,
NM_LIBRESWAN_XAUTH_PASSWORD_INPUT_MODES);
save_one_password (s_vpn,
priv->builder,
"group_password_entry",
- "group_pass_type_combo",
NM_LIBRESWAN_PSK_VALUE,
NM_LIBRESWAN_PSK_INPUT_MODES);
@@ -612,6 +536,17 @@ dispose (GObject *object)
LibreswanEditor *plugin = LIBRESWAN_EDITOR (object);
LibreswanEditorPrivate *priv = LIBRESWAN_EDITOR_GET_PRIVATE (plugin);
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_password_entry"));
+ g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
+ (GCallback) password_storage_changed_cb,
+ plugin);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_password_entry"));
+ g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
+ (GCallback) password_storage_changed_cb,
+ plugin);
+
if (priv->group)
g_object_unref (priv->group);
--
2.5.0

View File

@ -1,499 +0,0 @@
From 8d2f39ac3d5bfc20b9d7a78db05bfed9e5a29764 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 22 Jan 2016 18:10:50 +0100
Subject: [PATCH 10/17] properties: some more UI polish
---
properties/nm-libreswan-dialog.ui | 444 +++++++++++++++++++-------------------
1 file changed, 219 insertions(+), 225 deletions(-)
diff --git a/properties/nm-libreswan-dialog.ui b/properties/nm-libreswan-dialog.ui
index a5e6c74..0c77418 100644
--- a/properties/nm-libreswan-dialog.ui
+++ b/properties/nm-libreswan-dialog.ui
@@ -29,158 +29,159 @@
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment8">
+ <object class="GtkGrid" id="table2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="left_padding">12</property>
+ <property name="margin_left">12</property>
+ <property name="margin_right">12</property>
+ <property name="orientation">vertical</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">16</property>
<child>
- <object class="GtkGrid" id="table2">
+ <object class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkLabel" id="label23">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Gateway:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">gateway_entry</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="gateway_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="show_passwords_checkbutton">
- <property name="label" translatable="yes">Show passwords</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="group_password_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Secret:</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_User password:</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="user_password_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label24">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">G_roup name:</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="group_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label26">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">User name:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="user_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
+ <property name="label" translatable="yes">_Gateway:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">gateway_entry</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_passwords_checkbutton">
+ <property name="label" translatable="yes">Show passwords</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="group_password_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="visibility">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Secret:</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_User password:</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="user_password_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="visibility">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label24">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">G_roup name:</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="group_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label26">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">User name:</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="user_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="gateway_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="valign">end</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
</child>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
@@ -188,7 +189,7 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
@@ -213,96 +214,89 @@
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment9">
+ <object class="GtkGrid" id="table3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="left_padding">12</property>
+ <property name="margin_left">12</property>
+ <property name="margin_right">12</property>
+ <property name="orientation">vertical</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">16</property>
<child>
- <object class="GtkEventBox" id="eventbox1">
+ <object class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <child>
- <object class="GtkGrid" id="table3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkLabel" id="label27">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Phase1 Algorithms:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Phase2 Algorithms:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Domain:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="phase1_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="phase2_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="domain_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- </object>
- </child>
+ <property name="label" translatable="yes">Phase1 Algorithms:</property>
+ <property name="xalign">0</property>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Phase2 Algorithms:</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Domain:</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="phase1_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="phase2_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="domain_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
</child>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
--
2.5.0

View File

@ -1,99 +0,0 @@
From e3a56da48f49327b7ee381d9a33c3898df1f083c Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 25 Jan 2016 17:59:36 +0100
Subject: [PATCH 11/17] properties: hide the advanced options
---
properties/nm-libreswan-dialog.ui | 60 ++++++++++++++++-----------------------
1 file changed, 25 insertions(+), 35 deletions(-)
diff --git a/properties/nm-libreswan-dialog.ui b/properties/nm-libreswan-dialog.ui
index 0c77418..0c526a6 100644
--- a/properties/nm-libreswan-dialog.ui
+++ b/properties/nm-libreswan-dialog.ui
@@ -194,25 +194,11 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="vbox11">
+ <object class="GtkExpander" id="expander1">
+ <property name="width_request">350</property>
+ <property name="height_request">150</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label25">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Advanced&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="table3">
<property name="visible">True</property>
@@ -223,18 +209,6 @@
<property name="row_spacing">6</property>
<property name="column_spacing">16</property>
<child>
- <object class="GtkLabel" id="label27">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Phase1 Algorithms:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -294,12 +268,28 @@
<property name="top_attach">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="label27">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Phase1 Algorithms:</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Ad_vanced</property>
+ <property name="use_underline">True</property>
+ <property name="ellipsize">end</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
<packing>
--
2.5.0

View File

@ -1,25 +0,0 @@
From 47a6f9d4a85fc2a9e9c063a47d45e2276609c0bc Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 25 Jan 2016 18:12:49 +0100
Subject: [PATCH 12/17] properties: we're not doing IKEv2
---
properties/nm-libreswan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/properties/nm-libreswan.c b/properties/nm-libreswan.c
index 7f4cf26..c3dc988 100644
--- a/properties/nm-libreswan.c
+++ b/properties/nm-libreswan.c
@@ -62,7 +62,7 @@
#include "utils.h"
#define LIBRESWAN_PLUGIN_NAME _("IPsec based VPN")
-#define LIBRESWAN_PLUGIN_DESC _("IPsec, IKEv1, IKEv2 based VPN")
+#define LIBRESWAN_PLUGIN_DESC _("IPsec based VPN using IKEv1")
#define ENC_TYPE_SECURE 0
#define ENC_TYPE_WEAK 1
--
2.5.0

View File

@ -1,25 +0,0 @@
From eae2391104513e53f57b16609126cf59d3ae59c4 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Tue, 26 Jan 2016 13:58:27 +0100
Subject: [PATCH 13/17] service: drop off the bus if the peer vanishes or we're
unneeded
---
src/nm-libreswan-service.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index e2a217f..4e3773e 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -1826,6 +1826,7 @@ main (int argc, char *argv[])
plugin = g_initable_new (NM_TYPE_LIBRESWAN_PLUGIN, NULL, &error,
NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME, bus_name,
+ NM_VPN_SERVICE_PLUGIN_DBUS_WATCH_PEER, !debug,
NULL);
if (!plugin) {
g_warning ("Failed to initialize a plugin instance: %s", error->message);
--
2.5.0

View File

@ -1,117 +0,0 @@
From 2163138a8275c1f859edd642e6790282df273eea Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Sun, 31 Jan 2016 23:26:38 +0100
Subject: [PATCH 16/17] service: handle the eclipse route properly
---
src/nm-libreswan-service.c | 79 +++++++++++++++++++++++++++-------------------
1 file changed, 46 insertions(+), 33 deletions(-)
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index 4e3773e..0e1a76a 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -1018,37 +1018,6 @@ lookup_string (GVariant *dict, const gchar *key)
return value;
}
-static GVariant *
-route_to_gvariant (GVariant *env)
-{
- GVariantBuilder builder;
-
- if (!lookup_string (env, "PLUTO_PEER_CLIENT"))
- return NULL;
-
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("au"));
-
-#define _try_add(builder, variant) \
- G_STMT_START { \
- GVariant *_v = (variant); \
- \
- if (!_v) \
- goto fail; \
- g_variant_builder_add_value ((builder), _v); \
- } G_STMT_END
- _try_add (&builder, addr4_to_gvariant (lookup_string (env, "PLUTO_PEER_CLIENT_NET")));
- _try_add (&builder, netmask4_to_gvariant (lookup_string (env, "PLUTO_PEER_CLIENT_MASK")));
- _try_add (&builder, addr4_to_gvariant (lookup_string (env, "PLUTO_NEXT_HOP")));
- _try_add (&builder, g_variant_new_uint32 (0));
- _try_add (&builder, addr4_to_gvariant (lookup_string (env, "PLUTO_MY_SOURCEIP")));
-#undef _try_add
-
- return g_variant_builder_end (&builder);
-fail:
- g_variant_builder_clear (&builder);
- return NULL;
-}
-
static void
_take_route (GPtrArray *routes, GVariant *new, gboolean alive)
{
@@ -1085,6 +1054,50 @@ _take_route (GPtrArray *routes, GVariant *new, gboolean alive)
g_variant_unref (new);
}
+static void
+handle_route (GPtrArray *routes, GVariant *env, gboolean alive)
+{
+ GVariantBuilder builder;
+ const gchar *net, *mask, *next_hop, *my_sourceip;
+
+ if (!lookup_string (env, "PLUTO_PEER_CLIENT"))
+ return;
+
+ net = lookup_string (env, "PLUTO_PEER_CLIENT_NET");
+ mask = lookup_string (env, "PLUTO_PEER_CLIENT_MASK");
+ next_hop = lookup_string (env, "PLUTO_NEXT_HOP");
+ my_sourceip = lookup_string (env, "PLUTO_MY_SOURCEIP");
+
+ if (!net || !mask || !next_hop || !my_sourceip)
+ return;
+
+ if (g_strcmp0 (net, "0.0.0.0") == 0 && g_strcmp0 (mask, "0")) {
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("au"));
+ g_variant_builder_add_value (&builder, addr4_to_gvariant ("0.0.0.0"));
+ g_variant_builder_add_value (&builder, netmask4_to_gvariant ("128.0.0.0"));
+ g_variant_builder_add_value (&builder, addr4_to_gvariant (next_hop));
+ g_variant_builder_add_value (&builder, g_variant_new_uint32 (0));
+ g_variant_builder_add_value (&builder, addr4_to_gvariant (my_sourceip));
+ _take_route (routes, g_variant_builder_end (&builder), alive);
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("au"));
+ g_variant_builder_add_value (&builder, addr4_to_gvariant ("128.0.0.0"));
+ g_variant_builder_add_value (&builder, netmask4_to_gvariant ("128.0.0.0"));
+ g_variant_builder_add_value (&builder, addr4_to_gvariant (next_hop));
+ g_variant_builder_add_value (&builder, g_variant_new_uint32 (0));
+ g_variant_builder_add_value (&builder, addr4_to_gvariant (my_sourceip));
+ _take_route (routes, g_variant_builder_end (&builder), alive);
+ } else {
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("au"));
+ g_variant_builder_add_value (&builder, addr4_to_gvariant (net));
+ g_variant_builder_add_value (&builder, netmask4_to_gvariant (mask));
+ g_variant_builder_add_value (&builder, addr4_to_gvariant (next_hop));
+ g_variant_builder_add_value (&builder, g_variant_new_uint32 (0));
+ g_variant_builder_add_value (&builder, addr4_to_gvariant (my_sourceip));
+ _take_route (routes, g_variant_builder_end (&builder), alive);
+ }
+}
+
static gboolean
handle_callback (NMDBusLibreswanHelper *object,
GDBusMethodInvocation *invocation,
@@ -1178,9 +1191,9 @@ handle_callback (NMDBusLibreswanHelper *object,
/* This route */
if (g_strcmp0 (verb, "route-client") == 0 || g_strcmp0 (verb, "route-host"))
- _take_route (priv->routes, route_to_gvariant (env), TRUE);
+ handle_route (priv->routes, env, TRUE);
else if (g_strcmp0 (verb, "unroute-client") == 0 || g_strcmp0 (verb, "unroute-host"))
- _take_route (priv->routes, route_to_gvariant (env), FALSE);
+ handle_route (priv->routes, env, FALSE);
/* Routes */
g_variant_builder_init (&builder, G_VARIANT_TYPE ("aau"));
--
2.5.0

View File

@ -1,219 +0,0 @@
From 90893187ea6cf3279ece0bfed6a989cb72288658 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 1 Feb 2016 10:01:49 +0100
Subject: [PATCH 17/17] service: don't quit while we're not done yet
NetworkManager may have asked us to quit, but we still need to ask
Libreswan to unconfigure the connection.
---
src/nm-libreswan-service.c | 63 ++++++++++++++++++++++++++++++++++------------
1 file changed, 47 insertions(+), 16 deletions(-)
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index 0e1a76a..eec6414 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -109,6 +109,7 @@ typedef struct {
guint watch_id;
guint retry_id;
guint retries;
+ guint quit_blockers;
ConnectStep connect_step;
NMConnection *connection;
NMDBusLibreswanHelper *dbus_skeleton;
@@ -282,6 +283,25 @@ nm_libreswan_secrets_validate (NMSettingVpn *s_vpn, GError **error)
/****************************************************************/
+static void
+block_quit (NMLibreswanPlugin *self)
+{
+ NMLibreswanPluginPrivate *priv = NM_LIBRESWAN_PLUGIN_GET_PRIVATE (self);
+ priv->quit_blockers++;
+ DEBUG ("Block quit: %d blockers", priv->quit_blockers);
+}
+
+static void
+unblock_quit (NMLibreswanPlugin *self)
+{
+ NMLibreswanPluginPrivate *priv = NM_LIBRESWAN_PLUGIN_GET_PRIVATE (self);
+ if (--priv->quit_blockers == 0)
+ g_main_loop_quit (loop);
+ DEBUG ("Unblock quit: %d blockers", priv->quit_blockers);
+}
+
+/****************************************************************/
+
static gboolean connect_step (NMLibreswanPlugin *self, GError **error);
static gboolean pr_cb (GIOChannel *source, GIOCondition condition, gpointer user_data);
@@ -465,6 +485,7 @@ check_running_cb (GPid pid, gint status, gpointer user_data)
ret = WEXITSTATUS (status);
DEBUG ("Spawn: child %d exited with status %d", pid, ret);
+ unblock_quit (self);
/* Reap child */
waitpid (pid, NULL, WNOHANG);
@@ -515,6 +536,7 @@ child_watch_cb (GPid pid, gint status, gpointer user_data)
priv->pid = 0;
DEBUG ("Spawn: child %d exited", pid);
+ unblock_quit (self);
if (WIFEXITED (status)) {
ret = WEXITSTATUS (status);
@@ -554,7 +576,8 @@ child_watch_cb (GPid pid, gint status, gpointer user_data)
g_clear_error (&error);
}
-static gboolean do_spawn (GPid *out_pid,
+static gboolean do_spawn (NMLibreswanPlugin *self,
+ GPid *out_pid,
int *out_stdin,
int *out_stderr,
GError **error,
@@ -562,7 +585,8 @@ static gboolean do_spawn (GPid *out_pid,
...) G_GNUC_NULL_TERMINATED;
static gboolean
-do_spawn (GPid *out_pid,
+do_spawn (NMLibreswanPlugin *self,
+ GPid *out_pid,
int *out_stdin,
int *out_stderr,
GError **error,
@@ -614,6 +638,8 @@ do_spawn (GPid *out_pid,
*out_pid = pid;
g_ptr_array_free (argv, TRUE);
+ if (success)
+ block_quit (self);
return success;
}
@@ -661,7 +687,8 @@ nm_libreswan_config_psk_write (NMSettingVpn *s_vpn,
/****************************************************************/
-static gboolean spawn_pty (int *out_stdout,
+static gboolean spawn_pty (NMLibreswanPlugin *self,
+ int *out_stdout,
int *out_stderr,
int *out_ptyin,
GPid *out_pid,
@@ -670,7 +697,8 @@ static gboolean spawn_pty (int *out_stdout,
...) G_GNUC_NULL_TERMINATED;
static gboolean
-spawn_pty (int *out_stdout,
+spawn_pty (NMLibreswanPlugin *self,
+ int *out_stdout,
int *out_stderr,
int *out_ptyin,
GPid *out_pid,
@@ -774,6 +802,7 @@ spawn_pty (int *out_stdout,
if (out_pid)
*out_pid = child_pid;
+ block_quit (self);
return TRUE;
}
@@ -1408,7 +1437,7 @@ connect_step (NMLibreswanPlugin *self, GError **error)
priv->connect_step++;
case CONNECT_STEP_CHECK_RUNNING:
- if (!do_spawn (&priv->pid, NULL, NULL, error, priv->ipsec_path, "auto", "--status", NULL))
+ if (!do_spawn (self, &priv->pid, NULL, NULL, error, priv->ipsec_path, "auto", "--status", NULL))
return FALSE;
priv->watch_id = g_child_watch_add (priv->pid, check_running_cb, self);
return TRUE;
@@ -1422,7 +1451,7 @@ connect_step (NMLibreswanPlugin *self, GError **error)
return FALSE;
/* Ensure the right IPsec kernel stack is loaded */
- success = do_spawn (&priv->pid, NULL, NULL, error, stackman_path, "start", NULL);
+ success = do_spawn (self, &priv->pid, NULL, NULL, error, stackman_path, "start", NULL);
if (success)
priv->watch_id = g_child_watch_add (priv->pid, child_watch_cb, self);
return success;
@@ -1433,9 +1462,9 @@ connect_step (NMLibreswanPlugin *self, GError **error)
case CONNECT_STEP_IPSEC_START:
/* Start the IPsec service */
if (priv->openswan)
- success = do_spawn (&priv->pid, NULL, NULL, error, priv->ipsec_path, "setup", "start", NULL);
+ success = do_spawn (self, &priv->pid, NULL, NULL, error, priv->ipsec_path, "setup", "start", NULL);
else {
- success = do_spawn (&priv->pid, NULL, NULL, error,
+ success = do_spawn (self, &priv->pid, NULL, NULL, error,
priv->pluto_path, "--config", SYSCONFDIR "/ipsec.conf",
NULL);
}
@@ -1448,14 +1477,14 @@ connect_step (NMLibreswanPlugin *self, GError **error)
case CONNECT_STEP_WAIT_READY:
if (!priv->retries)
priv->retries = 30;
- if (!do_spawn (&priv->pid, NULL, NULL, error, priv->ipsec_path, "auto", "--ready", NULL))
+ if (!do_spawn (self, &priv->pid, NULL, NULL, error, priv->ipsec_path, "auto", "--ready", NULL))
return FALSE;
priv->watch_id = g_child_watch_add (priv->pid, child_watch_cb, self);
return TRUE;
case CONNECT_STEP_CONFIG_ADD:
g_assert (uuid);
- if (!do_spawn (&priv->pid, &fd, NULL, error, priv->ipsec_path,
+ if (!do_spawn (self, &priv->pid, &fd, NULL, error, priv->ipsec_path,
"auto", "--replace", "--config", "-", uuid, NULL))
return FALSE;
priv->watch_id = g_child_watch_add (priv->pid, child_watch_cb, self);
@@ -1467,7 +1496,7 @@ connect_step (NMLibreswanPlugin *self, GError **error)
case CONNECT_STEP_CONNECT:
g_assert (uuid);
- if (!spawn_pty (&up_stdout, &up_stderr, &up_pty, &priv->pid, error,
+ if (!spawn_pty (self, &up_stdout, &up_stderr, &up_pty, &priv->pid, error,
priv->ipsec_path, "auto", "--up", uuid, NULL))
return FALSE;
priv->watch_id = g_child_watch_add (priv->pid, child_watch_cb, self);
@@ -1689,13 +1718,13 @@ real_disconnect (NMVpnServicePlugin *plugin, GError **error)
if (!priv->managed) {
const char *uuid = nm_connection_get_uuid (priv->connection);
- ret = do_spawn (&priv->pid, NULL, NULL, error,
+ ret = do_spawn (plugin, &priv->pid, NULL, NULL, error,
priv->ipsec_path, "auto", "--delete", uuid, NULL);
} else if (priv->openswan) {
- ret = do_spawn (&priv->pid, NULL, NULL, error,
+ ret = do_spawn (plugin, &priv->pid, NULL, NULL, error,
priv->ipsec_path, "setup", "stop", NULL);
} else {
- ret = do_spawn (&priv->pid, NULL, NULL, error,
+ ret = do_spawn (plugin, &priv->pid, NULL, NULL, error,
priv->whack_path, "--shutdown", NULL);
}
@@ -1786,7 +1815,8 @@ setup_signals (void)
static void
quit_mainloop (NMLibreswanPlugin *plugin, gpointer user_data)
{
- g_main_loop_quit ((GMainLoop *) user_data);
+ g_signal_handlers_disconnect_by_func (plugin, quit_mainloop, user_data);
+ unblock_quit (plugin);
}
int
@@ -1868,8 +1898,9 @@ main (int argc, char *argv[])
loop = g_main_loop_new (NULL, FALSE);
+ block_quit (plugin);
if (!persist)
- g_signal_connect (plugin, "quit", G_CALLBACK (quit_mainloop), loop);
+ g_signal_connect (plugin, "quit", G_CALLBACK (quit_mainloop), NULL);
setup_signals ();
g_main_loop_run (loop);
--
2.5.0

View File

@ -1,4 +1,4 @@
%global snapshot .beta1
%global snapshot .beta2
%global nm_version 1:1.1.0
%global nma_version 1.1.0
@ -9,22 +9,7 @@ Release: 0.4%{?snapshot}%{?dist}
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
Group: System Environment/Base
Source0: https://download.gnome.org/sources/NetworkManager-libreswan/1.1/%{name}-1.1.90.tar.xz
Patch1: 0002-trivial-rename-a-badly-named-subroutine.patch
Patch2: 0003-import-export-add-a-terminating-newline.patch
Patch3: 0004-service-disable-agresive-mode-when-there-s-no-group-.patch
Patch4: 0005-service-always-set-modecfgpull-yes.patch
Patch5: 0006-service-avoid-setting-the-default-route-to-the-tunne.patch
Patch6: 0007-properties-don-t-use-depreacted-GtkBox-subclasses.patch
Patch7: 0008-properties-don-t-use-depreacted-GtkGrid.patch
Patch8: 0009-properties-use-the-new-nma-based-password-widgets.patch
Patch9: 0010-properties-some-more-UI-polish.patch
Patch10: 0011-properties-hide-the-advanced-options.patch
Patch11: 0012-properties-we-re-not-doing-IKEv2.patch
Patch12: 0013-service-drop-off-the-bus-if-the-peer-vanishes-or-we-.patch
Patch13: 0016-service-handle-the-eclipse-route-properly.patch
Patch14: 0017-service-don-t-quit-while-we-re-not-done-yet.patch
Source0: https://download.gnome.org/sources/NetworkManager-libreswan/1.1/%{name}-1.1.91.tar.xz
BuildRequires: gtk3-devel
BuildRequires: libnl3-devel
@ -68,21 +53,7 @@ This package contains software for integrating VPN capabilities with
the libreswan server with NetworkManager (GNOME files).
%prep
%setup -q -n %{name}-1.1.90
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%setup -q -n %{name}-1.1.91
%build
autoreconf -fi
@ -122,6 +93,9 @@ update-desktop-database &> /dev/null || :
%changelog
* Tue Mar 1 2016 Lubomir Rintel <lkundrak@v3.sk> - 1.2.0-0.4.beta2
- Update to NetworkManager-libreswan 1.2-beta2
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-0.4.beta1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

View File

@ -1 +1 @@
a721177a08d31a7d6aa2eaa21fcdc31e NetworkManager-libreswan-1.1.90.tar.xz
18f4f7e1b7cef29f45580fe1279dea24 NetworkManager-libreswan-1.1.91.tar.xz