From deac75af89784888edc5fd24c9993a6f29d6f686 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 8 Oct 2023 11:46:12 +0200 Subject: [PATCH] Fix: handle 64 char passkey in absence of 8-63 char passhprase --- includes/configure_client.php | 6 ++++++ includes/wifi_functions.php | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/configure_client.php b/includes/configure_client.php index 64164f94..9abb6191 100755 --- a/includes/configure_client.php +++ b/includes/configure_client.php @@ -77,6 +77,12 @@ function DisplayWPAConfig() } } } + } elseif (strlen($network['passphrase']) == 0 && strlen($network['passkey']) == 64) { + $line = "\tpsk=" . $network['passkey']; + fwrite($wpa_file, "network={".PHP_EOL); + fwrite($wpa_file, "\tssid=\"".$ssid."\"".PHP_EOL); + fwrite($wpa_file, $line.PHP_EOL); + fwrite($wpa_file, "}".PHP_EOL); } else { $status->addMessage('WPA passphrase must be between 8 and 63 characters', 'danger'); $ok = false; diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 34f8bc58..1ef0e225 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -27,9 +27,9 @@ function knownWifiStations(&$networks) $network['ssid'] = $ssid; break; case 'psk': - if (array_key_exists('passphrase', $network)) { - break; - } + $network['passkey'] = trim($lineArr[1]); + $network['protocol'] = 'WPA'; + break; case '#psk': $network['protocol'] = 'WPA'; case 'wep_key0': // Untested