[network-manager-applet] add support for TTLS/MSCHAPV2



commit 3f4f8d5f25f35da86e2acab341ce277c41982c5f
Author: Jonathan Kang <jonathan121537 gmail com>
Date:   Thu Nov 24 15:02:37 2016 +0800

    add support for TTLS/MSCHAPV2
    
    Currently, nm-applet only support TTLS/EAP-MSCHAPV2. It makes users
    unable to connect to wifis that only supports TTLS/MSCHAPv2.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768489

 src/wireless-security/eap-method-simple.c |   15 ++++++++-------
 src/wireless-security/eap-method-simple.h |    1 +
 src/wireless-security/eap-method-ttls.c   |   26 ++++++++++++++++++++++----
 3 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c
index 411bba6..0517727 100644
--- a/src/wireless-security/eap-method-simple.c
+++ b/src/wireless-security/eap-method-simple.c
@@ -115,13 +115,14 @@ typedef struct {
 
 /* Indexed by EAP_METHOD_SIMPLE_TYPE_* */
 static const EapType eap_table[EAP_METHOD_SIMPLE_TYPE_LAST] = {
-       [EAP_METHOD_SIMPLE_TYPE_PAP]       = { "pap",      FALSE },
-       [EAP_METHOD_SIMPLE_TYPE_MSCHAP]    = { "mschap",   FALSE },
-       [EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2] = { "mschapv2", TRUE  },
-       [EAP_METHOD_SIMPLE_TYPE_MD5]       = { "md5",      TRUE  },
-       [EAP_METHOD_SIMPLE_TYPE_PWD]       = { "pwd",      TRUE  },
-       [EAP_METHOD_SIMPLE_TYPE_CHAP]      = { "chap",     FALSE },
-       [EAP_METHOD_SIMPLE_TYPE_GTC]       = { "gtc",      TRUE  },
+       [EAP_METHOD_SIMPLE_TYPE_PAP]             = { "pap",      FALSE },
+       [EAP_METHOD_SIMPLE_TYPE_MSCHAP]          = { "mschap",   FALSE },
+       [EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2]       = { "mschapv2", TRUE  },
+       [EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2] = { "mschapv2", FALSE },
+       [EAP_METHOD_SIMPLE_TYPE_MD5]             = { "md5",      TRUE  },
+       [EAP_METHOD_SIMPLE_TYPE_PWD]             = { "pwd",      TRUE  },
+       [EAP_METHOD_SIMPLE_TYPE_CHAP]            = { "chap",     FALSE },
+       [EAP_METHOD_SIMPLE_TYPE_GTC]             = { "gtc",      TRUE  },
 };
 
 static void
diff --git a/src/wireless-security/eap-method-simple.h b/src/wireless-security/eap-method-simple.h
index 293d17b..ecad120 100644
--- a/src/wireless-security/eap-method-simple.h
+++ b/src/wireless-security/eap-method-simple.h
@@ -30,6 +30,7 @@ typedef enum {
        EAP_METHOD_SIMPLE_TYPE_PAP = 0,
        EAP_METHOD_SIMPLE_TYPE_MSCHAP,
        EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
+       EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2,
        EAP_METHOD_SIMPLE_TYPE_MD5,
        EAP_METHOD_SIMPLE_TYPE_PWD,
        EAP_METHOD_SIMPLE_TYPE_CHAP,
diff --git a/src/wireless-security/eap-method-ttls.c b/src/wireless-security/eap-method-ttls.c
index 789f0fa..0d88cf1 100644
--- a/src/wireless-security/eap-method-ttls.c
+++ b/src/wireless-security/eap-method-ttls.c
@@ -227,6 +227,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
        EAPMethodSimple *em_pap;
        EAPMethodSimple *em_mschap;
        EAPMethodSimple *em_mschap_v2;
+       EAPMethodSimple *em_plain_mschap_v2;
        EAPMethodSimple *em_chap;
        EAPMethodSimple *em_md5;
        EAPMethodSimple *em_gtc;
@@ -291,9 +292,26 @@ inner_auth_combo_init (EAPMethodTTLS *method,
        eap_method_unref (EAP_METHOD (em_mschap_v2));
 
        /* Check for defaulting to MSCHAPv2 */
-       if (phase2_auth && !strcasecmp (phase2_auth, "mschapv2"))
+       if (phase2_auth && !strcasecmp (phase2_auth, "mschapv2") &&
+           nm_setting_802_1x_get_phase2_autheap (s_8021x) != NULL)
                active = 2;
 
+       em_plain_mschap_v2 = eap_method_simple_new (method->sec_parent,
+                                                   connection,
+                                                   EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2,
+                                                   simple_flags);
+       gtk_list_store_append (auth_model, &iter);
+       gtk_list_store_set (auth_model, &iter,
+                           I_NAME_COLUMN, _("MSCHAPv2 (no EAP)"),
+                           I_METHOD_COLUMN, em_plain_mschap_v2,
+                           -1);
+       eap_method_unref (EAP_METHOD (em_plain_mschap_v2));
+
+       /* Check for defaulting to plain MSCHAPv2 */
+       if (phase2_auth && !strcasecmp (phase2_auth, "mschapv2") &&
+           nm_setting_802_1x_get_phase2_auth (s_8021x) != NULL)
+               active = 3;
+
        em_chap = eap_method_simple_new (method->sec_parent,
                                         connection,
                                         EAP_METHOD_SIMPLE_TYPE_CHAP,
@@ -307,7 +325,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
 
        /* Check for defaulting to CHAP */
        if (phase2_auth && !strcasecmp (phase2_auth, "chap"))
-               active = 3;
+               active = 4;
 
        em_md5 = eap_method_simple_new (method->sec_parent,
                                        connection,
@@ -322,7 +340,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
 
        /* Check for defaulting to MD5 */
        if (phase2_auth && !strcasecmp (phase2_auth, "md5"))
-               active = 4;
+               active = 5;
 
        em_gtc = eap_method_simple_new (method->sec_parent,
                                        connection,
@@ -337,7 +355,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
 
        /* Check for defaulting to GTC */
        if (phase2_auth && !strcasecmp (phase2_auth, "gtc"))
-               active = 5;
+               active = 6;
 
        combo = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
        g_assert (combo);


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