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
|
|
|
*/
|
|
|
|
|
2016-06-07 12:03:22 +02:00
|
|
|
#include "nm-default.h"
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "eap-method.h"
|
|
|
|
#include "wireless-security.h"
|
2016-06-07 12:03:22 +02:00
|
|
|
#include "utils.h"
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
#define I_NAME_COLUMN 0
|
|
|
|
#define I_METHOD_COLUMN 1
|
|
|
|
|
|
|
|
struct _EAPMethodTTLS {
|
|
|
|
EAPMethod parent;
|
|
|
|
|
|
|
|
GtkSizeGroup *size_group;
|
|
|
|
WirelessSecurity *sec_parent;
|
|
|
|
gboolean is_editor;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
destroy (EAPMethod *parent)
|
|
|
|
{
|
|
|
|
EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
|
|
|
|
|
|
|
|
if (method->size_group)
|
|
|
|
g_object_unref (method->size_group);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2016-06-07 12:03:22 +02:00
|
|
|
validate (EAPMethod *parent, GError **error)
|
2012-12-09 19:38:32 -05:00
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
2019-09-12 11:53:42 +12:00
|
|
|
g_autoptr(EAPMethod) eap = NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
gboolean valid = FALSE;
|
2019-09-12 10:54:37 +12:00
|
|
|
g_autoptr(GError) local_error = NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2019-10-02 11:00:21 +13:00
|
|
|
if (!eap_method_validate_filepicker (GTK_FILE_CHOOSER (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_button")),
|
|
|
|
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-02 11:00:21 +13:00
|
|
|
if (eap_method_ca_cert_required (GTK_TOGGLE_BUTTON (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_not_required_checkbox")),
|
|
|
|
GTK_FILE_CHOOSER (gtk_builder_get_object (parent->builder, "eap_ttls_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
|
|
|
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
|
|
|
|
g_assert (widget);
|
|
|
|
|
|
|
|
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
|
|
|
|
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
|
|
|
|
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
|
|
|
|
g_assert (eap);
|
2016-06-07 12:03:22 +02:00
|
|
|
valid = eap_method_validate (eap, error);
|
2012-12-09 19:38:32 -05:00
|
|
|
return valid;
|
|
|
|
}
|
|
|
|
|
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 11:15:30 +13:00
|
|
|
EAPMethod *parent = (EAPMethod *) self;
|
2019-10-02 11:00:21 +13:00
|
|
|
eap_method_ca_cert_not_required_toggled (GTK_TOGGLE_BUTTON (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_not_required_checkbox")),
|
|
|
|
GTK_FILE_CHOOSER (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_button")));
|
2016-06-07 12:03:22 +02:00
|
|
|
}
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
static void
|
|
|
|
add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
|
|
|
|
{
|
|
|
|
EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
2019-09-12 11:53:42 +12:00
|
|
|
g_autoptr(EAPMethod) eap = NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
if (method->size_group)
|
|
|
|
g_object_unref (method->size_group);
|
|
|
|
method->size_group = g_object_ref (group);
|
|
|
|
|
2016-06-07 12:03:22 +02:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_not_required_checkbox"));
|
|
|
|
g_assert (widget);
|
|
|
|
gtk_size_group_add_widget (group, widget);
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_anon_identity_label"));
|
|
|
|
g_assert (widget);
|
|
|
|
gtk_size_group_add_widget (group, widget);
|
|
|
|
|
2018-12-29 19:51:46 +01:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_match_label"));
|
|
|
|
g_assert (widget);
|
|
|
|
gtk_size_group_add_widget (group, widget);
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_label"));
|
|
|
|
g_assert (widget);
|
|
|
|
gtk_size_group_add_widget (group, widget);
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_label"));
|
|
|
|
g_assert (widget);
|
|
|
|
gtk_size_group_add_widget (group, widget);
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
|
|
|
|
g_assert (widget);
|
|
|
|
|
|
|
|
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
|
|
|
|
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
|
|
|
|
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
|
|
|
|
g_assert (eap);
|
|
|
|
eap_method_add_to_size_group (eap, group);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-06-07 12:03:22 +02:00
|
|
|
fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFlags flags)
|
2012-12-09 19:38:32 -05:00
|
|
|
{
|
|
|
|
NMSetting8021x *s_8021x;
|
|
|
|
NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
|
|
|
|
GtkWidget *widget;
|
|
|
|
const char *text;
|
2019-09-12 11:40:48 +12:00
|
|
|
g_autofree gchar *filename = NULL;
|
2019-09-12 11:53:42 +12:00
|
|
|
g_autoptr(EAPMethod) eap = NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
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");
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_anon_identity_entry"));
|
|
|
|
g_assert (widget);
|
|
|
|
text = gtk_entry_get_text (GTK_ENTRY (widget));
|
|
|
|
if (text && strlen (text))
|
|
|
|
g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, text, NULL);
|
|
|
|
|
2018-12-29 19:51:46 +01:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_match_entry"));
|
|
|
|
g_assert (widget);
|
|
|
|
text = gtk_entry_get_text (GTK_ENTRY (widget));
|
|
|
|
if (text && strlen (text))
|
|
|
|
g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, text, NULL);
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_button"));
|
|
|
|
g_assert (widget);
|
|
|
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
|
|
|
|
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
|
|
|
}
|
2016-06-07 12:03:22 +02:00
|
|
|
eap_method_ca_cert_ignore_set (parent, connection, filename, ca_cert_error);
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
|
|
|
|
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
|
|
|
|
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
|
|
|
|
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
|
|
|
|
g_assert (eap);
|
|
|
|
|
2016-06-07 12:03:22 +02:00
|
|
|
eap_method_fill_connection (eap, 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-10-15 11:15:30 +13:00
|
|
|
EAPMethod *parent = (EAPMethod *) self;
|
|
|
|
GtkWidget *combo, *vbox;
|
2019-09-12 11:53:42 +12:00
|
|
|
g_autoptr(EAPMethod) eap = NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
GList *elt, *children;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkWidget *eap_widget;
|
|
|
|
|
2019-10-15 11:15:30 +13:00
|
|
|
combo = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
|
2012-12-09 19:38:32 -05:00
|
|
|
vbox = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_vbox"));
|
|
|
|
g_assert (vbox);
|
|
|
|
|
|
|
|
/* Remove any previous wireless security widgets */
|
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (vbox));
|
|
|
|
for (elt = children; elt; elt = g_list_next (elt))
|
|
|
|
gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (elt->data));
|
|
|
|
g_list_free (children);
|
|
|
|
|
|
|
|
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
|
|
|
|
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter);
|
|
|
|
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
|
|
|
|
g_assert (eap);
|
|
|
|
|
|
|
|
eap_widget = eap_method_get_widget (eap);
|
|
|
|
g_assert (eap_widget);
|
|
|
|
gtk_widget_unparent (eap_widget);
|
|
|
|
|
2019-10-15 11:15:30 +13:00
|
|
|
if (self->size_group)
|
|
|
|
eap_method_add_to_size_group (eap, self->size_group);
|
2012-12-09 19:38:32 -05:00
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), eap_widget);
|
|
|
|
|
2019-10-15 11:15:30 +13:00
|
|
|
wireless_security_notify_changed (self->sec_parent);
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *
|
|
|
|
inner_auth_combo_init (EAPMethodTTLS *method,
|
|
|
|
NMConnection *connection,
|
|
|
|
NMSetting8021x *s_8021x,
|
|
|
|
gboolean secrets_only)
|
|
|
|
{
|
|
|
|
EAPMethod *parent = (EAPMethod *) method;
|
|
|
|
GtkWidget *combo;
|
2019-09-12 11:53:42 +12:00
|
|
|
g_autoptr(GtkListStore) auth_model = NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
GtkTreeIter iter;
|
2019-09-12 11:53:42 +12:00
|
|
|
g_autoptr(EAPMethodSimple) em_pap = NULL;
|
|
|
|
g_autoptr(EAPMethodSimple) em_mschap = NULL;
|
|
|
|
g_autoptr(EAPMethodSimple) em_mschap_v2 = NULL;
|
|
|
|
g_autoptr(EAPMethodSimple) em_plain_mschap_v2 = NULL;
|
|
|
|
g_autoptr(EAPMethodSimple) em_chap = NULL;
|
|
|
|
g_autoptr(EAPMethodSimple) em_md5 = NULL;
|
|
|
|
g_autoptr(EAPMethodSimple) em_gtc = NULL;
|
2012-12-09 19:38:32 -05:00
|
|
|
guint32 active = 0;
|
|
|
|
const char *phase2_auth = NULL;
|
2016-06-07 12:03:22 +02:00
|
|
|
EAPMethodSimpleFlags simple_flags;
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2016-06-07 12:03:22 +02:00
|
|
|
auth_model = gtk_list_store_new (2, G_TYPE_STRING, eap_method_get_type ());
|
2012-12-09 19:38:32 -05: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);
|
|
|
|
}
|
|
|
|
|
2016-06-07 12:03:22 +02:00
|
|
|
simple_flags = EAP_METHOD_SIMPLE_FLAG_PHASE2 | EAP_METHOD_SIMPLE_FLAG_AUTHEAP_ALLOWED;
|
|
|
|
if (method->is_editor)
|
|
|
|
simple_flags |= EAP_METHOD_SIMPLE_FLAG_IS_EDITOR;
|
|
|
|
if (secrets_only)
|
|
|
|
simple_flags |= EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY;
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
em_pap = eap_method_simple_new (method->sec_parent,
|
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_PAP,
|
2016-06-07 12:03:22 +02:00
|
|
|
simple_flags);
|
2012-12-09 19:38:32 -05:00
|
|
|
gtk_list_store_append (auth_model, &iter);
|
|
|
|
gtk_list_store_set (auth_model, &iter,
|
|
|
|
I_NAME_COLUMN, _("PAP"),
|
|
|
|
I_METHOD_COLUMN, em_pap,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
/* Check for defaulting to PAP */
|
|
|
|
if (phase2_auth && !strcasecmp (phase2_auth, "pap"))
|
|
|
|
active = 0;
|
|
|
|
|
|
|
|
em_mschap = eap_method_simple_new (method->sec_parent,
|
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_MSCHAP,
|
2016-06-07 12:03:22 +02:00
|
|
|
simple_flags);
|
2012-12-09 19:38:32 -05:00
|
|
|
gtk_list_store_append (auth_model, &iter);
|
|
|
|
gtk_list_store_set (auth_model, &iter,
|
|
|
|
I_NAME_COLUMN, _("MSCHAP"),
|
|
|
|
I_METHOD_COLUMN, em_mschap,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
/* Check for defaulting to MSCHAP */
|
|
|
|
if (phase2_auth && !strcasecmp (phase2_auth, "mschap"))
|
|
|
|
active = 1;
|
|
|
|
|
|
|
|
em_mschap_v2 = eap_method_simple_new (method->sec_parent,
|
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
|
2016-06-07 12:03:22 +02:00
|
|
|
simple_flags);
|
2012-12-09 19:38:32 -05:00
|
|
|
gtk_list_store_append (auth_model, &iter);
|
|
|
|
gtk_list_store_set (auth_model, &iter,
|
|
|
|
I_NAME_COLUMN, _("MSCHAPv2"),
|
|
|
|
I_METHOD_COLUMN, em_mschap_v2,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
/* Check for defaulting to MSCHAPv2 */
|
2017-03-13 14:22:09 +01:00
|
|
|
if (phase2_auth && !strcasecmp (phase2_auth, "mschapv2") &&
|
|
|
|
nm_setting_802_1x_get_phase2_autheap (s_8021x) != NULL)
|
2012-12-09 19:38:32 -05:00
|
|
|
active = 2;
|
|
|
|
|
2017-03-13 14:22:09 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
em_chap = eap_method_simple_new (method->sec_parent,
|
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_CHAP,
|
2016-06-07 12:03:22 +02:00
|
|
|
simple_flags);
|
2012-12-09 19:38:32 -05:00
|
|
|
gtk_list_store_append (auth_model, &iter);
|
|
|
|
gtk_list_store_set (auth_model, &iter,
|
|
|
|
I_NAME_COLUMN, _("CHAP"),
|
|
|
|
I_METHOD_COLUMN, em_chap,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
/* Check for defaulting to CHAP */
|
|
|
|
if (phase2_auth && !strcasecmp (phase2_auth, "chap"))
|
2017-03-13 14:22:09 +01:00
|
|
|
active = 4;
|
2012-12-09 19:38:32 -05:00
|
|
|
|
2016-06-07 12:03:22 +02:00
|
|
|
em_md5 = eap_method_simple_new (method->sec_parent,
|
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_MD5,
|
|
|
|
simple_flags);
|
|
|
|
gtk_list_store_append (auth_model, &iter);
|
|
|
|
gtk_list_store_set (auth_model, &iter,
|
|
|
|
I_NAME_COLUMN, _("MD5"),
|
|
|
|
I_METHOD_COLUMN, em_md5,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
/* Check for defaulting to MD5 */
|
|
|
|
if (phase2_auth && !strcasecmp (phase2_auth, "md5"))
|
2017-03-13 14:22:09 +01:00
|
|
|
active = 5;
|
2016-06-07 12:03:22 +02:00
|
|
|
|
|
|
|
em_gtc = eap_method_simple_new (method->sec_parent,
|
|
|
|
connection,
|
|
|
|
EAP_METHOD_SIMPLE_TYPE_GTC,
|
|
|
|
simple_flags);
|
|
|
|
gtk_list_store_append (auth_model, &iter);
|
|
|
|
gtk_list_store_set (auth_model, &iter,
|
|
|
|
I_NAME_COLUMN, _("GTC"),
|
|
|
|
I_METHOD_COLUMN, em_gtc,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
/* Check for defaulting to GTC */
|
|
|
|
if (phase2_auth && !strcasecmp (phase2_auth, "gtc"))
|
2017-03-13 14:22:09 +01:00
|
|
|
active = 6;
|
2016-06-07 12:03:22 +02:00
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
combo = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
|
|
|
|
g_assert (combo);
|
|
|
|
|
|
|
|
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (auth_model));
|
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), active);
|
|
|
|
|
2019-10-15 11:15:30 +13:00
|
|
|
g_signal_connect_swapped (combo, "changed", G_CALLBACK (inner_auth_combo_changed_cb), method);
|
2012-12-09 19:38:32 -05:00
|
|
|
return combo;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_secrets (EAPMethod *parent, NMConnection *connection)
|
|
|
|
{
|
|
|
|
eap_method_phase2_update_secrets_helper (parent,
|
|
|
|
connection,
|
2019-10-02 11:00:21 +13:00
|
|
|
GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo")),
|
2012-12-09 19:38:32 -05:00
|
|
|
I_METHOD_COLUMN);
|
|
|
|
}
|
|
|
|
|
2019-10-15 10:33:17 +13:00
|
|
|
static void
|
|
|
|
changed_cb (EAPMethodTTLS *self)
|
|
|
|
{
|
|
|
|
wireless_security_notify_changed (self->sec_parent);
|
|
|
|
}
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
EAPMethodTTLS *
|
|
|
|
eap_method_ttls_new (WirelessSecurity *ws_parent,
|
|
|
|
NMConnection *connection,
|
|
|
|
gboolean is_editor,
|
|
|
|
gboolean secrets_only)
|
|
|
|
{
|
|
|
|
EAPMethod *parent;
|
|
|
|
EAPMethodTTLS *method;
|
2016-06-07 12:03:22 +02:00
|
|
|
GtkWidget *widget, *widget_ca_not_required_checkbox;
|
2012-12-09 19:38:32 -05:00
|
|
|
GtkFileFilter *filter;
|
|
|
|
NMSetting8021x *s_8021x = NULL;
|
|
|
|
const char *filename;
|
|
|
|
|
|
|
|
parent = eap_method_init (sizeof (EAPMethodTTLS),
|
|
|
|
validate,
|
|
|
|
add_to_size_group,
|
|
|
|
fill_connection,
|
|
|
|
update_secrets,
|
|
|
|
destroy,
|
2018-03-12 14:39:10 +01:00
|
|
|
"/org/gnome/ControlCenter/network/eap-method-ttls.ui",
|
2019-10-01 10:35:25 +13:00
|
|
|
"eap_ttls_grid",
|
2012-12-09 19:38:32 -05:00
|
|
|
"eap_ttls_anon_identity_entry",
|
|
|
|
FALSE);
|
|
|
|
if (!parent)
|
|
|
|
return NULL;
|
|
|
|
|
2016-06-07 12:03:22 +02:00
|
|
|
parent->password_flags_name = NM_SETTING_802_1X_PASSWORD;
|
2012-12-09 19:38:32 -05:00
|
|
|
method = (EAPMethodTTLS *) parent;
|
|
|
|
method->sec_parent = ws_parent;
|
|
|
|
method->is_editor = is_editor;
|
|
|
|
|
|
|
|
if (connection)
|
|
|
|
s_8021x = nm_connection_get_setting_802_1x (connection);
|
|
|
|
|
2016-06-07 12:03:22 +02:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_not_required_checkbox"));
|
|
|
|
g_assert (widget);
|
2019-10-15 11:15:30 +13:00
|
|
|
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ca_cert_not_required_toggled), method);
|
2019-10-15 10:33:17 +13:00
|
|
|
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (changed_cb), method);
|
2016-06-07 12:03:22 +02:00
|
|
|
widget_ca_not_required_checkbox = widget;
|
|
|
|
|
2012-12-09 19:38:32 -05:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_button"));
|
|
|
|
g_assert (widget);
|
|
|
|
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
|
|
|
|
gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (widget),
|
2014-07-24 13:19:09 +02:00
|
|
|
_("Choose a Certificate Authority certificate"));
|
2019-10-15 10:33:17 +13:00
|
|
|
g_signal_connect_swapped (widget, "selection-changed", G_CALLBACK (changed_cb), method);
|
2012-12-09 19:38:32 -05:00
|
|
|
filter = eap_method_default_file_chooser_filter_new (FALSE);
|
|
|
|
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter);
|
|
|
|
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)
|
|
|
|
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
|
|
|
|
}
|
2016-06-07 12:03:22 +02:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget_ca_not_required_checkbox),
|
|
|
|
!filename && eap_method_ca_cert_ignore_get (parent, connection));
|
2012-12-09 19:38:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_anon_identity_entry"));
|
|
|
|
if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x))
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (widget), nm_setting_802_1x_get_anonymous_identity (s_8021x));
|
2019-10-15 10:33:17 +13:00
|
|
|
g_signal_connect_swapped (widget, "changed", G_CALLBACK (changed_cb), method);
|
2018-12-29 19:51:46 +01:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_match_entry"));
|
|
|
|
if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x))
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (widget), nm_setting_802_1x_get_domain_suffix_match (s_8021x));
|
2019-10-15 10:33:17 +13:00
|
|
|
g_signal_connect_swapped (widget, "changed", G_CALLBACK (changed_cb), method);
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
widget = inner_auth_combo_init (method, connection, s_8021x, secrets_only);
|
2019-10-15 11:15:30 +13:00
|
|
|
inner_auth_combo_changed_cb (method);
|
2012-12-09 19:38:32 -05:00
|
|
|
|
|
|
|
if (secrets_only) {
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_anon_identity_label"));
|
|
|
|
gtk_widget_hide (widget);
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_anon_identity_entry"));
|
|
|
|
gtk_widget_hide (widget);
|
2018-12-29 19:51:46 +01:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_match_label"));
|
|
|
|
gtk_widget_hide (widget);
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_domain_match_entry"));
|
|
|
|
gtk_widget_hide (widget);
|
2012-12-09 19:38:32 -05:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_label"));
|
|
|
|
gtk_widget_hide (widget);
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_button"));
|
|
|
|
gtk_widget_hide (widget);
|
2016-06-07 12:03:22 +02:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_ca_cert_not_required_checkbox"));
|
|
|
|
gtk_widget_hide (widget);
|
2012-12-09 19:38:32 -05:00
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_label"));
|
|
|
|
gtk_widget_hide (widget);
|
|
|
|
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
|
|
|
|
gtk_widget_hide (widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
return method;
|
|
|
|
}
|
|
|
|
|