diff options
7 files changed, 24 insertions, 65 deletions
diff --git a/panels/network/wireless-security/eap-method-fast.c b/panels/network/wireless-security/eap-method-fast.c index b6920babd..ecd1fb985 100644 --- a/panels/network/wireless-security/eap-method-fast.c +++ b/panels/network/wireless-security/eap-method-fast.c @@ -362,15 +362,11 @@ eap_method_fast_new (NMConnection *connection) gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (self->pac_file_button), filename); } - self->em_gtc = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_GTC, - TRUE, FALSE); + self->em_gtc = eap_method_simple_new (connection, "gtc", TRUE, FALSE); gtk_widget_show (GTK_WIDGET (self->em_gtc)); g_signal_connect_object (self->em_gtc, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED); - self->em_mschap_v2 = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2, - TRUE, FALSE); + self->em_mschap_v2 = eap_method_simple_new (connection, "mschapv2", TRUE, FALSE); gtk_widget_show (GTK_WIDGET (self->em_mschap_v2)); g_signal_connect_object (self->em_mschap_v2, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED); diff --git a/panels/network/wireless-security/eap-method-peap.c b/panels/network/wireless-security/eap-method-peap.c index 00a0c3be1..08997cde3 100644 --- a/panels/network/wireless-security/eap-method-peap.c +++ b/panels/network/wireless-security/eap-method-peap.c @@ -340,21 +340,15 @@ eap_method_peap_new (NMConnection *connection) !filename && eap_method_ca_cert_ignore_get (EAP_METHOD (self), connection)); } - self->em_mschap_v2 = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2, - TRUE, FALSE); + self->em_mschap_v2 = eap_method_simple_new (connection, "mschapv2", TRUE, FALSE); gtk_widget_show (GTK_WIDGET (self->em_mschap_v2)); g_signal_connect_object (self->em_mschap_v2, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED); - self->em_md5 = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_MD5, - TRUE, FALSE); + self->em_md5 = eap_method_simple_new (connection, "md5", TRUE, FALSE); gtk_widget_show (GTK_WIDGET (self->em_md5)); g_signal_connect_object (self->em_md5, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED); - self->em_gtc = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_GTC, - TRUE, FALSE); + self->em_gtc = eap_method_simple_new (connection, "gtc", TRUE, FALSE); gtk_widget_show (GTK_WIDGET (self->em_gtc)); g_signal_connect_object (self->em_gtc, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED); diff --git a/panels/network/wireless-security/eap-method-simple.c b/panels/network/wireless-security/eap-method-simple.c index ff0cdfd1d..bb405a48b 100644 --- a/panels/network/wireless-security/eap-method-simple.c +++ b/panels/network/wireless-security/eap-method-simple.c @@ -37,7 +37,7 @@ struct _EAPMethodSimple { GtkEntry *username_entry; GtkLabel *username_label; - EAPMethodSimpleType type; + gchar *name; gboolean phase2; gboolean autheap_allowed; @@ -106,22 +106,6 @@ add_to_size_group (EAPMethod *method, GtkSizeGroup *group) gtk_size_group_add_widget (group, GTK_WIDGET (self->password_label)); } -typedef struct { - const char *name; -} EapType; - -/* Indexed by EAP_METHOD_SIMPLE_TYPE_* */ -static const EapType eap_table[EAP_METHOD_SIMPLE_TYPE_LAST] = { - [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 fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFlags prev_flags) { @@ -129,7 +113,6 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla NMSetting8021x *s_8021x; gboolean not_saved = FALSE; NMSettingSecretFlags flags; - const EapType *eap_type; s_8021x = nm_connection_get_setting_802_1x (connection); g_assert (s_8021x); @@ -140,7 +123,6 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla if (eap_method_get_phase2 (method) == FALSE) nm_setting_802_1x_clear_eap_methods (s_8021x); - eap_type = &eap_table[self->type]; if (eap_method_get_phase2 (method)) { /* If the outer EAP method (TLS, TTLS, PEAP, etc) allows inner/phase2 * EAP methods (which only TTLS allows) *and* the inner/phase2 method @@ -148,14 +130,14 @@ fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFla * Otherwise the inner/phase2 method goes into PHASE2_AUTH. */ 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_AUTHEAP, self->name, NULL); g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, NULL, NULL); } else { - g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, eap_type->name, NULL); + g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, self->name, NULL); g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTHEAP, NULL, NULL); } } else - nm_setting_802_1x_add_eap_method (s_8021x, eap_type->name); + nm_setting_802_1x_add_eap_method (s_8021x, self->name); g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (self->username_entry), NULL); @@ -281,6 +263,8 @@ eap_method_simple_dispose (GObject *object) { EAPMethodSimple *self = EAP_METHOD_SIMPLE (object); + g_clear_pointer (&self->name, g_free); + g_signal_handlers_disconnect_by_data (self, self); g_signal_handlers_disconnect_by_data (self->password_entry, self); g_signal_handlers_disconnect_by_data (self->show_password_check, self); @@ -341,16 +325,15 @@ eap_method_iface_init (EAPMethodInterface *iface) } EAPMethodSimple * -eap_method_simple_new (NMConnection *connection, EAPMethodSimpleType type, gboolean phase2, gboolean autheap_allowed) +eap_method_simple_new (NMConnection *connection, const gchar *name, gboolean phase2, gboolean autheap_allowed) { EAPMethodSimple *self; NMSetting8021x *s_8021x = NULL; self = g_object_new (eap_method_simple_get_type (), NULL); - self->type = type; + self->name = g_strdup (name); self->phase2 = phase2; self->autheap_allowed = autheap_allowed; - g_assert (type < EAP_METHOD_SIMPLE_TYPE_LAST); g_signal_connect_swapped (self->username_entry, "changed", G_CALLBACK (changed_cb), self); diff --git a/panels/network/wireless-security/eap-method-simple.h b/panels/network/wireless-security/eap-method-simple.h index d9583c118..8645fb142 100644 --- a/panels/network/wireless-security/eap-method-simple.h +++ b/panels/network/wireless-security/eap-method-simple.h @@ -45,7 +45,7 @@ typedef enum { } EAPMethodSimpleType; EAPMethodSimple *eap_method_simple_new (NMConnection *connection, - EAPMethodSimpleType type, + const gchar *name, gboolean phase2, gboolean autheap_allowed); diff --git a/panels/network/wireless-security/eap-method-ttls.c b/panels/network/wireless-security/eap-method-ttls.c index 615b06d41..fc7cd603a 100644 --- a/panels/network/wireless-security/eap-method-ttls.c +++ b/panels/network/wireless-security/eap-method-ttls.c @@ -355,45 +355,31 @@ eap_method_ttls_new (NMConnection *connection) gtk_entry_set_text (self->domain_match_entry, nm_setting_802_1x_get_domain_suffix_match (s_8021x)); g_signal_connect_swapped (self->domain_match_entry, "changed", G_CALLBACK (changed_cb), self); - self->em_pap = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_PAP, - TRUE, FALSE); + self->em_pap = eap_method_simple_new (connection, "pap", 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, FALSE); + self->em_mschap = eap_method_simple_new (connection, "mschap", 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); - self->em_mschap_v2 = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2, - TRUE, TRUE); + self->em_mschap_v2 = eap_method_simple_new (connection, "mschapv2", TRUE, TRUE); gtk_widget_show (GTK_WIDGET (self->em_mschap_v2)); g_signal_connect_object (self->em_mschap_v2, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED); - self->em_plain_mschap_v2 = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2, - TRUE, FALSE); + self->em_plain_mschap_v2 = eap_method_simple_new (connection, "mschapv2", 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, FALSE); + self->em_chap = eap_method_simple_new (connection, "chap", 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); - self->em_md5 = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_MD5, - TRUE, TRUE); + self->em_md5 = eap_method_simple_new (connection, "md5", TRUE, TRUE); gtk_widget_show (GTK_WIDGET (self->em_md5)); g_signal_connect_object (self->em_md5, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED); - self->em_gtc = eap_method_simple_new (connection, - EAP_METHOD_SIMPLE_TYPE_GTC, - TRUE, TRUE); + self->em_gtc = eap_method_simple_new (connection, "gtc", TRUE, TRUE); gtk_widget_show (GTK_WIDGET (self->em_gtc)); g_signal_connect_object (self->em_gtc, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED); diff --git a/panels/network/wireless-security/ws-dynamic-wep.c b/panels/network/wireless-security/ws-dynamic-wep.c index 88f505257..91207ef46 100644 --- a/panels/network/wireless-security/ws-dynamic-wep.c +++ b/panels/network/wireless-security/ws-dynamic-wep.c @@ -222,7 +222,7 @@ ws_dynamic_wep_new (NMConnection *connection) self->em_leap = eap_method_leap_new (connection); gtk_widget_show (GTK_WIDGET (self->em_leap)); g_signal_connect_object (self->em_leap, "changed", G_CALLBACK (wireless_security_notify_changed), self, G_CONNECT_SWAPPED); - self->em_pwd = eap_method_simple_new (connection, EAP_METHOD_SIMPLE_TYPE_PWD, FALSE, FALSE); + self->em_pwd = eap_method_simple_new (connection, "pwd", FALSE, FALSE); gtk_widget_show (GTK_WIDGET (self->em_pwd)); g_signal_connect_object (self->em_pwd, "changed", G_CALLBACK (wireless_security_notify_changed), self, G_CONNECT_SWAPPED); self->em_fast = eap_method_fast_new (connection); diff --git a/panels/network/wireless-security/ws-wpa-eap.c b/panels/network/wireless-security/ws-wpa-eap.c index 13de8de1c..fa8f2f2c1 100644 --- a/panels/network/wireless-security/ws-wpa-eap.c +++ b/panels/network/wireless-security/ws-wpa-eap.c @@ -249,7 +249,7 @@ ws_wpa_eap_new (NMConnection *connection) default_method = "tls"; } - self->em_md5 = eap_method_simple_new (connection, EAP_METHOD_SIMPLE_TYPE_MD5, FALSE, FALSE); + self->em_md5 = eap_method_simple_new (connection, "md5", FALSE, FALSE); gtk_widget_show (GTK_WIDGET (self->em_md5)); g_signal_connect_object (self->em_md5, "changed", G_CALLBACK (wireless_security_notify_changed), self, G_CONNECT_SWAPPED); self->em_tls = eap_method_tls_new (connection); @@ -258,7 +258,7 @@ ws_wpa_eap_new (NMConnection *connection) self->em_leap = eap_method_leap_new (connection); gtk_widget_show (GTK_WIDGET (self->em_leap)); g_signal_connect_object (self->em_leap, "changed", G_CALLBACK (wireless_security_notify_changed), self, G_CONNECT_SWAPPED); - self->em_pwd = eap_method_simple_new (connection, EAP_METHOD_SIMPLE_TYPE_PWD, FALSE, FALSE); + self->em_pwd = eap_method_simple_new (connection, "pwd", FALSE, FALSE); gtk_widget_show (GTK_WIDGET (self->em_pwd)); g_signal_connect_object (self->em_pwd, "changed", G_CALLBACK (wireless_security_notify_changed), self, G_CONNECT_SWAPPED); self->em_fast = eap_method_fast_new (connection); |