mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-12 05:20:36 +01:00
nmtui: wifi: support WPA Enterprise
This commit is contained in:
parent
7b067be580
commit
4af8010f02
3 changed files with 41 additions and 11 deletions
|
|
@ -848,7 +848,9 @@ peer_transform_from_persistent_keepalive_string(GBinding *binding,
|
|||
typedef struct {
|
||||
NMConnection *connection;
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
NMSetting8021x *s_8021x;
|
||||
gboolean s_wsec_in_use;
|
||||
gboolean s_8021x_in_use;
|
||||
|
||||
GObject *target;
|
||||
char *target_property;
|
||||
|
|
@ -936,6 +938,7 @@ wireless_security_target_changed(GObject *object, GParamSpec *pspec, gpointer us
|
|||
{
|
||||
NMEditorWirelessSecurityMethodBinding *binding = user_data;
|
||||
char *method;
|
||||
gboolean need_8021x = FALSE;
|
||||
|
||||
if (binding->updating)
|
||||
return;
|
||||
|
|
@ -945,11 +948,14 @@ wireless_security_target_changed(GObject *object, GParamSpec *pspec, gpointer us
|
|||
binding->updating = TRUE;
|
||||
|
||||
if (!strcmp(method, "none")) {
|
||||
if (!binding->s_wsec_in_use)
|
||||
return;
|
||||
binding->s_wsec_in_use = FALSE;
|
||||
nm_connection_remove_setting(binding->connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
|
||||
|
||||
if (binding->s_wsec_in_use) {
|
||||
binding->s_wsec_in_use = FALSE;
|
||||
nm_connection_remove_setting(binding->connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
|
||||
}
|
||||
if (binding->s_8021x_in_use) {
|
||||
binding->s_8021x_in_use = FALSE;
|
||||
nm_connection_remove_setting(binding->connection, NM_TYPE_SETTING_802_1X);
|
||||
}
|
||||
binding->updating = FALSE;
|
||||
return;
|
||||
}
|
||||
|
|
@ -1030,10 +1036,21 @@ wireless_security_target_changed(GObject *object, GParamSpec *pspec, gpointer us
|
|||
NULL,
|
||||
NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE,
|
||||
NM_WEP_KEY_TYPE_UNKNOWN,
|
||||
NM_SETTING_WIRELESS_SECURITY_PSK,
|
||||
NULL,
|
||||
NULL);
|
||||
need_8021x = TRUE;
|
||||
} else
|
||||
g_warn_if_reached();
|
||||
|
||||
if (need_8021x != binding->s_8021x_in_use) {
|
||||
binding->s_8021x_in_use = need_8021x;
|
||||
if (need_8021x)
|
||||
nm_connection_add_setting(binding->connection, NM_SETTING(binding->s_8021x));
|
||||
else
|
||||
nm_connection_remove_setting(binding->connection, NM_TYPE_SETTING_802_1X);
|
||||
}
|
||||
|
||||
binding->updating = FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1076,6 +1093,7 @@ wireless_security_target_destroyed(gpointer user_data, GObject *ex_target)
|
|||
void
|
||||
nm_editor_bind_wireless_security_method(NMConnection *connection,
|
||||
NMSettingWirelessSecurity *s_wsec,
|
||||
NMSetting8021x *s_8021x,
|
||||
gpointer target,
|
||||
const char *target_property,
|
||||
GBindingFlags flags)
|
||||
|
|
@ -1099,9 +1117,11 @@ nm_editor_bind_wireless_security_method(NMConnection *connection,
|
|||
NM_CONNECTION_CHANGED,
|
||||
G_CALLBACK(wireless_connection_changed),
|
||||
binding);
|
||||
binding->s_wsec_in_use = (nm_connection_get_setting_wireless_security(connection) != NULL);
|
||||
binding->s_wsec_in_use = (nm_connection_get_setting_wireless_security(connection) != NULL);
|
||||
binding->s_wsec = g_object_ref(s_wsec);
|
||||
binding->s_8021x_in_use = (nm_connection_get_setting_802_1x(connection) != NULL);
|
||||
binding->s_8021x = g_object_ref(s_8021x);
|
||||
|
||||
binding->s_wsec = g_object_ref(s_wsec);
|
||||
g_signal_connect(s_wsec,
|
||||
"notify::" NM_SETTING_WIRELESS_SECURITY_KEY_MGMT,
|
||||
G_CALLBACK(wireless_security_changed),
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ void nm_editor_bind_ip_route_to_strings(int family,
|
|||
|
||||
void nm_editor_bind_wireless_security_method(NMConnection *connection,
|
||||
NMSettingWirelessSecurity *s_wsec,
|
||||
NMSetting8021x *s_8021x,
|
||||
gpointer target,
|
||||
const char *target_property,
|
||||
GBindingFlags flags);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "nmt-mac-entry.h"
|
||||
#include "nmt-mtu-entry.h"
|
||||
#include "nmt-password-fields.h"
|
||||
#include "nmt-8021x-fields.h"
|
||||
|
||||
#include "nm-editor-bindings.h"
|
||||
|
||||
|
|
@ -33,6 +34,7 @@ G_DEFINE_TYPE(NmtPageWifi, nmt_page_wifi, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
|||
|
||||
typedef struct {
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
NMSetting8021x *s_8021x;
|
||||
|
||||
} NmtPageWifiPrivate;
|
||||
|
||||
|
|
@ -166,6 +168,7 @@ nmt_page_wifi_constructed(GObject *object)
|
|||
NmtEditorGrid *grid;
|
||||
NMSettingWireless *s_wireless;
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
NMSetting8021x *s_8021x;
|
||||
NmtNewtWidget *widget, *hbox, *subgrid;
|
||||
NmtNewtWidget *mode, *band, *security, *entry;
|
||||
NmtNewtStack *stack;
|
||||
|
|
@ -181,7 +184,14 @@ nmt_page_wifi_constructed(GObject *object)
|
|||
*/
|
||||
s_wsec = NM_SETTING_WIRELESS_SECURITY(nm_setting_wireless_security_new());
|
||||
}
|
||||
priv->s_wsec = g_object_ref_sink(s_wsec);
|
||||
priv->s_wsec = g_object_ref(s_wsec);
|
||||
|
||||
s_8021x = nm_connection_get_setting_802_1x(conn);
|
||||
if (!s_8021x) {
|
||||
s_8021x = NM_SETTING_802_1X(nm_setting_802_1x_new());
|
||||
nm_setting_802_1x_add_eap_method(s_8021x, "TLS");
|
||||
}
|
||||
priv->s_8021x = g_object_ref(s_8021x);
|
||||
|
||||
deventry = nmt_editor_page_device_get_device_entry(NMT_EDITOR_PAGE_DEVICE(object));
|
||||
g_object_bind_property(s_wireless,
|
||||
|
|
@ -279,9 +289,7 @@ nmt_page_wifi_constructed(GObject *object)
|
|||
nmt_newt_stack_add(stack, "wpa3-personal", subgrid);
|
||||
|
||||
/* "wpa-enterprise" */
|
||||
// FIXME
|
||||
widget = nmt_newt_label_new(_("(No support for wpa-enterprise yet...)"));
|
||||
nmt_newt_stack_add(stack, "wpa-enterprise", widget);
|
||||
nmt_newt_stack_add(stack, "wpa-enterprise", nmt_8021x_fields_new(s_8021x, FALSE));
|
||||
|
||||
/* wep-key */
|
||||
subgrid = nmt_editor_grid_new();
|
||||
|
|
@ -355,6 +363,7 @@ nmt_page_wifi_constructed(GObject *object)
|
|||
g_object_bind_property(security, "active-id", stack, "active-id", G_BINDING_SYNC_CREATE);
|
||||
nm_editor_bind_wireless_security_method(conn,
|
||||
s_wsec,
|
||||
s_8021x,
|
||||
security,
|
||||
"active-id",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue