diff --git a/ChangeLog b/ChangeLog index d8f282c5c3..db5cf06cc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-10-14 Dan Williams + + * libnm-util/nm-setting.c + - (setting_wireless_security_need_secrets): handle LEAP secrets + 2007-10-13 Dan Williams * libnm-util/nm-setting.h diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index aef5510268..8648e117ea 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -982,6 +982,19 @@ setting_wireless_security_destroy (NMSetting *setting) g_slice_free (NMSettingWirelessSecurity, self); } +static gboolean +string_list_contains (GSList *list, const char *string) +{ + GSList *iter; + + g_return_val_if_fail (string != NULL, FALSE); + + for (iter = list; iter; iter = g_slist_next (iter)) + if (!strcmp (iter->data, string)) + return TRUE; + return FALSE; +} + static gboolean setting_wireless_security_update_secrets (NMSetting *setting, GHashTable *secrets) @@ -1068,7 +1081,6 @@ setting_wireless_security_need_secrets (NMSetting *setting) g_assert (self->key_mgmt); /* Static WEP */ - // FIXME: check key length too if (strcmp (self->key_mgmt, "none") == 0) { if (!verify_wep_key (self->wep_key0)) { g_ptr_array_add (secrets, "wep-key0"); @@ -1089,6 +1101,7 @@ setting_wireless_security_need_secrets (NMSetting *setting) goto no_secrets; } + /* WPA-PSK infrastructure and adhoc */ if ( (strcmp (self->key_mgmt, "wpa-none") == 0) || (strcmp (self->key_mgmt, "wpa-psk") == 0)) { if (!verify_wpa_psk (self->psk)) { @@ -1098,6 +1111,17 @@ setting_wireless_security_need_secrets (NMSetting *setting) goto no_secrets; } + /* LEAP */ + if ( (strcmp (self->key_mgmt, "ieee8021x") == 0) + && (strcmp (self->auth_alg, "leap") == 0) + && (string_list_contains (self->eap, "leap"))) { + if (!self->password || !strlen (self->password)) { + g_ptr_array_add (secrets, "password"); + return secrets; + } + goto no_secrets; + } + if (strcmp (self->key_mgmt, "wpa-eap") == 0) { // FIXME: implement goto no_secrets;