1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

only lower case hex sequences in non-ASCII SSID

This commit is contained in:
zbchristian 2021-08-31 16:18:00 +02:00
parent 077a9cd675
commit 3aa564cdec
2 changed files with 5 additions and 2 deletions

View File

@ -765,6 +765,10 @@ function evalHexSequence($string)
return preg_replace_callback('/\\\x(..)/', $evaluator, $string); return preg_replace_callback('/\\\x(..)/', $evaluator, $string);
} }
function hexSequence2lower($string) {
return preg_replace_callback('/\\\\x([0-9A-F]{2})/', function($b){ return '\x'.strtolower($b[1]); }, $string);
}
/* File upload callback object /* File upload callback object
* *
*/ */

View File

@ -73,7 +73,6 @@ function nearbyWifiStations(&$networks, $cached = true)
$arrNetwork = preg_split("/[\t]+/", $network); // split result into array $arrNetwork = preg_split("/[\t]+/", $network); // split result into array
$ssid = trim($arrNetwork[4]); $ssid = trim($arrNetwork[4]);
$ssid = evalHexSequence($ssid);
// exclude raspap ssid // exclude raspap ssid
if (empty($ssid) || $ssid == $ap_ssid) { if (empty($ssid) || $ssid == $ap_ssid) {
@ -117,7 +116,7 @@ function connectedWifiStations(&$networks)
exec('iwconfig ' .$_SESSION['wifi_client_interface'], $iwconfig_return); exec('iwconfig ' .$_SESSION['wifi_client_interface'], $iwconfig_return);
foreach ($iwconfig_return as $line) { foreach ($iwconfig_return as $line) {
if (preg_match('/ESSID:\"([^"]+)\"/i', $line, $iwconfig_ssid)) { if (preg_match('/ESSID:\"([^"]+)\"/i', $line, $iwconfig_ssid)) {
$networks[$iwconfig_ssid[1]]['connected'] = true; $networks[hexSequence2lower($iwconfig_ssid[1])]['connected'] = true;
} }
} }
} }