[gnome-control-center] network: Simplify autheap_allowed logic
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Simplify autheap_allowed logic
- Date: Fri, 31 Jan 2020 14:19:09 +0000 (UTC)
commit 37f5c37261a97c640408df82fe9407d3778e2630
Author: Robert Ancell <robert ancell canonical com>
Date: Tue Dec 3 14:54:36 2019 +1300
network: Simplify autheap_allowed logic
Instead of checking later if this should be enabled, only enable it for methods
that can do it.
panels/network/wireless-security/eap-method-simple.c | 19 +++++++++----------
panels/network/wireless-security/eap-method-ttls.c | 8 ++++----
2 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/panels/network/wireless-security/eap-method-simple.c
b/panels/network/wireless-security/eap-method-simple.c
index f47ec52e4..ff0cdfd1d 100644
--- a/panels/network/wireless-security/eap-method-simple.c
+++ b/panels/network/wireless-security/eap-method-simple.c
@@ -108,19 +108,18 @@ add_to_size_group (EAPMethod *method, GtkSizeGroup *group)
typedef struct {
const char *name;
- gboolean autheap_allowed;
} EapType;
/* 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_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 },
+ [EAP_METHOD_SIMPLE_TYPE_PAP] = { "pap" },
+ [EAP_METHOD_SIMPLE_TYPE_MSCHAP] = { "mschap" },
+ [EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2] = { "mschapv2" },
+ [EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2] = { "mschapv2" },
+ [EAP_METHOD_SIMPLE_TYPE_MD5] = { "md5" },
+ [EAP_METHOD_SIMPLE_TYPE_PWD] = { "pwd" },
+ [EAP_METHOD_SIMPLE_TYPE_CHAP] = { "chap" },
+ [EAP_METHOD_SIMPLE_TYPE_GTC] = { "gtc" },
};
static void
@@ -148,7 +147,7 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla
* supports being an inner EAP method, then set PHASE2_AUTHEAP.
* Otherwise the inner/phase2 method goes into PHASE2_AUTH.
*/
- if (self->autheap_allowed && eap_type->autheap_allowed) {
+ if (self->autheap_allowed) {
g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTHEAP, eap_type->name, NULL);
g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, NULL, NULL);
} else {
diff --git a/panels/network/wireless-security/eap-method-ttls.c
b/panels/network/wireless-security/eap-method-ttls.c
index fda38b54f..615b06d41 100644
--- a/panels/network/wireless-security/eap-method-ttls.c
+++ b/panels/network/wireless-security/eap-method-ttls.c
@@ -357,13 +357,13 @@ eap_method_ttls_new (NMConnection *connection)
self->em_pap = eap_method_simple_new (connection,
EAP_METHOD_SIMPLE_TYPE_PAP,
- TRUE, TRUE);
+ TRUE, FALSE);
gtk_widget_show (GTK_WIDGET (self->em_pap));
g_signal_connect_object (self->em_pap, "changed", G_CALLBACK (eap_method_emit_changed), self,
G_CONNECT_SWAPPED);
self->em_mschap = eap_method_simple_new (connection,
EAP_METHOD_SIMPLE_TYPE_MSCHAP,
- TRUE, TRUE);
+ TRUE, FALSE);
gtk_widget_show (GTK_WIDGET (self->em_mschap));
g_signal_connect_object (self->em_mschap, "changed", G_CALLBACK (eap_method_emit_changed), self,
G_CONNECT_SWAPPED);
@@ -375,13 +375,13 @@ eap_method_ttls_new (NMConnection *connection)
self->em_plain_mschap_v2 = eap_method_simple_new (connection,
EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2,
- TRUE, TRUE);
+ TRUE, FALSE);
gtk_widget_show (GTK_WIDGET (self->em_plain_mschap_v2));
g_signal_connect_object (self->em_plain_mschap_v2, "changed", G_CALLBACK (eap_method_emit_changed),
self, G_CONNECT_SWAPPED);
self->em_chap = eap_method_simple_new (connection,
EAP_METHOD_SIMPLE_TYPE_CHAP,
- TRUE, TRUE);
+ TRUE, FALSE);
gtk_widget_show (GTK_WIDGET (self->em_chap));
g_signal_connect_object (self->em_chap, "changed", G_CALLBACK (eap_method_emit_changed), self,
G_CONNECT_SWAPPED);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]