[network-manager-applet: 5/8] wireless-security: show no settings for method "external" in editor mode



commit 33260d9e1cbf495b83bfd05ddbe6d59fcdd7de42
Author: Andrew Zaborowski <andrew zaborowski intel com>
Date:   Sun Sep 16 00:31:31 2018 +0200

    wireless-security: show no settings for method "external" in editor mode
    
    The "external" EAP method string is used in connections automatically
    created by NM to mirror IWD-configured networks where we only know
    they use EAP authentication but not what method or other 802-1x
    setting values, and the values are not even needed by NM.  So still
    don't allow manually setting a connection's EAP method to "external" but
    if that value is already set for the connection then reflect that in the
    security combo.  We abuse the EAPMethodSimple class to produce an empty
    GtkGrid basically.

 src/wireless-security/eap-method-simple.c |  4 ++--
 src/wireless-security/wireless-security.c | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c
index 0f4de339..488ab418 100644
--- a/src/wireless-security/eap-method-simple.c
+++ b/src/wireless-security/eap-method-simple.c
@@ -383,8 +383,8 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
        method->flags = flags;
        method->type = type;
        g_assert (type < EAP_METHOD_SIMPLE_TYPE_LAST);
-       g_assert (   (flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY)
-                 || type != EAP_METHOD_SIMPLE_TYPE_UNKNOWN);
+       g_assert (   type != EAP_METHOD_SIMPLE_TYPE_UNKNOWN
+                 || hints);
 
        if (hints) {
                for (; *hints; hints++) {
diff --git a/src/wireless-security/wireless-security.c b/src/wireless-security/wireless-security.c
index d5447e0a..257675c1 100644
--- a/src/wireless-security/wireless-security.c
+++ b/src/wireless-security/wireless-security.c
@@ -386,7 +386,6 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
        EAPMethodFAST *em_fast;
        EAPMethodTTLS *em_ttls;
        EAPMethodPEAP *em_peap;
-       EAPMethodSimple *em_hints;
        const char *default_method = NULL, *ctype = NULL;
        int active = -1, item = 0;
        gboolean wired = FALSE;
@@ -501,6 +500,8 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
        item++;
 
        if (secrets_hints) {
+               EAPMethodSimple *em_hints;
+
                em_hints = eap_method_simple_new (sec, connection, EAP_METHOD_SIMPLE_TYPE_UNKNOWN,
                                                  simple_flags, secrets_hints);
                gtk_list_store_append (auth_model, &iter);
@@ -511,6 +512,20 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
                eap_method_unref (EAP_METHOD (em_hints));
                active = item;
                item++;
+       } else if (default_method && !strcmp (default_method, "external")) {
+               EAPMethodSimple *em_extern;
+               const char *empty_hints[] = { NULL };
+
+               em_extern = eap_method_simple_new (sec, connection, EAP_METHOD_SIMPLE_TYPE_UNKNOWN,
+                                                  simple_flags, empty_hints);
+               gtk_list_store_append (auth_model, &iter);
+               gtk_list_store_set (auth_model, &iter,
+                                   AUTH_NAME_COLUMN, _("Externally configured"),
+                                   AUTH_METHOD_COLUMN, em_extern,
+                                   -1);
+               eap_method_unref (EAP_METHOD (em_extern));
+                       active = item;
+               item++;
        }
 
        combo = GTK_WIDGET (gtk_builder_get_object (sec->builder, combo_name));


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