[PATCH] Add CSD wrapper script configuration

Keith Moyer openconnect-devel at keithmoyer.com
Fri Nov 26 15:20:29 EST 2010


Please ignore previous patch.  I left out export/import and had a small typo.

Signed-off-by: Keith Moyer <openconnect-devel at keithmoyer.com>
---
 properties/nm-openconnect-dialog.glade |   88 ++++++++++++++++++++++++++++++++
 properties/nm-openconnect.c            |   27 ++++++++++
 src/nm-openconnect-service.c           |    1 +
 src/nm-openconnect-service.h           |    1 +
 4 files changed, 117 insertions(+), 0 deletions(-)

diff --git a/properties/nm-openconnect-dialog.glade b/properties/nm-openconnect-dialog.glade
index 720d791..696b570 100644
--- a/properties/nm-openconnect-dialog.glade
+++ b/properties/nm-openconnect-dialog.glade
@@ -291,6 +291,94 @@
 	      <property name="fill">False</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkAlignment" id="alignment14">
+	      <property name="visible">True</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xscale">1</property>
+	      <property name="yscale">1</property>
+	      <property name="top_padding">0</property>
+	      <property name="bottom_padding">0</property>
+	      <property name="left_padding">12</property>
+	      <property name="right_padding">0</property>
+
+	      <child>
+		<widget class="GtkTable" id="table3">
+		  <property name="visible">True</property>
+		  <property name="n_rows">1</property>
+		  <property name="n_columns">2</property>
+		  <property name="homogeneous">False</property>
+		  <property name="row_spacing">6</property>
+		  <property name="column_spacing">6</property>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment15">
+		      <property name="visible">True</property>
+		      <property name="xalign">1</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">0</property>
+		      <property name="yscale">1</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">0</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkEntry" id="csd_wrapper_entry">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="editable">True</property>
+			  <property name="visibility">True</property>
+			  <property name="max_length">0</property>
+			  <property name="text" translatable="yes"></property>
+			  <property name="has_frame">True</property>
+			  <property name="invisible_char">•</property>
+			  <property name="activates_default">False</property>
+			</widget>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">1</property>
+		      <property name="right_attach">2</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label29">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">CSD _Wrapper Script:</property>
+		      <property name="use_underline">True</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="mnemonic_widget">csd_wrapper_entry</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+		</widget>
+	      </child>
+	    </widget>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
diff --git a/properties/nm-openconnect.c b/properties/nm-openconnect.c
index ac5c77c..8b5b1bb 100644
--- a/properties/nm-openconnect.c
+++ b/properties/nm-openconnect.c
@@ -145,6 +145,11 @@ import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
 	if (bval)
 		nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_ENABLE, "yes");
 
+	/* Cisco Secure Desktop wrapper */
+	buf = g_key_file_get_string (keyfile, "openconnect", "CSDWrapper", NULL);
+	if (buf)
+		nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_WRAPPER, buf);
+
 	/* User Certificate */
 	buf = g_key_file_get_string (keyfile, "openconnect", "UserCertificate", NULL);
 	if (buf)
@@ -177,6 +182,7 @@ export (NMVpnPluginUiInterface *iface,
 	const char *cacert = NULL;
 	const char *proxy = NULL;
 	gboolean csd_enable = FALSE;
+	const char *csd_wrapper = NULL;
 	const char *usercert = NULL;
 	const char *privkey = NULL;
 	gboolean pem_passphrase_fsid = FALSE;
@@ -214,6 +220,10 @@ export (NMVpnPluginUiInterface *iface,
 	if (value && !strcmp (value, "yes"))
 		csd_enable = TRUE;
 
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_WRAPPER);
+	if (value && strlen (value))
+		csd_wrapper = value;
+
 	value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_USERCERT);
 	if (value && strlen (value))
 		usercert = value;
@@ -233,6 +243,7 @@ export (NMVpnPluginUiInterface *iface,
 		 "CACert=%s\n"
 		 "Proxy=%s\n"
 		 "CSDEnable=%s\n"
+		 "CSDWrapper=%s\n"
 		 "UserCertificate=%s\n"
 		 "PrivateKey=%s\n"
 		 "FSID=%s\n",
@@ -241,6 +252,7 @@ export (NMVpnPluginUiInterface *iface,
 		 /* CA Certificate */        cacert,
 		 /* Proxy */                 proxy ? proxy : "",
 		 /* Cisco Secure Desktop */  csd_enable ? "1" : "0",
+		 /* CSD Wrapper Script */    csd_wrapper ? csd_wrapper : "",
 		 /* User Certificate */      usercert,
 		 /* Private Key */           privkey,
 		 /* FSID */                  pem_passphrase_fsid ? "1" : "0");
@@ -381,6 +393,16 @@ init_plugin_ui (OpenconnectPluginUiWidget *self, NMConnection *connection, GErro
 	}
 	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (stuff_changed_cb), self);
 
+	widget = glade_xml_get_widget (priv->xml, "csd_wrapper_entry");
+	if (!widget)
+		return FALSE;
+	if (s_vpn) {
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_WRAPPER);
+		if (value)
+			gtk_entry_set_text (GTK_ENTRY (widget), value);
+	}
+	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
+
 	tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn,
 							 stuff_changed_cb, self);
 
@@ -431,6 +453,11 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
 	widget = glade_xml_get_widget (priv->xml, "csd_button");
 	str = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget))?"yes":"no";
 	nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_ENABLE, str);
+
+	widget = glade_xml_get_widget (priv->xml, "csd_wrapper_entry");
+	str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+	if (str && strlen (str))
+		nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_CSD_WRAPPER, str);
 	
 	auth_widget_update_connection (priv->xml, auth_type, s_vpn);
 
diff --git a/src/nm-openconnect-service.c b/src/nm-openconnect-service.c
index 05f8581..d8d96ec 100644
--- a/src/nm-openconnect-service.c
+++ b/src/nm-openconnect-service.c
@@ -81,6 +81,7 @@ static ValidProperty valid_properties[] = {
 	{ NM_OPENCONNECT_KEY_PEM_PASSPHRASE_FSID, G_TYPE_BOOLEAN, 0, 0 },
 	{ NM_OPENCONNECT_KEY_PROXY,       G_TYPE_STRING, 0, 0 },
 	{ NM_OPENCONNECT_KEY_CSD_ENABLE,  G_TYPE_BOOLEAN, 0, 0 },
+	{ NM_OPENCONNECT_KEY_CSD_WRAPPER, G_TYPE_STRING, 0, 0 },
 	{ NULL,                           G_TYPE_NONE, 0, 0 }
 };
 
diff --git a/src/nm-openconnect-service.h b/src/nm-openconnect-service.h
index 9c6c70b..2281110 100644
--- a/src/nm-openconnect-service.h
+++ b/src/nm-openconnect-service.h
@@ -56,6 +56,7 @@
 #define NM_OPENCONNECT_KEY_PEM_PASSPHRASE_FSID "pem_passphrase_fsid"
 #define NM_OPENCONNECT_KEY_PROXY "proxy"
 #define NM_OPENCONNECT_KEY_CSD_ENABLE "enable_csd_trojan"
+#define NM_OPENCONNECT_KEY_CSD_WRAPPER "csd_wrapper"
 
 typedef struct {
 	NMVPNPlugin parent;
-- 
1.7.0.4




More information about the openconnect-devel mailing list