mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 11:37:24 +00:00
Handle non-ASCII SSID
Non-ASCII SSID has to be stored in wpa_supplicant.conf identical to the string given by wpa_cli scan. This includes the escaped special chars (e.g. ö = \xc3\xb9 ), with a prescript "P". To obtain a valid psk from wpa_passphrase, the UTF8 string is passed (ssid2utf8 replaces the \x bytes by their binary value) to the exec(). For this to work the shell locale has to be UTF8 (via putenv()). Otherwise the string is converted to the shell encoding.
This commit is contained in:
parent
5630258d9a
commit
d478bf5362
@ -61,7 +61,7 @@ function DisplayWPAConfig()
|
|||||||
if (strlen($network['passphrase']) >=8 && strlen($network['passphrase']) <= 63) {
|
if (strlen($network['passphrase']) >=8 && strlen($network['passphrase']) <= 63) {
|
||||||
unset($wpa_passphrase);
|
unset($wpa_passphrase);
|
||||||
unset($line);
|
unset($line);
|
||||||
exec('wpa_passphrase '.escapeshellarg($ssid). ' ' . escapeshellarg($network['passphrase']), $wpa_passphrase);
|
exec('wpa_passphrase '. ssid2utf8( escapeshellarg($ssid) ) . ' ' . escapeshellarg($network['passphrase']), $wpa_passphrase);
|
||||||
foreach ($wpa_passphrase as $line) {
|
foreach ($wpa_passphrase as $line) {
|
||||||
if (preg_match('/^\s*}\s*$/', $line)) {
|
if (preg_match('/^\s*}\s*$/', $line)) {
|
||||||
if (array_key_exists('priority', $network)) {
|
if (array_key_exists('priority', $network)) {
|
||||||
@ -69,7 +69,11 @@ function DisplayWPAConfig()
|
|||||||
}
|
}
|
||||||
fwrite($wpa_file, $line.PHP_EOL);
|
fwrite($wpa_file, $line.PHP_EOL);
|
||||||
} else {
|
} else {
|
||||||
fwrite($wpa_file, $line.PHP_EOL);
|
if ( strpos($ssid, "\x") !== false && strpos($line, "ssid=\"") !== false ) {
|
||||||
|
fwrite($wpa_file, "\tssid=P\"".$ssid."\"".PHP_EOL);
|
||||||
|
} else {
|
||||||
|
fwrite($wpa_file, $line.PHP_EOL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user