2012-12-09 19:38:32 -05:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
/* NetworkManager Applet -- allow user control over networking
|
|
|
|
*
|
|
|
|
* Dan Williams <dcbw@redhat.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2016-06-07 12:03:22 +02:00
|
|
|
* Copyright 2007 - 2014 Red Hat, Inc.
|
2012-12-09 19:38:32 -05:00
|
|
|
*/
|
|
|
|
|
2019-11-12 09:53:18 +13:00
|
|
|
#include <glib/gi18n.h>
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
#include "eap-method.h"
|
2019-11-07 10:10:21 +13:00
|
|
|
#include "eap-method-simple.h"
|
|
|
|
#include "eap-method-ttls.h"
|
2019-11-12 10:08:14 +13:00
|
|
|
#include "helpers.h"
|
2012-12-09 19:38:32 -05:00
|
|
|
#include "wireless-security.h"
|
|
|
|
|
2019-11-11 14:03:47 +13:00
|
|
|
#define I_NAME_COLUMN 0
|
|
|
|
#define I_ID_COLUMN 1
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
struct _EAPMethodTTLS {
|
2019-11-07 11:35:25 +13:00
|
|
|
GtkGrid parent;
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-10-15 12:25:48 +13:00
|
|
|
GtkEntry *anon_identity_entry;
|
|
|
|
GtkLabel *anon_identity_label;
|
|
|
|
GtkFileChooserButton *ca_cert_button;
|
|
|
|
GtkLabel *ca_cert_label;
|
|
|
|
GtkCheckButton *ca_cert_not_required_check;
|
|
|
|
GtkEntry *domain_match_entry;
|
|
|
|
GtkLabel *domain_match_label;
|
|
|
|
GtkComboBox *inner_auth_combo;
|
|
|
|
GtkLabel *inner_auth_label;
|
2019-11-11 14:03:47 +13:00
|
|
|
GtkListStore *inner_auth_model;
|
2019-10-15 12:25:48 +13:00
|
|
|
GtkBox *inner_auth_box;
|
|
|
|
|
2019-11-11 14:03:47 +13:00
|
|
|
EAPMethodSimple *em_chap;
|
|
|
|
EAPMethodSimple *em_gtc;
|
|
|
|
EAPMethodSimple *em_md5;
|
|
|
|
EAPMethodSimple *em_mschap;
|
|
|
|
EAPMethodSimple *em_mschap_v2;
|
|
|
|
EAPMethodSimple *em_pap;
|
|
|
|
EAPMethodSimple *em_plain_mschap_v2;
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
gboolean is_editor;
|
|
|
|
};
|
|
|
|
|
2019-11-07 10:21:54 +13:00
|
|
|
static void eap_method_iface_init (EAPMethodInterface *);
|
|
|
|
|
2019-11-07 11:35:25 +13:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (EAPMethodTTLS, eap_method_ttls, GTK_TYPE_GRID,
|
2019-11-07 10:21:54 +13:00
|
|
|
G_IMPLEMENT_INTERFACE (eap_method_get_type (), eap_method_iface_init))
|
|
|
|
|
2019-11-11 14:03:47 +13:00
|
|
|
static EAPMethod *
|
|
|
|
get_inner_method (EAPMethodTTLS *self)
|
2012-12-09 19:38:32 -05:00
|
|
|
{
|
2019-11-11 14:03:47 +13:00
|
|
|
GtkTreeIter iter;
|
|
|
|
g_autofree gchar *id = NULL;
|
|
|
|
|
|
|
|
if (!gtk_combo_box_get_active_iter (self->inner_auth_combo, &iter))
|
|
|
|
return NULL;
|
|
|
|
gtk_tree_model_get (GTK_TREE_MODEL (self->inner_auth_model), &iter, I_ID_COLUMN, &id, -1);
|
|
|
|
|
|
|
|
if (strcmp (id, "chap") == 0)
|
|
|
|
return EAP_METHOD (self->em_chap);
|
|
|
|
if (strcmp (id, "gtc") == 0)
|
|
|
|
return EAP_METHOD (self->em_gtc);
|
|
|
|
if (strcmp (id, "md5") == 0)
|
|
|
|
return EAP_METHOD (self->em_md5);
|
|
|
|
if (strcmp (id, "mschap") == 0)
|
|
|
|
return EAP_METHOD (self->em_mschap);
|
|
|
|
if (strcmp (id, "mschapv2") == 0)
|
|
|
|
return EAP_METHOD (self->em_mschap_v2);
|
|
|
|
if (strcmp (id, "pap") == 0)
|
|
|
|
return EAP_METHOD (self->em_pap);
|
|
|
|
if (strcmp (id, "plain_mschapv2") == 0)
|
|
|
|
return EAP_METHOD (self->em_plain_mschap_v2);
|
|
|
|
|
|
|
|
return NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2019-11-07 10:21:54 +13:00
|
|
|
validate (EAPMethod *method, GError **error)
|
2012-12-09 19:38:32 -05:00
|
|
|
{
|
2019-11-07 10:21:54 +13:00
|
|
|
EAPMethodTTLS *self = EAP_METHOD_TTLS (method);
|
2019-09-12 10:54:37 +12:00
|
|
|
g_autoptr(GError) local_error = NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-10-15 12:25:48 +13:00
|
|
|
if (!eap_method_validate_filepicker (GTK_FILE_CHOOSER (self->ca_cert_button),
|
2019-10-02 11:00:21 +13:00
|
|
|
TYPE_CA_CERT, NULL, NULL, &local_error)) {
|
2019-09-12 10:54:37 +12:00
|
|
|
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TTLS CA certificate: %s"), local_error->message);
|
2012-12-09 19:38:32 -05:00
|
|
|
return FALSE;
|
2016-06-07 12:03:22 +02:00
|
|
|
}
|
2019-10-15 12:25:48 +13:00
|
|
|
if (eap_method_ca_cert_required (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check),
|
|
|
|
GTK_FILE_CHOOSER (self->ca_cert_button))) {
|
2016-06-07 12:03:22 +02:00
|
|
|
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid EAP-TTLS CA certificate: no certificate specified"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-11-11 14:03:47 +13:00
|
|
|
return eap_method_validate (get_inner_method (self), error);
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
2016-06-07 12:03:22 +02:00
|
|
|
static void
|
2019-10-15 11:15:30 +13:00
|
|
|
ca_cert_not_required_toggled (EAPMethodTTLS *self)
|
2016-06-07 12:03:22 +02:00
|
|
|
{
|
2019-10-15 12:25:48 +13:00
|
|
|
eap_method_ca_cert_not_required_toggled (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check),
|
|
|
|
GTK_FILE_CHOOSER (self->ca_cert_button));
|
2019-11-12 11:20:40 +13:00
|
|
|
eap_method_emit_changed (EAP_METHOD (self));
|
2016-06-07 12:03:22 +02:00
|
|
|
}
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
static void
|
2019-11-07 10:21:54 +13:00
|
|
|
add_to_size_group (EAPMethod *method, GtkSizeGroup *group)
|
2012-12-09 19:38:32 -05:00
|
|
|
{
|
2019-11-07 10:21:54 +13:00
|
|
|
EAPMethodTTLS *self = EAP_METHOD_TTLS (method);
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-10-18 11:47:17 +13:00
|
|
|
gtk_size_group_add_widget (group, GTK_WIDGET (self->ca_cert_not_required_check));
|
|
|
|
gtk_size_group_add_widget (group, GTK_WIDGET (self->anon_identity_label));
|
|
|
|
gtk_size_group_add_widget (group, GTK_WIDGET (self->domain_match_label));
|
|
|
|
gtk_size_group_add_widget (group, GTK_WIDGET (self->ca_cert_label));
|
|
|
|
gtk_size_group_add_widget (group, GTK_WIDGET (self->inner_auth_label));
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-11-11 14:03:47 +13:00
|
|
|
eap_method_add_to_size_group (EAP_METHOD (self->em_chap), group);
|
|
|
|
eap_method_add_to_size_group (EAP_METHOD (self->em_gtc), group);
|
|
|
|
eap_method_add_to_size_group (EAP_METHOD (self->em_md5), group);
|
|
|
|
eap_method_add_to_size_group (EAP_METHOD (self->em_mschap), group);
|
|
|
|
eap_method_add_to_size_group (EAP_METHOD (self->em_mschap_v2), group);
|
|
|
|
eap_method_add_to_size_group (EAP_METHOD (self->em_pap), group);
|
|
|
|
eap_method_add_to_size_group (EAP_METHOD (self->em_plain_mschap_v2), group);
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-11-07 10:21:54 +13:00
|
|
|
fill_connection (EAPMethod *method, NMConnection *connection, NMSettingSecretFlags flags)
|
2012-12-09 19:38:32 -05:00
|
|
|
{
|
2019-11-07 10:21:54 +13:00
|
|
|
EAPMethodTTLS *self = EAP_METHOD_TTLS (method);
|
2012-12-09 19:38:32 -05:00
|
|
|
NMSetting8021x *s_8021x;
|
|
|
|
NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
|
|
|
|
const char *text;
|
2019-09-12 11:40:48 +12:00
|
|
|
g_autofree gchar *filename = NULL;
|
2019-09-12 10:54:37 +12:00
|
|
|
g_autoptr(GError) error = NULL;
|
2016-06-07 12:03:22 +02:00
|
|
|
gboolean ca_cert_error = FALSE;
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
s_8021x = nm_connection_get_setting_802_1x (connection);
|
|
|
|
g_assert (s_8021x);
|
|
|
|
|
|
|
|
nm_setting_802_1x_add_eap_method (s_8021x, "ttls");
|
|
|
|
|
2019-10-15 12:25:48 +13:00
|
|
|
text = gtk_entry_get_text (self->anon_identity_entry);
|
2012-12-09 19:38:32 -05:00
|
|
|
if (text && strlen (text))
|
|
|
|
g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, text, NULL);
|
|
|
|
|
2019-10-15 12:25:48 +13:00
|
|
|
text = gtk_entry_get_text (self->domain_match_entry);
|
2018-12-29 19:51:46 +01:00
|
|
|
if (text && strlen (text))
|
|
|
|
g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, text, NULL);
|
|
|
|
|
2019-10-15 12:25:48 +13:00
|
|
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button));
|
2012-12-09 19:38:32 -05:00
|
|
|
if (!nm_setting_802_1x_set_ca_cert (s_8021x, filename, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error)) {
|
|
|
|
g_warning ("Couldn't read CA certificate '%s': %s", filename, error ? error->message : "(unknown)");
|
2016-06-07 12:03:22 +02:00
|
|
|
ca_cert_error = TRUE;
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
2019-11-07 10:21:54 +13:00
|
|
|
eap_method_ca_cert_ignore_set (method, connection, filename, ca_cert_error);
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-11-11 14:03:47 +13:00
|
|
|
eap_method_fill_connection (get_inner_method (self), connection, flags);
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-10-15 11:15:30 +13:00
|
|
|
inner_auth_combo_changed_cb (EAPMethodTTLS *self)
|
2012-12-09 19:38:32 -05:00
|
|
|
{
|
2019-11-11 14:03:47 +13:00
|
|
|
EAPMethod *inner_method;
|
2012-12-09 19:38:32 -05:00
|
|
|
GList *elt, *children;
|
|
|
|
|
2019-10-15 12:25:48 +13:00
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (self->inner_auth_box));
|
2012-12-09 19:38:32 -05:00
|
|
|
for (elt = children; elt; elt = g_list_next (elt))
|
2019-10-15 12:25:48 +13:00
|
|
|
gtk_container_remove (GTK_CONTAINER (self->inner_auth_box), GTK_WIDGET (elt->data));
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-11-11 14:03:47 +13:00
|
|
|
inner_method = get_inner_method (self);
|
|
|
|
gtk_container_add (GTK_CONTAINER (self->inner_auth_box), g_object_ref (GTK_WIDGET (inner_method)));
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-11-12 11:20:40 +13:00
|
|
|
eap_method_emit_changed (EAP_METHOD (self));
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-11-07 10:21:54 +13:00
|
|
|
update_secrets (EAPMethod *method, NMConnection *connection)
|
2012-12-09 19:38:32 -05:00
|
|
|
{
|
2019-11-07 10:21:54 +13:00
|
|
|
EAPMethodTTLS *self = EAP_METHOD_TTLS (method);
|
2019-11-11 12:00:49 +13:00
|
|
|
|
2019-11-11 14:03:47 +13:00
|
|
|
eap_method_update_secrets (EAP_METHOD (self->em_chap), connection);
|
|
|
|
eap_method_update_secrets (EAP_METHOD (self->em_gtc), connection);
|
|
|
|
eap_method_update_secrets (EAP_METHOD (self->em_md5), connection);
|
|
|
|
eap_method_update_secrets (EAP_METHOD (self->em_mschap), connection);
|
|
|
|
eap_method_update_secrets (EAP_METHOD (self->em_mschap_v2), connection);
|
|
|
|
eap_method_update_secrets (EAP_METHOD (self->em_pap), connection);
|
|
|
|
eap_method_update_secrets (EAP_METHOD (self->em_plain_mschap_v2), connection);
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
2019-11-07 09:09:02 +13:00
|
|
|
static GtkWidget *
|
2019-11-07 10:21:54 +13:00
|
|
|
get_default_field (EAPMethod *method)
|
2019-11-07 09:09:02 +13:00
|
|
|
{
|
2019-11-07 10:21:54 +13:00
|
|
|
EAPMethodTTLS *self = EAP_METHOD_TTLS (method);
|
2019-11-07 09:09:02 +13:00
|
|
|
return GTK_WIDGET (self->anon_identity_entry);
|
|
|
|
}
|
|
|
|
|
2019-11-07 10:03:25 +13:00
|
|
|
static const gchar *
|
2019-11-07 10:21:54 +13:00
|
|
|
get_password_flags_name (EAPMethod *method)
|
2019-11-07 10:03:25 +13:00
|
|
|
{
|
|
|
|
return NM_SETTING_802_1X_PASSWORD;
|
|
|
|
}
|
|
|
|
|
2019-10-15 10:33:17 +13:00
|
|
|
static void
|
|
|
|
changed_cb (EAPMethodTTLS *self)
|
|
|
|
{
|
2019-11-12 11:20:40 +13:00
|
|
|
eap_method_emit_changed (EAP_METHOD (self));
|
2019-10-15 10:33:17 +13:00
|
|
|
}
|
|
|
|
|
2019-11-07 10:21:54 +13:00
|
|
|
static void
|
|
|
|
eap_method_ttls_init (EAPMethodTTLS *self)
|
|
|
|
{
|
2019-11-07 11:35:25 +13:00
|
|
|
gtk_widget_init_template (GTK_WIDGET (self));
|
2019-11-07 10:21:54 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
eap_method_ttls_class_init (EAPMethodTTLSClass *klass)
|
|
|
|
{
|
2019-11-07 11:35:25 +13:00
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
2019-11-07 10:21:54 +13:00
|
|
|
|
2019-11-07 11:35:25 +13:00
|
|
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/ControlCenter/network/eap-method-ttls.ui");
|
|
|
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, anon_identity_entry);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, anon_identity_label);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, ca_cert_button);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, ca_cert_label);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, ca_cert_not_required_check);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, domain_match_entry);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, domain_match_label);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, inner_auth_combo);
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, inner_auth_label);
|
2019-11-11 14:03:47 +13:00
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, inner_auth_model);
|
2019-11-07 11:35:25 +13:00
|
|
|
gtk_widget_class_bind_template_child (widget_class, EAPMethodTTLS, inner_auth_box);
|
2019-11-07 10:21:54 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
eap_method_iface_init (EAPMethodInterface *iface)
|
|
|
|
{
|
|
|
|
iface->validate = validate;
|
|
|
|
iface->add_to_size_group = add_to_size_group;
|
|
|
|
iface->fill_connection = fill_connection;
|
|
|
|
iface->update_secrets = update_secrets;
|
|
|
|
iface->get_default_field = get_default_field;
|
|
|
|
iface->get_password_flags_name = get_password_flags_name;
|
|
|
|
}
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
EAPMethodTTLS *
|
|
|
|
eap_method_ttls_new (WirelessSecurity *ws_parent,
|
|
|
|
NMConnection *connection,
|
|
|
|
gboolean is_editor,
|
|
|
|
gboolean secrets_only)
|
|
|
|
{
|
2019-10-18 11:47:17 +13:00
|
|
|
EAPMethodTTLS *self;
|
2012-12-09 19:38:32 -05:00
|
|
|
GtkFileFilter *filter;
|
|
|
|
NMSetting8021x *s_8021x = NULL;
|
|
|
|
const char *filename;
|
2019-11-11 14:03:47 +13:00
|
|
|
EAPMethodSimpleFlags simple_flags;
|
|
|
|
const char *phase2_auth = NULL;
|
|
|
|
GtkTreeIter iter;
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-11-07 10:21:54 +13:00
|
|
|
self = g_object_new (eap_method_ttls_get_type (), NULL);
|
2019-10-18 11:47:17 +13:00
|
|
|
self->is_editor = is_editor;
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
if (connection)
|
|
|
|
s_8021x = nm_connection_get_setting_802_1x (connection);
|
|
|
|
|
2019-10-18 11:47:17 +13:00
|
|
|
g_signal_connect_swapped (self->ca_cert_not_required_check, "toggled", G_CALLBACK (ca_cert_not_required_toggled), self);
|
2016-06-07 12:03:22 +02:00
|
|
|
|
2019-10-18 11:47:17 +13:00
|
|
|
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (self->ca_cert_button), TRUE);
|
|
|
|
gtk_file_chooser_button_set_title (self->ca_cert_button,
|
2014-07-24 13:19:09 +02:00
|
|
|
_("Choose a Certificate Authority certificate"));
|
2019-10-18 11:47:17 +13:00
|
|
|
g_signal_connect_swapped (self->ca_cert_button, "selection-changed", G_CALLBACK (changed_cb), self);
|
2012-12-09 19:38:32 -05:00
|
|
|
filter = eap_method_default_file_chooser_filter_new (FALSE);
|
2019-10-18 11:47:17 +13:00
|
|
|
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->ca_cert_button), filter);
|
2012-12-09 19:38:32 -05:00
|
|
|
if (connection && s_8021x) {
|
2016-06-07 12:03:22 +02:00
|
|
|
filename = NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
if (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) {
|
|
|
|
filename = nm_setting_802_1x_get_ca_cert_path (s_8021x);
|
|
|
|
if (filename)
|
2019-10-18 11:47:17 +13:00
|
|
|
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (self->ca_cert_button), filename);
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
2019-10-18 11:47:17 +13:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check),
|
2019-11-07 10:21:54 +13:00
|
|
|
!filename && eap_method_ca_cert_ignore_get (EAP_METHOD (self), connection));
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x))
|
2019-10-18 11:47:17 +13:00
|
|
|
gtk_entry_set_text (self->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity (s_8021x));
|
|
|
|
g_signal_connect_swapped (self->anon_identity_entry, "changed", G_CALLBACK (changed_cb), self);
|
2018-12-29 19:51:46 +01:00
|
|
|
if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x))
|
2019-10-18 11:47:17 +13:00
|
|
|
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);
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-11-11 14:03:47 +13:00
|
|
|
simple_flags = EAP_METHOD_SIMPLE_FLAG_PHASE2 | EAP_METHOD_SIMPLE_FLAG_AUTHEAP_ALLOWED;
|
|
|
|
if (self->is_editor)
|
|
|
|
simple_flags |= EAP_METHOD_SIMPLE_FLAG_IS_EDITOR;
|
|
|
|
if (secrets_only)
|
|
|
|
simple_flags |= EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY;
|
|
|
|
|
2019-11-12 11:20:40 +13:00
|
|
|
self->em_pap = eap_method_simple_new (ws_parent,
|
2019-11-11 14:03:47 +13:00
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_PAP,
|
|
|
|
simple_flags);
|
|
|
|
gtk_widget_show (GTK_WIDGET (self->em_pap));
|
2019-11-12 11:20:40 +13:00
|
|
|
g_signal_connect_object (self->em_pap, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED);
|
2019-11-11 14:03:47 +13:00
|
|
|
|
2019-11-12 11:20:40 +13:00
|
|
|
self->em_mschap = eap_method_simple_new (ws_parent,
|
2019-11-11 14:03:47 +13:00
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_MSCHAP,
|
|
|
|
simple_flags);
|
|
|
|
gtk_widget_show (GTK_WIDGET (self->em_mschap));
|
2019-11-12 11:20:40 +13:00
|
|
|
g_signal_connect_object (self->em_mschap, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED);
|
2019-11-11 14:03:47 +13:00
|
|
|
|
2019-11-12 11:20:40 +13:00
|
|
|
self->em_mschap_v2 = eap_method_simple_new (ws_parent,
|
2019-11-11 14:03:47 +13:00
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
|
|
|
|
simple_flags);
|
|
|
|
gtk_widget_show (GTK_WIDGET (self->em_mschap_v2));
|
2019-11-12 11:20:40 +13:00
|
|
|
g_signal_connect_object (self->em_mschap_v2, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED);
|
2019-11-11 14:03:47 +13:00
|
|
|
|
2019-11-12 11:20:40 +13:00
|
|
|
self->em_plain_mschap_v2 = eap_method_simple_new (ws_parent,
|
2019-11-11 14:03:47 +13:00
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2,
|
|
|
|
simple_flags);
|
|
|
|
gtk_widget_show (GTK_WIDGET (self->em_plain_mschap_v2));
|
2019-11-12 11:20:40 +13:00
|
|
|
g_signal_connect_object (self->em_plain_mschap_v2, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED);
|
2019-11-11 14:03:47 +13:00
|
|
|
|
2019-11-12 11:20:40 +13:00
|
|
|
self->em_chap = eap_method_simple_new (ws_parent,
|
2019-11-11 14:03:47 +13:00
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_CHAP,
|
|
|
|
simple_flags);
|
|
|
|
gtk_widget_show (GTK_WIDGET (self->em_chap));
|
2019-11-12 11:20:40 +13:00
|
|
|
g_signal_connect_object (self->em_chap, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED);
|
2019-11-11 14:03:47 +13:00
|
|
|
|
2019-11-12 11:20:40 +13:00
|
|
|
self->em_md5 = eap_method_simple_new (ws_parent,
|
2019-11-11 14:03:47 +13:00
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_MD5,
|
|
|
|
simple_flags);
|
|
|
|
gtk_widget_show (GTK_WIDGET (self->em_md5));
|
2019-11-12 11:20:40 +13:00
|
|
|
g_signal_connect_object (self->em_md5, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED);
|
2019-11-11 14:03:47 +13:00
|
|
|
|
2019-11-12 11:20:40 +13:00
|
|
|
self->em_gtc = eap_method_simple_new (ws_parent,
|
2019-11-11 14:03:47 +13:00
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_GTC,
|
|
|
|
simple_flags);
|
|
|
|
gtk_widget_show (GTK_WIDGET (self->em_gtc));
|
2019-11-12 11:20:40 +13:00
|
|
|
g_signal_connect_object (self->em_gtc, "changed", G_CALLBACK (eap_method_emit_changed), self, G_CONNECT_SWAPPED);
|
2019-11-11 14:03:47 +13:00
|
|
|
|
|
|
|
if (s_8021x) {
|
|
|
|
if (nm_setting_802_1x_get_phase2_auth (s_8021x))
|
|
|
|
phase2_auth = nm_setting_802_1x_get_phase2_auth (s_8021x);
|
|
|
|
else if (nm_setting_802_1x_get_phase2_autheap (s_8021x))
|
|
|
|
phase2_auth = nm_setting_802_1x_get_phase2_autheap (s_8021x);
|
|
|
|
}
|
|
|
|
if (phase2_auth == NULL)
|
|
|
|
phase2_auth = "pap";
|
|
|
|
|
|
|
|
if (strcmp (phase2_auth, "mschapv2") == 0 && nm_setting_802_1x_get_phase2_auth (s_8021x) != NULL)
|
|
|
|
phase2_auth = "plain_mschapv2";
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->inner_auth_model), &iter)) {
|
|
|
|
do {
|
|
|
|
g_autofree gchar *id = NULL;
|
|
|
|
gtk_tree_model_get (GTK_TREE_MODEL (self->inner_auth_model), &iter, I_ID_COLUMN, &id, -1);
|
|
|
|
if (strcmp (id, phase2_auth) == 0)
|
|
|
|
gtk_combo_box_set_active_iter (self->inner_auth_combo, &iter);
|
|
|
|
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (self->inner_auth_model), &iter));
|
|
|
|
}
|
|
|
|
|
|
|
|
g_signal_connect_swapped (self->inner_auth_combo, "changed", G_CALLBACK (inner_auth_combo_changed_cb), self);
|
2019-10-18 11:47:17 +13:00
|
|
|
inner_auth_combo_changed_cb (self);
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
if (secrets_only) {
|
2019-10-18 11:47:17 +13:00
|
|
|
gtk_widget_hide (GTK_WIDGET (self->anon_identity_label));
|
|
|
|
gtk_widget_hide (GTK_WIDGET (self->anon_identity_entry));
|
|
|
|
gtk_widget_hide (GTK_WIDGET (self->domain_match_label));
|
|
|
|
gtk_widget_hide (GTK_WIDGET (self->domain_match_entry));
|
|
|
|
gtk_widget_hide (GTK_WIDGET (self->ca_cert_label));
|
|
|
|
gtk_widget_hide (GTK_WIDGET (self->ca_cert_button));
|
|
|
|
gtk_widget_hide (GTK_WIDGET (self->ca_cert_not_required_check));
|
|
|
|
gtk_widget_hide (GTK_WIDGET (self->inner_auth_label));
|
|
|
|
gtk_widget_hide (GTK_WIDGET (self->inner_auth_combo));
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
2019-10-18 11:47:17 +13:00
|
|
|
return self;
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|