[network-manager-openconnect/NM_0_8: 27/55] Add CSD wrapper script configuration



commit 3439181b178f8659f649282062a7e9948653552f
Author: David Woodhouse <David Woodhouse intel com>
Date:   Tue Apr 19 20:10:00 2011 +0100

    Add CSD wrapper script configuration
    
    Basically commit 05824f151cbbad6590628c1150fb52618da8b100, complicated by
    the fact both branches were converted to GtkBuilder in the meantime.

 properties/nm-openconnect-dialog.ui |   83 +++++++++++++++++++++++++++++++++++
 properties/nm-openconnect.c         |   27 +++++++++++
 src/nm-openconnect-service.c        |    1 +
 src/nm-openconnect-service.h        |    1 +
 4 files changed, 112 insertions(+), 0 deletions(-)
---
diff --git a/properties/nm-openconnect-dialog.ui b/properties/nm-openconnect-dialog.ui
index 78c6824..fce77ba 100644
--- a/properties/nm-openconnect-dialog.ui
+++ b/properties/nm-openconnect-dialog.ui
@@ -261,6 +261,89 @@
                 <property name="fill">False</property>
               </packing>
             </child>
+            <child>
+              <object 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>
+                  <object 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>
+                      <object 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>
+                          <object 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 name="has_frame">True</property>
+                            <property name="invisible_char">&#x2022;</property>
+                            <property name="activates_default">False</property>
+                          </object>
+                        </child>
+                      </object>
+                      <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"/>
+                      </packing>
+                    </child>
+                    <child>
+                      <object 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>
+                      </object>
+                      <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"/>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="padding">0</property>
diff --git a/properties/nm-openconnect.c b/properties/nm-openconnect.c
index 8cdbe1d..8b6a696 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 = GTK_WIDGET (gtk_builder_get_object (priv->builder, "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->builder, priv->group, s_vpn, stuff_changed_cb, self);
 
 	return TRUE;
@@ -430,6 +452,11 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
 	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "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 = GTK_WIDGET (gtk_builder_get_object (priv->builder, "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->builder, auth_type, s_vpn);
 
diff --git a/src/nm-openconnect-service.c b/src/nm-openconnect-service.c
index 09ce5df..1d414ea 100644
--- a/src/nm-openconnect-service.c
+++ b/src/nm-openconnect-service.c
@@ -86,6 +86,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;



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