mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
fix: handle open wifi in setKnownStationsWPA
correctly
use `... key_mgmt NONE` instead of `... psk XXX`
This commit is contained in:
parent
a0d8f22742
commit
534b4df01a
1 changed files with 4 additions and 0 deletions
|
@ -269,6 +269,7 @@ function setKnownStationsWPA($networks)
|
||||||
if (!networkExists($ssid, $wpaCliNetworks)) {
|
if (!networkExists($ssid, $wpaCliNetworks)) {
|
||||||
$ssid = escapeshellarg('"'.$network['ssid'].'"');
|
$ssid = escapeshellarg('"'.$network['ssid'].'"');
|
||||||
$psk = escapeshellarg('"'.$network['passphrase'].'"');
|
$psk = escapeshellarg('"'.$network['passphrase'].'"');
|
||||||
|
$protocol = $network['protocol'];
|
||||||
$netid = trim(shell_exec("sudo wpa_cli -i $iface add_network"));
|
$netid = trim(shell_exec("sudo wpa_cli -i $iface add_network"));
|
||||||
if (isset($netid) && !isset($known[$netid])) {
|
if (isset($netid) && !isset($known[$netid])) {
|
||||||
$commands = [
|
$commands = [
|
||||||
|
@ -276,6 +277,9 @@ function setKnownStationsWPA($networks)
|
||||||
"sudo wpa_cli -i $iface set_network $netid psk $psk",
|
"sudo wpa_cli -i $iface set_network $netid psk $psk",
|
||||||
"sudo wpa_cli -i $iface enable_network $netid"
|
"sudo wpa_cli -i $iface enable_network $netid"
|
||||||
];
|
];
|
||||||
|
if ($protocol === 'Open') {
|
||||||
|
$commands[1] = "sudo wpa_cli -i $iface set_network $netid key_mgmt NONE";
|
||||||
|
}
|
||||||
foreach ($commands as $cmd) {
|
foreach ($commands as $cmd) {
|
||||||
exec($cmd);
|
exec($cmd);
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|
Loading…
Reference in a new issue