mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-25 09:00:25 +00:00
Merge pull request #1627 from daniel-rose/bugfix/handle-open-wifi-correctly
fix: handle open wifi in `setKnownStationsWPA` correctly
This commit is contained in:
commit
98c2a7cb34
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