From fe93df27d19c1fdda409109fb414e4b1444c00e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 17 Oct 2024 11:46:45 +0200 Subject: [PATCH] driver/wifi: fix invalid network check This commit alignes the implementation to the intention of dismissing invalid '' entries. We only accept entries when they contain a valid SSID and additionally a valid PSK if the network is protected. Issue #5356. --- repos/dde_linux/src/driver/wifi/manager.h | 30 +++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/repos/dde_linux/src/driver/wifi/manager.h b/repos/dde_linux/src/driver/wifi/manager.h index 75e55a510f..8ee850eb5e 100644 --- a/repos/dde_linux/src/driver/wifi/manager.h +++ b/repos/dde_linux/src/driver/wifi/manager.h @@ -1518,22 +1518,26 @@ struct Wifi::Manager : Wifi::Rfkill_notification_handler Accesspoint const ap = Accesspoint::from_xml(node); - bool const ssid_invalid = !Accesspoint::valid(ap.ssid); - if (ssid_invalid) - warning("accesspoint has invalid ssid: '", ap.ssid, "'"); - - bool const pass_invalid = ap.wpa() && !Accesspoint::valid(ap.pass); - if (pass_invalid) - warning("accesspoint '", ap.ssid, "' has invalid psk"); - /* * Only make the supplicant acquainted with the network - * when it is usable but created the Network object nonetheless - * to satisfy the List_model requirements. + * when it is usable, it always needs a valid SSID and + * in case it is protected also a valid PSK, but create + * the Network object nonetheless to satisfy the List_model + * requirements. */ - if (!ssid_invalid || !pass_invalid) - _queue_action(*new (_actions_alloc) - Add_network_cmd(_msg, ap), _config.verbose); + + bool const ssid_valid = Accesspoint::valid(ap.ssid); + if (!ssid_valid) + warning("accesspoint has invalid ssid: '", ap.ssid, "'"); + + bool const pass_valid = ap.wpa() ? Accesspoint::valid(ap.pass) + : true; + if (!pass_valid) + warning("accesspoint '", ap.ssid, "' has invalid psk"); + + if (ssid_valid && pass_valid) + _queue_action(*new (_actions_alloc) + Add_network_cmd(_msg, ap), _config.verbose); return *new (_network_allocator) Network(ap); },