diff options
author | Thomas Haller <thaller@redhat.com> | 2013-08-23 20:41:06 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2013-08-28 10:49:46 +0200 |
commit | 3cae06120a4dd9bebd5f2e57e181ea95e87c8ac4 (patch) | |
tree | e342d380711feb41ce8235783a2626e1455b8599 | |
parent | 8aee69bb137f90c68236aa14bf9524ee609a8647 (diff) | |
download | network-manager-applet-3cae06120a4dd9bebd5f2e57e181ea95e87c8ac4.tar.gz |
editor: fix missing user/password when loading wifi connection to edit
When you opened an existing wifi in nm-connection-editor, the username
and password field were unset for WPA & WPA2 Enterprise.
(This regression was introduced by commit c9476e9c07839e71aed49e820e364ad0b9f47039)
https://bugzilla.redhat.com/show_bug.cgi?id=1000564
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/wireless-security/eap-method-leap.c | 11 | ||||
-rw-r--r-- | src/wireless-security/eap-method-simple.c | 20 | ||||
-rw-r--r-- | src/wireless-security/wireless-security.c | 29 | ||||
-rw-r--r-- | src/wireless-security/wireless-security.h | 2 |
4 files changed, 31 insertions, 31 deletions
diff --git a/src/wireless-security/eap-method-leap.c b/src/wireless-security/eap-method-leap.c index 5dd8e8ca..8315c940 100644 --- a/src/wireless-security/eap-method-leap.c +++ b/src/wireless-security/eap-method-leap.c @@ -202,13 +202,6 @@ eap_method_leap_new (WirelessSecurity *ws_parent, g_signal_connect (G_OBJECT (widget), "changed", (GCallback) wireless_security_changed_cb, ws_parent); - if (connection) { - NMSetting8021x *s_8021x; - - s_8021x = nm_connection_get_setting_802_1x (connection); - if (s_8021x && nm_setting_802_1x_get_identity (s_8021x)) - gtk_entry_set_text (method->username_entry, nm_setting_802_1x_get_identity (s_8021x)); - } if (secrets_only) gtk_widget_set_sensitive (widget, FALSE); @@ -220,10 +213,6 @@ eap_method_leap_new (WirelessSecurity *ws_parent, (GCallback) wireless_security_changed_cb, ws_parent); - /* Fill secrets, if any */ - if (connection) - update_secrets (parent, connection); - widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_eapleap")); g_assert (widget); method->show_password = GTK_TOGGLE_BUTTON (widget); diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c index 9218ecb7..90ae9142 100644 --- a/src/wireless-security/eap-method-simple.c +++ b/src/wireless-security/eap-method-simple.c @@ -250,8 +250,6 @@ eap_method_simple_new (WirelessSecurity *ws_parent, EAPMethod *parent; EAPMethodSimple *method; GtkWidget *widget; - gboolean not_saved = FALSE; - NMSetting8021x *s_8021x = NULL; parent = eap_method_init (sizeof (EAPMethodSimple), validate, @@ -287,11 +285,6 @@ eap_method_simple_new (WirelessSecurity *ws_parent, g_signal_connect (G_OBJECT (widget), "changed", (GCallback) wireless_security_changed_cb, ws_parent); - if (connection) { - s_8021x = nm_connection_get_setting_802_1x (connection); - if (s_8021x && nm_setting_802_1x_get_identity (s_8021x)) - gtk_entry_set_text (method->username_entry, nm_setting_802_1x_get_identity (s_8021x)); - } if (secrets_only) gtk_widget_set_sensitive (widget, FALSE); @@ -324,19 +317,6 @@ eap_method_simple_new (WirelessSecurity *ws_parent, if (secrets_only) gtk_widget_hide (widget); - if (s_8021x) { - NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE; - - nm_setting_get_secret_flags (NM_SETTING (s_8021x), NM_SETTING_802_1X_PASSWORD, &flags, NULL); - not_saved = (flags & NM_SETTING_SECRET_FLAG_NOT_SAVED); - } - - gtk_toggle_button_set_active (method->always_ask, not_saved); - - /* Fill secrets if there's a static (ie, not OTP) password */ - if (connection && (not_saved == FALSE)) - update_secrets (EAP_METHOD (method), connection); - widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_eapsimple")); g_assert (widget); method->show_password = GTK_TOGGLE_BUTTON (widget); diff --git a/src/wireless-security/wireless-security.c b/src/wireless-security/wireless-security.c index 5441c35c..f3a6bbf0 100644 --- a/src/wireless-security/wireless-security.c +++ b/src/wireless-security/wireless-security.c @@ -238,6 +238,32 @@ wireless_security_set_userpass (WirelessSecurity *sec, } void +wireless_security_set_userpass_802_1x (WirelessSecurity *sec, + NMConnection *connection) +{ + const char *user = NULL, *password = NULL; + gboolean always_ask = FALSE, show_password = FALSE; + NMSetting8021x *setting; + NMSettingSecretFlags flags; + + if (!connection) + goto set; + + setting = nm_connection_get_setting_802_1x (connection); + if (!setting) + goto set; + + user = nm_setting_802_1x_get_identity (setting); + password = nm_setting_802_1x_get_password (setting); + + if (nm_setting_get_secret_flags (NM_SETTING (setting), NM_SETTING_802_1X_PASSWORD, &flags, NULL)) + always_ask = flags & NM_SETTING_SECRET_FLAG_NOT_SAVED; + +set: + wireless_security_set_userpass (sec, user, password, always_ask, show_password); +} + +void wireless_security_clear_ciphers (NMConnection *connection) { NMSettingWirelessSecurity *s_wireless_sec; @@ -385,6 +411,9 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec, default_method = nm_setting_802_1x_get_eap_method (s_8021x, 0); } + /* initialize WirelessSecurity userpass from connection (clear if no connection) */ + wireless_security_set_userpass_802_1x (sec, connection); + auth_model = gtk_list_store_new (2, G_TYPE_STRING, eap_method_get_g_type ()); if (wired) { diff --git a/src/wireless-security/wireless-security.h b/src/wireless-security/wireless-security.h index 45ecf837..149a21dc 100644 --- a/src/wireless-security/wireless-security.h +++ b/src/wireless-security/wireless-security.h @@ -86,6 +86,8 @@ void wireless_security_set_userpass (WirelessSecurity *sec, const char *password, gboolean always_ask, gboolean show_password); +void wireless_security_set_userpass_802_1x (WirelessSecurity *sec, + NMConnection *connection); WirelessSecurity *wireless_security_ref (WirelessSecurity *sec); |