[network-manager-openconnect] Clean up configuration GUI, support proxy and 'key from fsid' settings.
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openconnect] Clean up configuration GUI, support proxy and 'key from fsid' settings.
- Date: Tue, 9 Mar 2010 01:08:24 +0000 (UTC)
commit 0e1f3b9abdd2df73b9fef60dd645913d161f5efe
Author: David Woodhouse <David Woodhouse intel com>
Date: Mon Mar 8 17:05:46 2010 -0800
Clean up configuration GUI, support proxy and 'key from fsid' settings.
properties/auth-helpers.c | 239 +++---------
properties/auth-helpers.h | 4 +-
properties/nm-openconnect-dialog.glade | 719 ++++++++++++--------------------
properties/nm-openconnect.c | 130 ++-----
src/nm-openconnect-service.c | 10 +-
src/nm-openconnect-service.h | 5 +-
6 files changed, 356 insertions(+), 751 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 24ccdee..a6bb0dc 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -42,24 +42,18 @@ void
tls_pw_init_auth_widget (GladeXML *xml,
GtkSizeGroup *group,
NMSettingVPN *s_vpn,
- const char *contype,
- const char *prefix,
ChangedCallback changed_cb,
gpointer user_data)
{
GtkWidget *widget;
const char *value;
- char *tmp;
GtkFileFilter *filter;
g_return_if_fail (xml != NULL);
g_return_if_fail (group != NULL);
g_return_if_fail (changed_cb != NULL);
- g_return_if_fail (prefix != NULL);
- tmp = g_strdup_printf ("%s_ca_cert_chooser", prefix);
- widget = glade_xml_get_widget (xml, tmp);
- g_free (tmp);
+ widget = glade_xml_get_widget (xml, "ca_cert_chooser");
gtk_size_group_add_widget (group, widget);
filter = tls_file_chooser_filter_new ();
@@ -75,227 +69,84 @@ tls_pw_init_auth_widget (GladeXML *xml,
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
}
- if (!strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT) ||
- !strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT_TPM)) {
- tmp = g_strdup_printf ("%s_user_cert_chooser", prefix);
- widget = glade_xml_get_widget (xml, tmp);
- g_free (tmp);
-
- gtk_size_group_add_widget (group, widget);
- filter = tls_file_chooser_filter_new ();
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
- gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (widget),
- _("Choose your personal certificate..."));
- g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data);
-
- if (s_vpn) {
- value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_USERCERT);
- if (value && strlen (value))
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
- }
-
- tmp = g_strdup_printf ("%s_private_key_chooser", prefix);
- widget = glade_xml_get_widget (xml, tmp);
- g_free (tmp);
-
- gtk_size_group_add_widget (group, widget);
- filter = tls_file_chooser_filter_new ();
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
- gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (widget),
- _("Choose your private key..."));
- g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data);
-
- if (s_vpn) {
- value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_PRIVKEY);
- if (value && strlen (value))
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
- }
- }
+ widget = glade_xml_get_widget (xml, "cert_user_cert_chooser");
- if (!strcmp (contype, NM_OPENCONNECT_AUTHTYPE_PASSWORD)) {
- tmp = g_strdup_printf ("%s_username_entry", prefix);
- widget = glade_xml_get_widget (xml, tmp);
- g_free (tmp);
-
- gtk_size_group_add_widget (group, widget);
- if (s_vpn) {
- value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_USERNAME);
- if (value && strlen (value))
- gtk_entry_set_text (GTK_ENTRY (widget), value);
- }
- g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (changed_cb), user_data);
+ gtk_size_group_add_widget (group, widget);
+ filter = tls_file_chooser_filter_new ();
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
+ gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (widget),
+ _("Choose your personal certificate..."));
+ g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data);
+
+ if (s_vpn) {
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_USERCERT);
+ if (value && strlen (value))
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
}
-}
-static gboolean
-validate_file_chooser (GladeXML *xml, const char *name)
-{
- GtkWidget *widget;
- char *str;
+ widget = glade_xml_get_widget (xml, "cert_private_key_chooser");
- widget = glade_xml_get_widget (xml, name);
- str = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
- if (!str || !strlen (str))
- return FALSE;
- return TRUE;
-}
+ gtk_size_group_add_widget (group, widget);
+ filter = tls_file_chooser_filter_new ();
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
+ gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (widget),
+ _("Choose your private key..."));
+ g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (changed_cb), user_data);
-static gboolean
-validate_tls (GladeXML *xml, const char *prefix, GError **error)
-{
- char *tmp;
- gboolean valid;
-
-#if 0 // optional
- tmp = g_strdup_printf ("%s_ca_cert_chooser", prefix);
- valid = validate_file_chooser (xml, tmp);
- g_free (tmp);
- if (!valid) {
- g_set_error (error,
- OPENCONNECT_PLUGIN_UI_ERROR,
- OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY,
- NM_OPENCONNECT_KEY_CACERT);
- return FALSE;
- }
-#endif
- tmp = g_strdup_printf ("%s_user_cert_chooser", prefix);
- valid = validate_file_chooser (xml, tmp);
- g_free (tmp);
- if (!valid) {
- g_set_error (error,
- OPENCONNECT_PLUGIN_UI_ERROR,
- OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY,
- NM_OPENCONNECT_KEY_USERCERT);
- return FALSE;
- }
-#if 0 // also optional -- can be in the cert
- tmp = g_strdup_printf ("%s_private_key_chooser", prefix);
- valid = validate_file_chooser (xml, tmp);
- g_free (tmp);
- if (!valid) {
- g_set_error (error,
- OPENCONNECT_PLUGIN_UI_ERROR,
- OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY,
- NM_OPENCONNECT_KEY_PRIVKEY);
- return FALSE;
+ if (s_vpn) {
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_PRIVKEY);
+ if (value && strlen (value))
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
}
-#endif
- return TRUE;
}
gboolean
-auth_widget_check_validity (GladeXML *xml, const char *contype, GError **error)
+auth_widget_check_validity (GladeXML *xml, GError **error)
{
-#if 0
- GtkWidget *widget;
- const char *str;
-#endif
-
- if (!strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT) ||
- !strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT_TPM)) {
- if (!validate_tls (xml, "cert", error))
- return FALSE;
- } else if (!strcmp (contype, NM_OPENCONNECT_AUTHTYPE_PASSWORD)) {
-#if 0 // optional
- if (!validate_file_chooser (xml, "pw_ca_cert_chooser")) {
- g_set_error (error,
- OPENCONNECT_PLUGIN_UI_ERROR,
- OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY,
- NM_OPENCONNECT_KEY_CACERT);
- return FALSE;
- }
-// as is this... the auth-dialog can ask for it.
- widget = glade_xml_get_widget (xml, "pw_username_entry");
- str = gtk_entry_get_text (GTK_ENTRY (widget));
- if (!str || !strlen (str)) {
- g_set_error (error,
- OPENCONNECT_PLUGIN_UI_ERROR,
- OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY,
- NM_OPENCONNECT_KEY_USERNAME);
- return FALSE;
- }
-#endif
- } else
- g_assert_not_reached ();
-
return TRUE;
}
static void
update_from_filechooser (GladeXML *xml,
const char *key,
- const char *prefix,
const char *widget_name,
NMSettingVPN *s_vpn)
{
GtkWidget *widget;
- char *tmp, *filename;
+ char *filename;
+ char *authtype;
g_return_if_fail (xml != NULL);
g_return_if_fail (key != NULL);
- g_return_if_fail (prefix != NULL);
g_return_if_fail (widget_name != NULL);
g_return_if_fail (s_vpn != NULL);
- tmp = g_strdup_printf ("%s_%s", prefix, widget_name);
- widget = glade_xml_get_widget (xml, tmp);
- g_free (tmp);
+ widget = glade_xml_get_widget (xml, widget_name);
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
- if (!filename)
- return;
-
- if (strlen (filename))
+ if (filename && strlen(filename)) {
nm_setting_vpn_add_data_item (s_vpn, key, filename);
-
+ authtype = "cert";
+ } else {
+ nm_setting_vpn_remove_data_item (s_vpn, key);
+ authtype = "password";
+ }
+ /* Hack to keep older nm-auth-dialog working */
+ if (!strcmp(key, NM_OPENCONNECT_KEY_USERCERT))
+ nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_AUTHTYPE, authtype);
g_free (filename);
}
-static void
-update_tls (GladeXML *xml, const char *prefix, NMSettingVPN *s_vpn)
-{
- update_from_filechooser (xml, NM_OPENCONNECT_KEY_CACERT, prefix, "ca_cert_chooser", s_vpn);
- update_from_filechooser (xml, NM_OPENCONNECT_KEY_USERCERT, prefix, "user_cert_chooser", s_vpn);
- update_from_filechooser (xml, NM_OPENCONNECT_KEY_PRIVKEY, prefix, "private_key_chooser", s_vpn);
-}
-
-static void
-update_username (GladeXML *xml, const char *prefix, NMSettingVPN *s_vpn)
-{
- GtkWidget *widget;
- char *tmp;
- const char *str;
-
- g_return_if_fail (xml != NULL);
- g_return_if_fail (prefix != NULL);
- g_return_if_fail (s_vpn != NULL);
-
- tmp = g_strdup_printf ("%s_username_entry", prefix);
- widget = glade_xml_get_widget (xml, tmp);
- g_free (tmp);
-
- str = gtk_entry_get_text (GTK_ENTRY (widget));
- if (str && strlen (str))
- nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_USERNAME, str);
-}
-
gboolean
auth_widget_update_connection (GladeXML *xml,
const char *contype,
NMSettingVPN *s_vpn)
{
- if (!strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT) ||
- !strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT_TPM)) {
- update_tls (xml, "cert", s_vpn);
- } else if (!strcmp (contype, NM_OPENCONNECT_AUTHTYPE_PASSWORD)) {
- update_from_filechooser (xml, NM_OPENCONNECT_KEY_CACERT, "pw",
- "ca_cert_chooser", s_vpn);
- update_username (xml, "pw", s_vpn);
- } else
- g_assert_not_reached ();
-
+ update_from_filechooser (xml, NM_OPENCONNECT_KEY_CACERT, "ca_cert_chooser", s_vpn);
+ update_from_filechooser (xml, NM_OPENCONNECT_KEY_USERCERT, "cert_user_cert_chooser", s_vpn);
+ update_from_filechooser (xml, NM_OPENCONNECT_KEY_PRIVKEY, "cert_private_key_chooser", s_vpn);
return TRUE;
}
@@ -317,6 +168,7 @@ find_tag (const char *tag, const char *buf, gsize len)
static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----";
static const char *pem_dsa_key_begin = "-----BEGIN DSA PRIVATE KEY-----";
+static const char *pem_enc_key_begin = "-----BEGIN ENCRYPTED PRIVATE KEY-----";
static const char *pem_tss_keyblob_begin = "-----BEGIN TSS KEY BLOB-----";
static const char *pem_cert_begin = "-----BEGIN CERTIFICATE-----";
@@ -367,6 +219,11 @@ tls_default_filter (const GtkFileFilterInfo *filter_info, gpointer data)
goto out;
}
+ if (find_tag (pem_enc_key_begin, (const char *) contents, bytes_read)) {
+ show = TRUE;
+ goto out;
+ }
+
if (find_tag (pem_tss_keyblob_begin, (const char *) contents, bytes_read)) {
show = TRUE;
goto out;
diff --git a/properties/auth-helpers.h b/properties/auth-helpers.h
index 7168221..79e86f9 100644
--- a/properties/auth-helpers.h
+++ b/properties/auth-helpers.h
@@ -35,8 +35,6 @@ typedef void (*ChangedCallback) (GtkWidget *widget, gpointer user_data);
void tls_pw_init_auth_widget (GladeXML *xml,
GtkSizeGroup *group,
NMSettingVPN *s_vpn,
- const char *contype,
- const char *prefix,
ChangedCallback changed_cb,
gpointer user_data);
@@ -46,7 +44,7 @@ void sk_init_auth_widget (GladeXML *xml,
ChangedCallback changed_cb,
gpointer user_data);
-gboolean auth_widget_check_validity (GladeXML *xml, const char *contype, GError **error);
+gboolean auth_widget_check_validity (GladeXML *xml, GError **error);
gboolean auth_widget_update_connection (GladeXML *xml,
const char *contype,
diff --git a/properties/nm-openconnect-dialog.glade b/properties/nm-openconnect-dialog.glade
index eea845d..e276061 100644
--- a/properties/nm-openconnect-dialog.glade
+++ b/properties/nm-openconnect-dialog.glade
@@ -71,7 +71,7 @@
<child>
<widget class="GtkTable" id="table2">
<property name="visible">True</property>
- <property name="n_rows">1</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@@ -140,77 +140,37 @@
<property name="y_options"></property>
</packing>
</child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox11">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label25">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Authentication</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</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="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="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment9">
- <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">2</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="GtkLabel" id="label27">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">C_A Certificate:</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="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">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
<child>
- <widget class="GtkAlignment" id="alignment3">
+ <widget class="GtkAlignment" id="alignment11">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="yalign">0.5</property>
@@ -222,27 +182,33 @@
<property name="right_padding">0</property>
<child>
- <widget class="GtkComboBox" id="auth_combo">
+ <widget class="GtkEntry" id="proxy_entry">
<property name="visible">True</property>
- <property name="items" translatable="yes"> </property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">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="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label26">
+ <widget class="GtkLabel" id="label28">
<property name="visible">True</property>
- <property name="label" translatable="yes">Type:</property>
- <property name="use_underline">False</property>
+ <property name="label" translatable="yes">_Proxy:</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>
@@ -251,6 +217,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
+ <property name="mnemonic_widget">proxy_entry</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -259,414 +226,250 @@
<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="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkNotebook" id="auth_notebook">
+ <widget class="GtkAlignment" id="alignment12">
<property name="visible">True</property>
- <property name="show_tabs">False</property>
- <property name="show_border">False</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">False</property>
- <property name="enable_popup">False</property>
-
- <child>
- <widget class="GtkTable" id="table1">
- <property name="visible">True</property>
- <property name="n_rows">3</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="alignment6">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0.019999999553</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="GtkFileChooserButton" id="cert_private_key_chooser">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Select A File</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
- <property name="local_only">True</property>
- <property name="show_hidden">False</property>
- <property name="do_overwrite_confirmation">False</property>
- <property name="width_chars">-1</property>
- </widget>
- </child>
- </widget>
- <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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment5">
- <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="GtkFileChooserButton" id="cert_user_cert_chooser">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Select A File</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
- <property name="local_only">True</property>
- <property name="show_hidden">False</property>
- <property name="do_overwrite_confirmation">False</property>
- <property name="width_chars">-1</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="GtkAlignment" id="alignment4">
- <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="GtkFileChooserButton" id="cert_ca_cert_chooser">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Select A File</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
- <property name="local_only">True</property>
- <property name="show_hidden">False</property>
- <property name="do_overwrite_confirmation">False</property>
- <property name="width_chars">-1</property>
- </widget>
- </child>
- </widget>
- <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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">CA Certificate:</property>
- <property name="use_underline">False</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="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">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">User Certificate:</property>
- <property name="use_underline">False</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="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>
-
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Private Key:</property>
- <property name="use_underline">False</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="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">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
+ <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="GtkLabel" id="label14">
+ <widget class="GtkFileChooserButton" id="ca_cert_chooser">
<property name="visible">True</property>
- <property name="label">page 1</property>
- <property name="use_underline">False</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="title" translatable="yes">Select A File</property>
+ <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+ <property name="local_only">True</property>
+ <property name="show_hidden">True</property>
+ <property name="do_overwrite_confirmation">False</property>
<property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
</widget>
- <packing>
- <property name="type">tab</property>
- </packing>
</child>
+ </widget>
+ <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"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkTable" id="table4">
- <property name="visible">True</property>
- <property name="n_rows">2</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="GtkVBox" id="vbox11">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label25">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Certificate Authentication</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</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="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="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkAlignment" id="alignment10">
- <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="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">2</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="GtkFileChooserButton" id="pw_ca_cert_chooser">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Select A File</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
- <property name="local_only">True</property>
- <property name="show_hidden">False</property>
- <property name="do_overwrite_confirmation">False</property>
- <property name="width_chars">-1</property>
- </widget>
- </child>
- </widget>
- <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"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment5">
+ <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="GtkAlignment" id="alignment7">
- <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="GtkFileChooserButton" id="cert_user_cert_chooser">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Select A File</property>
+ <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+ <property name="local_only">True</property>
+ <property name="show_hidden">False</property>
+ <property name="do_overwrite_confirmation">False</property>
+ <property name="width_chars">-1</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="GtkEntry" id="pw_username_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="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">User _Certificate:</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">cert_user_cert_chooser</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>
- <child>
- <widget class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="label" translatable="yes">User name:</property>
- <property name="use_underline">False</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="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>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Private _Key:</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">cert_private_key_chooser</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">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="label" translatable="yes">CA Certificate:</property>
- <property name="use_underline">False</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="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">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment6">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0.019999999553</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="GtkLabel" id="label15">
- <property name="visible">True</property>
- <property name="label">page 2</property>
- <property name="use_underline">False</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</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="type">tab</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkFileChooserButton" id="cert_private_key_chooser">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Select A File</property>
+ <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+ <property name="local_only">True</property>
+ <property name="show_hidden">False</property>
+ <property name="do_overwrite_confirmation">False</property>
+ <property name="width_chars">-1</property>
</widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
</child>
</widget>
+ <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="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="fsid_button">
+ <property name="border_width">2</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use _FSID for key passphrase</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
</widget>
diff --git a/properties/nm-openconnect.c b/properties/nm-openconnect.c
index 03801ea..b35780e 100644
--- a/properties/nm-openconnect.c
+++ b/properties/nm-openconnect.c
@@ -122,9 +122,6 @@ check_validity (OpenconnectPluginUiWidget *self, GError **error)
OpenconnectPluginUiWidgetPrivate *priv = OPENCONNECT_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
GtkWidget *widget;
const char *str;
- GtkTreeModel *model;
- GtkTreeIter iter;
- const char *contype = NULL;
widget = glade_xml_get_widget (priv->xml, "gateway_entry");
str = gtk_entry_get_text (GTK_ENTRY (widget));
@@ -136,13 +133,19 @@ check_validity (OpenconnectPluginUiWidget *self, GError **error)
return FALSE;
}
- widget = glade_xml_get_widget (priv->xml, "auth_combo");
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
- g_assert (model);
- g_assert (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter));
- gtk_tree_model_get (model, &iter, COL_AUTH_TYPE, &contype, -1);
- if (!auth_widget_check_validity (priv->xml, contype, error))
+ widget = glade_xml_get_widget (priv->xml, "proxy_entry");
+ str = gtk_entry_get_text (GTK_ENTRY (widget));
+ if (str && str[0] &&
+ strncmp(str, "socks://", 8) && strncmp(str, "http://", 7)) {
+ g_set_error (error,
+ OPENCONNECT_PLUGIN_UI_ERROR,
+ OPENCONNECT_PLUGIN_UI_ERROR_INVALID_PROPERTY,
+ NM_OPENCONNECT_KEY_PROXY);
+ return FALSE;
+ }
+
+ if (!auth_widget_check_validity (priv->xml, error))
return FALSE;
return TRUE;
@@ -154,40 +157,13 @@ stuff_changed_cb (GtkWidget *widget, gpointer user_data)
g_signal_emit_by_name (OPENCONNECT_PLUGIN_UI_WIDGET (user_data), "changed");
}
-static void
-auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
-{
- OpenconnectPluginUiWidget *self = OPENCONNECT_PLUGIN_UI_WIDGET (user_data);
- OpenconnectPluginUiWidgetPrivate *priv = OPENCONNECT_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
- GtkWidget *auth_notebook;
- GtkTreeModel *model;
- GtkTreeIter iter;
- gint new_page = 0;
-
- auth_notebook = glade_xml_get_widget (priv->xml, "auth_notebook");
- g_assert (auth_notebook);
-
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
- g_assert (model);
- g_assert (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter));
-
- gtk_tree_model_get (model, &iter, COL_AUTH_PAGE, &new_page, -1);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (auth_notebook), new_page);
-
- stuff_changed_cb (combo, self);
-}
-
static gboolean
init_plugin_ui (OpenconnectPluginUiWidget *self, NMConnection *connection, GError **error)
{
OpenconnectPluginUiWidgetPrivate *priv = OPENCONNECT_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
NMSettingVPN *s_vpn;
GtkWidget *widget;
- GtkListStore *store;
- GtkTreeIter iter;
- int active = -1;
const char *value;
- const char *contype = NM_OPENCONNECT_AUTHTYPE_PASSWORD;
s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
@@ -204,64 +180,30 @@ init_plugin_ui (OpenconnectPluginUiWidget *self, NMConnection *connection, GErro
}
g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
- widget = glade_xml_get_widget (priv->xml, "auth_combo");
+ widget = glade_xml_get_widget (priv->xml, "proxy_entry");
if (!widget)
return FALSE;
gtk_size_group_add_widget (priv->group, widget);
-
- store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
-
if (s_vpn) {
- contype = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_AUTHTYPE);
- if (contype) {
- if ( strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT)
- && strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT_TPM)
- && strcmp (contype, NM_OPENCONNECT_AUTHTYPE_PASSWORD))
- contype = NM_OPENCONNECT_AUTHTYPE_PASSWORD;
- } else
- contype = NM_OPENCONNECT_AUTHTYPE_PASSWORD;
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_PROXY);
+ if (value)
+ gtk_entry_set_text (GTK_ENTRY (widget), value);
}
+ g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (stuff_changed_cb), self);
- /* SecurID/password auth widget */
- tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn,
- NM_OPENCONNECT_AUTHTYPE_PASSWORD, "pw",
- stuff_changed_cb, self);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_AUTH_NAME, _("Password / SecurID"),
- COL_AUTH_PAGE, 1,
- COL_AUTH_TYPE, NM_OPENCONNECT_AUTHTYPE_PASSWORD,
- -1);
+ widget = glade_xml_get_widget (priv->xml, "fsid_button");
+ if (!widget)
+ return FALSE;
+ if (s_vpn) {
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_PEM_PASSPHRASE_FSID);
+ if (value && !strcmp(value, "yes"))
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (widget), TRUE);
+ }
+ g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (stuff_changed_cb), self);
- /* Certificate auth widget */
tls_pw_init_auth_widget (priv->xml, priv->group, s_vpn,
- NM_OPENCONNECT_AUTHTYPE_CERT, "cert",
stuff_changed_cb, self);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_AUTH_NAME, _("Certificate (TLS)"),
- COL_AUTH_PAGE, 0,
- COL_AUTH_TYPE, NM_OPENCONNECT_AUTHTYPE_CERT,
- -1);
- if ((active < 0) && !strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT))
- active = 1;
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_AUTH_NAME, _("Certificate (TLS) with TPM"),
- COL_AUTH_PAGE, 0,
- COL_AUTH_TYPE, NM_OPENCONNECT_AUTHTYPE_CERT_TPM,
- -1);
- if ((active < 0) && !strcmp (contype, NM_OPENCONNECT_AUTHTYPE_CERT_TPM))
- active = 2;
-
- gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
- g_object_unref (store);
- g_signal_connect (widget, "changed", G_CALLBACK (auth_combo_changed_cb), self);
- gtk_combo_box_set_active (GTK_COMBO_BOX (widget), active < 0 ? 0 : active);
-
return TRUE;
}
@@ -284,8 +226,6 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
NMSettingVPN *s_vpn;
GtkWidget *widget;
char *str;
- GtkTreeModel *model;
- GtkTreeIter iter;
const char *auth_type = NULL;
if (!check_validity (self, error))
@@ -294,19 +234,21 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_DBUS_SERVICE_OPENCONNECT, NULL);
- /* Gateway */
widget = glade_xml_get_widget (priv->xml, "gateway_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_GATEWAY, str);
- widget = glade_xml_get_widget (priv->xml, "auth_combo");
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)) {
- gtk_tree_model_get (model, &iter, COL_AUTH_TYPE, &auth_type, -1);
- nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_AUTHTYPE, auth_type);
- auth_widget_update_connection (priv->xml, auth_type, s_vpn);
- }
+ widget = glade_xml_get_widget (priv->xml, "proxy_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_PROXY, str);
+
+ widget = glade_xml_get_widget (priv->xml, "fsid_button");
+ str = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget))?"yes":"no";
+ nm_setting_vpn_add_data_item (s_vpn, NM_OPENCONNECT_KEY_PEM_PASSPHRASE_FSID, str);
+
+ auth_widget_update_connection (priv->xml, auth_type, s_vpn);
nm_connection_add_setting (connection, NM_SETTING (s_vpn));
return TRUE;
diff --git a/src/nm-openconnect-service.c b/src/nm-openconnect-service.c
index ea0d2c7..e2f4d38 100644
--- a/src/nm-openconnect-service.c
+++ b/src/nm-openconnect-service.c
@@ -79,6 +79,7 @@ static ValidProperty valid_properties[] = {
{ NM_OPENCONNECT_KEY_MTU, G_TYPE_STRING, 0, 0 },
{ NM_OPENCONNECT_KEY_AUTOCONNECT, G_TYPE_BOOLEAN, 0, 0 },
{ NM_OPENCONNECT_KEY_PEM_PASSPHRASE_FSID, G_TYPE_BOOLEAN, 0, 0 },
+ { NM_OPENCONNECT_KEY_PROXY, G_TYPE_STRING, 0, 0 },
{ NULL, G_TYPE_NONE, 0, 0 }
};
@@ -260,7 +261,7 @@ nm_openconnect_start_openconnect_binary (NMOPENCONNECTPlugin *plugin,
GPtrArray *openconnect_argv;
GSource *openconnect_watch;
gint stdin_fd;
- const char *props_vpn_gw, *props_cookie, *props_cacert, *props_mtu, *props_gwcert;
+ const char *props_vpn_gw, *props_cookie, *props_cacert, *props_mtu, *props_gwcert, *props_proxy;
/* Find openconnect */
openconnect_binary = openconnect_binary_paths;
@@ -305,6 +306,8 @@ nm_openconnect_start_openconnect_binary (NMOPENCONNECTPlugin *plugin,
props_cacert = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_CACERT);
props_mtu = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_MTU);
+ props_proxy = nm_setting_vpn_get_data_item (s_vpn, NM_OPENCONNECT_KEY_PROXY);
+
openconnect_argv = g_ptr_array_new ();
g_ptr_array_add (openconnect_argv, (gpointer) (*openconnect_binary));
@@ -321,6 +324,11 @@ nm_openconnect_start_openconnect_binary (NMOPENCONNECTPlugin *plugin,
g_ptr_array_add (openconnect_argv, (gpointer) props_mtu);
}
+ if (props_proxy && strlen(props_proxy)) {
+ g_ptr_array_add (openconnect_argv, (gpointer) "--proxy");
+ g_ptr_array_add (openconnect_argv, (gpointer) props_proxy);
+ }
+
g_ptr_array_add (openconnect_argv, (gpointer) "--syslog");
g_ptr_array_add (openconnect_argv, (gpointer) "--cookie-on-stdin");
diff --git a/src/nm-openconnect-service.h b/src/nm-openconnect-service.h
index 553f444..d95d77f 100644
--- a/src/nm-openconnect-service.h
+++ b/src/nm-openconnect-service.h
@@ -54,10 +54,7 @@
#define NM_OPENCONNECT_KEY_MTU "mtu"
#define NM_OPENCONNECT_KEY_AUTOCONNECT "autoconnect"
#define NM_OPENCONNECT_KEY_PEM_PASSPHRASE_FSID "pem_passphrase_fsid"
-
-#define NM_OPENCONNECT_AUTHTYPE_CERT "cert"
-#define NM_OPENCONNECT_AUTHTYPE_CERT_TPM "cert-tpm"
-#define NM_OPENCONNECT_AUTHTYPE_PASSWORD "password"
+#define NM_OPENCONNECT_KEY_PROXY "proxy"
typedef struct {
NMVPNPlugin parent;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]