From 61e2c7b502f1c588225feaede61710681d8aef65 Mon Sep 17 00:00:00 2001 From: avesh agarwal Date: Mon, 26 Jul 2010 14:39:42 +0000 Subject: [PATCH] Resolves: #616910 - Support for reading phase1 and phase2 algorithms through GUI --- NetworkManager-openswan.spec | 8 +- nm-616910.patch | 306 +++++++++++++++++++++++++++++++++++ 2 files changed, 313 insertions(+), 1 deletion(-) create mode 100644 nm-616910.patch diff --git a/NetworkManager-openswan.spec b/NetworkManager-openswan.spec index a53dafb..c563011 100644 --- a/NetworkManager-openswan.spec +++ b/NetworkManager-openswan.spec @@ -6,7 +6,7 @@ Summary: NetworkManager VPN plug-in for openswan Name: NetworkManager-openswan Version: 0.8.0 -Release: 4%{snapshot}%{?dist} +Release: 5%{snapshot}%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://people.redhat.com/avagarwa/files/NetworkManager-openswan/ @@ -19,6 +19,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Patch1: nm-secret-whack.patch +Patch2: nm-616910.patch BuildRequires: gtk2-devel #BuildRequires: dbus-devel @@ -42,6 +43,7 @@ with NetworkManager and the GNOME desktop %setup -q -n NetworkManager-openswan-%{realversion} %patch1 -p1 +%patch2 -p1 %build %configure --disable-static --enable-more-warnings=yes @@ -76,6 +78,10 @@ rm -rf $RPM_BUILD_ROOT %dir %{_datadir}/gnome-vpn-properties/openswan %changelog +* Mon Jul 26 2010 Avesh Agarwal - 0.8.0-5.20100411git +Resolves: #616910 +- Support for reading phase1 and phase2 algorithms through GUI + * Tue Jul 13 2010 Avesh Agarwal - 0.8.0-4.20100411git - Modified fix for the bz 607352 - Fix to read connection configuration from stdin diff --git a/nm-616910.patch b/nm-616910.patch new file mode 100644 index 0000000..25dc0dc --- /dev/null +++ b/nm-616910.patch @@ -0,0 +1,306 @@ +diff -urNp NetworkManager-openswan-0.8-cvs-patched/properties/nm-openswan.c NetworkManager-openswan-0.8/properties/nm-openswan.c +--- NetworkManager-openswan-0.8-cvs-patched/properties/nm-openswan.c 2010-07-21 15:41:07.674107915 -0400 ++++ NetworkManager-openswan-0.8/properties/nm-openswan.c 2010-07-21 16:55:34.597114628 -0400 +@@ -416,6 +416,28 @@ init_plugin_ui (OpenswanPluginUiWidget * + } + g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); + ++ /* Phase 1 Algorithms: IKE*/ ++ widget = glade_xml_get_widget (priv->xml, "phase1_entry"); ++ g_return_val_if_fail (widget != NULL, FALSE); ++ gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget)); ++ if (s_vpn) { ++ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENSWAN_IKE); ++ if (value && strlen (value)) ++ gtk_entry_set_text (GTK_ENTRY (widget), value); ++ } ++ g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); ++ ++ /* Phase 2 Algorithms: ESP*/ ++ widget = glade_xml_get_widget (priv->xml, "phase2_entry"); ++ g_return_val_if_fail (widget != NULL, FALSE); ++ gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget)); ++ if (s_vpn) { ++ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENSWAN_ESP); ++ if (value && strlen (value)) ++ gtk_entry_set_text (GTK_ENTRY (widget), value); ++ } ++ g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self); ++ + widget = glade_xml_get_widget (priv->xml, "domain_entry"); + g_return_val_if_fail (widget != NULL, FALSE); + gtk_size_group_add_widget (priv->group, GTK_WIDGET (widget)); +@@ -520,11 +542,25 @@ update_connection (NMVpnPluginUiWidgetIn + if (str && strlen (str)) + nm_setting_vpn_add_data_item (s_vpn, NM_OPENSWAN_LEFTID, str); + ++ /* User name*/ + widget = glade_xml_get_widget (priv->xml, "user_entry"); + str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); + if (str && strlen (str)) + nm_setting_vpn_add_data_item (s_vpn, NM_OPENSWAN_LEFTXAUTHUSER, str); ++ ++ /* Phase 1 Algorithms: ike */ ++ widget = glade_xml_get_widget (priv->xml, "phase1_entry"); ++ str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); ++ if (str && strlen (str)) ++ nm_setting_vpn_add_data_item (s_vpn, NM_OPENSWAN_IKE, str); ++ ++ /* Phase 2 Algorithms: esp */ ++ widget = glade_xml_get_widget (priv->xml, "phase2_entry"); ++ str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); ++ if (str && strlen (str)) ++ nm_setting_vpn_add_data_item (s_vpn, NM_OPENSWAN_ESP, str); + ++ /* Domain entry */ + widget = glade_xml_get_widget (priv->xml, "domain_entry"); + str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); + if (str && strlen (str)) +diff -urNp NetworkManager-openswan-0.8-cvs-patched/properties/nm-openswan-dialog.glade NetworkManager-openswan-0.8/properties/nm-openswan-dialog.glade +--- NetworkManager-openswan-0.8-cvs-patched/properties/nm-openswan-dialog.glade 2010-07-21 15:41:07.659354607 -0400 ++++ NetworkManager-openswan-0.8/properties/nm-openswan-dialog.glade 2010-07-21 16:22:37.191355919 -0400 +@@ -233,77 +233,120 @@ + True + 12 + +- ++ + True +- 5 +- 2 +- 6 +- 6 + +- ++ + True +- 0 +- User name: ++ 4 ++ 2 ++ 6 ++ 6 ++ ++ ++ True ++ 0 ++ User name: ++ ++ ++ GTK_FILL ++ ++ ++ ++ ++ ++ True ++ True ++ ++ ++ ++ 1 ++ 2 ++ ++ ++ ++ ++ ++ True ++ 0 ++ Phase1 Algorithms: ++ ++ ++ 1 ++ 2 ++ GTK_FILL ++ ++ ++ ++ ++ ++ True ++ True ++ ++ ++ ++ 1 ++ 2 ++ 1 ++ 2 ++ ++ ++ ++ ++ ++ True ++ 0 ++ Phase2 Algorithms: ++ ++ ++ 2 ++ 3 ++ GTK_FILL ++ ++ ++ ++ ++ ++ True ++ True ++ ++ ++ ++ 1 ++ 2 ++ 2 ++ 3 ++ ++ ++ ++ ++ ++ True ++ 0 ++ Domain: ++ ++ ++ 3 ++ 4 ++ GTK_FILL ++ ++ ++ ++ ++ ++ True ++ True ++ ++ ++ ++ 1 ++ 2 ++ 3 ++ 4 ++ ++ ++ + +- +- GTK_FILL +- +- +- +- +- +- True +- True +- +- +- 1 +- 2 +- +- +- +- +- +- True +- 0 +- Domain: +- +- +- 1 +- 2 +- GTK_FILL +- +- +- +- +- +- True +- True +- +- +- 1 +- 2 +- 1 +- 2 +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- + + + +diff -urNp NetworkManager-openswan-0.8-cvs-patched/src/nm-openswan-service.c NetworkManager-openswan-0.8/src/nm-openswan-service.c +--- NetworkManager-openswan-0.8-cvs-patched/src/nm-openswan-service.c 2010-07-21 15:41:07.774135961 -0400 ++++ NetworkManager-openswan-0.8/src/nm-openswan-service.c 2010-07-21 17:22:01.650106623 -0400 +@@ -69,6 +69,8 @@ static ValidProperty valid_properties[] + { NM_OPENSWAN_DHGROUP, G_TYPE_STRING, 0, 0 }, + { NM_OPENSWAN_PFSGROUP, G_TYPE_STRING, 0, 0 }, + { NM_OPENSWAN_DPDTIMEOUT, G_TYPE_INT, 0, 86400 }, ++ { NM_OPENSWAN_IKE, G_TYPE_STRING, 0, 0 }, ++ { NM_OPENSWAN_ESP, G_TYPE_STRING, 0, 0 }, + /* Ignored option for internal use */ + { NM_OPENSWAN_PSK_INPUT_MODES, G_TYPE_NONE, 0, 0 }, + { NM_OPENSWAN_XAUTH_PASSWORD_INPUT_MODES, G_TYPE_NONE, 0, 0 }, +@@ -505,6 +507,8 @@ nm_openswan_config_write (gint openswan_ + const char *props_username; + //const char *props_natt_mode; + const char *default_username; ++ const char *phase1_alg_str; ++ const char *phase2_alg_str; + //const char *pw_type; + gint fdtmp1=-1; + //gint conf_fd=-1; +@@ -535,8 +539,23 @@ nm_openswan_config_write (gint openswan_ + write_config_option (fdtmp1, " remote_peer_type=cisco\n"); + write_config_option (fdtmp1, " rightxauthserver=yes\n"); + write_config_option (fdtmp1, " rightmodecfgserver=yes\n"); ++ ++ phase1_alg_str = nm_setting_vpn_get_data_item (s_vpn, NM_OPENSWAN_IKE); ++ if(!phase1_alg_str || !strlen (phase1_alg_str)) { + write_config_option (fdtmp1, " ike=aes-sha1\n"); ++ } ++ else { ++ write_config_option (fdtmp1, " ike=%s\n", phase1_alg_str); ++ } ++ ++ phase2_alg_str = nm_setting_vpn_get_data_item (s_vpn, NM_OPENSWAN_ESP); ++ if(!phase2_alg_str || !strlen (phase2_alg_str)) { + write_config_option (fdtmp1, " esp=aes-sha1;modp1024\n"); ++ } ++ else { ++ write_config_option (fdtmp1, " esp=%s\n", phase2_alg_str); ++ } ++ + write_config_option (fdtmp1, " nm_configured=yes\n"); + //write_config_option (fdtmp1, " leftupdown=%s\n", NM_OSW_UPDOWN_PATH); + write_config_option (fdtmp1, " auto=add\n"); +diff -urNp NetworkManager-openswan-0.8-cvs-patched/src/nm-openswan-service.h NetworkManager-openswan-0.8/src/nm-openswan-service.h +--- NetworkManager-openswan-0.8-cvs-patched/src/nm-openswan-service.h 2010-07-21 15:41:07.775128199 -0400 ++++ NetworkManager-openswan-0.8/src/nm-openswan-service.h 2010-07-21 17:19:29.930120077 -0400 +@@ -47,6 +47,8 @@ + #define NM_OPENSWAN_DHGROUP "dhgroup" + #define NM_OPENSWAN_PFSGROUP "pfsgroup" + #define NM_OPENSWAN_DPDTIMEOUT "dpdtimeout" ++#define NM_OPENSWAN_IKE "ike" ++#define NM_OPENSWAN_ESP "esp" + + #define NM_OPENSWAN_PW_TYPE_SAVE "save" + #define NM_OPENSWAN_PW_TYPE_ASK "ask"