Skip to content

Commit

Permalink
Fix: handle 64 char passkey in absence of 8-63 char passhprase
Browse files Browse the repository at this point in the history
  • Loading branch information
billz committed Oct 8, 2023
1 parent 2ac5f94 commit deac75a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions includes/configure_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions includes/wifi_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit deac75a

Please sign in to comment.