[network-manager-applet/NMA_0_8] wired: add MD5 is a phase 1 EAP method
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/NMA_0_8] wired: add MD5 is a phase 1 EAP method
- Date: Tue, 7 Dec 2010 19:54:38 +0000 (UTC)
commit 405964f01fcd0c9c57c921a6d28a0aba19a6e456
Author: Dan Williams <dcbw redhat com>
Date: Tue Dec 7 13:12:58 2010 -0600
wired: add MD5 is a phase 1 EAP method
Some switches (like the Netgear GS108T) only support EAP-MD5.
src/wireless-security/eap-method-peap.c | 3 +++
src/wireless-security/eap-method-simple.c | 27 +++++++++++++++++++++------
src/wireless-security/eap-method-simple.h | 1 +
src/wireless-security/eap-method-ttls.c | 4 ++++
src/wireless-security/wireless-security.c | 18 ++++++++++++++++++
5 files changed, 47 insertions(+), 6 deletions(-)
---
diff --git a/src/wireless-security/eap-method-peap.c b/src/wireless-security/eap-method-peap.c
index db3859a..1b300b8 100644
--- a/src/wireless-security/eap-method-peap.c
+++ b/src/wireless-security/eap-method-peap.c
@@ -244,6 +244,7 @@ inner_auth_combo_init (EAPMethodPEAP *method,
em_mschap_v2 = eap_method_simple_new (method->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
+ TRUE,
method->is_editor);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -259,6 +260,7 @@ inner_auth_combo_init (EAPMethodPEAP *method,
em_md5 = eap_method_simple_new (method->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MD5,
+ TRUE,
method->is_editor);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -274,6 +276,7 @@ inner_auth_combo_init (EAPMethodPEAP *method,
em_gtc = eap_method_simple_new (method->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_GTC,
+ TRUE,
method->is_editor);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c
index 3bbec1f..c12453d 100644
--- a/src/wireless-security/eap-method-simple.c
+++ b/src/wireless-security/eap-method-simple.c
@@ -35,6 +35,7 @@ struct _EAPMethodSimple {
EAPMethodSimpleType type;
gboolean is_editor;
+ gboolean phase2;
};
static void
@@ -99,34 +100,46 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
GtkWidget *widget;
NMSettingConnection *s_con;
gboolean always_ask;
+ const char *eap = NULL;
s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
g_assert (s_8021x);
+ /* If this is the main EAP method, clear any existing methods because the
+ * user-selected on will replace it.
+ */
+ if (method->phase2 == FALSE)
+ nm_setting_802_1x_clear_eap_methods (s_8021x);
+
switch (method->type) {
case EAP_METHOD_SIMPLE_TYPE_PAP:
- g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "pap", NULL);
+ eap = "pap";
break;
case EAP_METHOD_SIMPLE_TYPE_MSCHAP:
- g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "mschap", NULL);
+ eap = "mschap";
break;
case EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2:
- g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "mschapv2", NULL);
+ eap = "mschapv2";
break;
case EAP_METHOD_SIMPLE_TYPE_MD5:
- g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "md5", NULL);
+ eap = "md5";
break;
case EAP_METHOD_SIMPLE_TYPE_CHAP:
- g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "chap", NULL);
+ eap = "chap";
break;
case EAP_METHOD_SIMPLE_TYPE_GTC:
- g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "gtc", NULL);
+ eap = "gtc";
break;
default:
g_assert_not_reached ();
break;
}
+ if (method->phase2)
+ g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, eap, NULL);
+ else
+ nm_setting_802_1x_add_eap_method (s_8021x, eap);
+
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_simple_username_entry"));
g_assert (widget);
g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (GTK_ENTRY (widget)), NULL);
@@ -191,6 +204,7 @@ EAPMethodSimple *
eap_method_simple_new (WirelessSecurity *ws_parent,
NMConnection *connection,
EAPMethodSimpleType type,
+ gboolean phase2,
gboolean is_editor)
{
EAPMethod *parent;
@@ -213,6 +227,7 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
method = (EAPMethodSimple *) parent;
method->type = type;
method->is_editor = is_editor;
+ method->phase2 = phase2;
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_simple_username_entry"));
g_assert (widget);
diff --git a/src/wireless-security/eap-method-simple.h b/src/wireless-security/eap-method-simple.h
index 3f072a2..c28a06c 100644
--- a/src/wireless-security/eap-method-simple.h
+++ b/src/wireless-security/eap-method-simple.h
@@ -39,6 +39,7 @@ typedef struct _EAPMethodSimple EAPMethodSimple;
EAPMethodSimple *eap_method_simple_new (WirelessSecurity *ws_parent,
NMConnection *connection,
EAPMethodSimpleType type,
+ gboolean phase2,
gboolean is_editor);
#endif /* EAP_METHOD_SIMPLE_H */
diff --git a/src/wireless-security/eap-method-ttls.c b/src/wireless-security/eap-method-ttls.c
index 0d6e1af..d23e70c 100644
--- a/src/wireless-security/eap-method-ttls.c
+++ b/src/wireless-security/eap-method-ttls.c
@@ -228,6 +228,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
em_pap = eap_method_simple_new (method->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_PAP,
+ TRUE,
method->is_editor);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -243,6 +244,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
em_mschap = eap_method_simple_new (method->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MSCHAP,
+ TRUE,
method->is_editor);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -258,6 +260,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
em_mschap_v2 = eap_method_simple_new (method->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
+ TRUE,
method->is_editor);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
@@ -273,6 +276,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
em_chap = eap_method_simple_new (method->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_CHAP,
+ TRUE,
method->is_editor);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
diff --git a/src/wireless-security/wireless-security.c b/src/wireless-security/wireless-security.c
index a567732..ff117cb 100644
--- a/src/wireless-security/wireless-security.c
+++ b/src/wireless-security/wireless-security.c
@@ -328,6 +328,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
GtkWidget *combo;
GtkListStore *auth_model;
GtkTreeIter iter;
+ EAPMethodSimple *em_md5;
EAPMethodTLS *em_tls;
EAPMethodLEAP *em_leap;
EAPMethodTTLS *em_ttls;
@@ -354,6 +355,23 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
auth_model = gtk_list_store_new (2, G_TYPE_STRING, eap_method_get_g_type ());
+ if (wired) {
+ em_md5 = eap_method_simple_new (sec,
+ connection,
+ EAP_METHOD_SIMPLE_TYPE_MD5,
+ FALSE,
+ is_editor);
+ gtk_list_store_append (auth_model, &iter);
+ gtk_list_store_set (auth_model, &iter,
+ AUTH_NAME_COLUMN, _("MD5"),
+ AUTH_METHOD_COLUMN, em_md5,
+ -1);
+ eap_method_unref (EAP_METHOD (em_md5));
+ if (default_method && (active < 0) && !strcmp (default_method, "md5"))
+ active = item;
+ item++;
+ }
+
em_tls = eap_method_tls_new (sec, connection, FALSE);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]