From 2518aad3e83a842ff8452f9ecf6365edd0527368 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 3 Aug 2012 20:56:18 +0300 Subject: [PATCH] Move PSK/passphrase configuration check into use time from parsing Instead of rejecting network blocks without PSK/passphrase at the time the configuration file is read, allow such configuration to be loaded and only behave as if the network block with missing PSK/passphrase is disabled. Signed-hostap: Jouni Malinen --- wpa_supplicant/config_file.c | 6 ------ wpa_supplicant/config_winreg.c | 7 ------- wpa_supplicant/wpa_supplicant.c | 3 +++ 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 8badc7b97..a55a5c966 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -99,12 +99,6 @@ static int wpa_config_validate_network(struct wpa_ssid *ssid, int line) wpa_config_update_psk(ssid); } - if (wpa_key_mgmt_wpa_psk(ssid->key_mgmt) && !ssid->psk_set) { - wpa_printf(MSG_ERROR, "Line %d: WPA-PSK accepted for key " - "management, but no PSK configured.", line); - errors++; - } - if ((ssid->group_cipher & WPA_CIPHER_CCMP) && !(ssid->pairwise_cipher & WPA_CIPHER_CCMP) && !(ssid->pairwise_cipher & WPA_CIPHER_NONE)) { diff --git a/wpa_supplicant/config_winreg.c b/wpa_supplicant/config_winreg.c index de2ec58b1..6d9876cc1 100644 --- a/wpa_supplicant/config_winreg.c +++ b/wpa_supplicant/config_winreg.c @@ -344,13 +344,6 @@ static struct wpa_ssid * wpa_config_read_network(HKEY hk, const TCHAR *netw, wpa_config_update_psk(ssid); } - if (wpa_key_mgmt_wpa_psk(ssid->key_mgmt) && !ssid->psk_set) { - wpa_printf(MSG_ERROR, "WPA-PSK accepted for key management, " - "but no PSK configured for network '" TSTR "'.", - netw); - errors++; - } - if ((ssid->group_cipher & WPA_CIPHER_CCMP) && !(ssid->pairwise_cipher & WPA_CIPHER_CCMP) && !(ssid->pairwise_cipher & WPA_CIPHER_NONE)) { diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c65dc3c30..502541014 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3388,6 +3388,9 @@ int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) return 1; /* invalid WEP key */ } + if (wpa_key_mgmt_wpa_psk(ssid->key_mgmt) && !ssid->psk_set) + return 1; + return 0; }