mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
network: Fix syncing the PSK on 1st connection
The previous change did not consider the case of the PSK being written for the very first time. In this case storage_network_open would return NULL and an empty file would be written. Change this so that if storage_network_open fails, then the current network settings are written to disk and not a temporary.
This commit is contained in:
parent
cb24b622ae
commit
c38b77d0c0
@ -434,15 +434,22 @@ void network_sync_psk(struct network *network)
|
||||
|
||||
network->update_psk = false;
|
||||
|
||||
fs_settings = storage_network_open(SECURITY_PSK, network->info->ssid);
|
||||
hex = l_util_hexstring(network->psk, 32);
|
||||
l_settings_set_value(network->settings, "Security",
|
||||
"PreSharedKey", hex);
|
||||
l_settings_set_value(fs_settings, "Security", "PreSharedKey", hex);
|
||||
l_free(hex);
|
||||
|
||||
storage_network_sync(SECURITY_PSK, network->info->ssid, fs_settings);
|
||||
l_settings_free(fs_settings);
|
||||
fs_settings = storage_network_open(SECURITY_PSK, network->info->ssid);
|
||||
if (fs_settings) {
|
||||
l_settings_set_value(fs_settings, "Security",
|
||||
"PreSharedKey", hex);
|
||||
storage_network_sync(SECURITY_PSK, network->info->ssid,
|
||||
fs_settings);
|
||||
l_settings_free(fs_settings);
|
||||
} else
|
||||
storage_network_sync(SECURITY_PSK, network->info->ssid,
|
||||
network->settings);
|
||||
|
||||
l_free(hex);
|
||||
}
|
||||
|
||||
int network_autoconnect(struct network *network, struct scan_bss *bss)
|
||||
|
Loading…
Reference in New Issue
Block a user