summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-network/htdocs/luci-static/resources/view
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-11-01 18:20:36 +0100
committerJo-Philipp Wich <jo@mein.io>2020-11-01 18:24:13 +0100
commit4e8620443de9f8e87c094f513028e6e005ad1391 (patch)
tree85cec3a22b06e65763e4dbc285e4b0c36fc32fec /modules/luci-mod-network/htdocs/luci-static/resources/view
parenta7eaf92454619305435d3abd899c99834d3f19ec (diff)
luci-mod-network: fix SAE/WPA check on network join
The method array may be null in case of an open network, also not all occurrences of `is_sae` and `is_psk` were properly checked. Resolve the issue by moving the length check to the variable initialization. Fixes: ba98a2fd0 ("luci-mod-network: fix logic bug in parse enc for network join") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-network/htdocs/luci-static/resources/view')
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
index 6a55a8fd5d..9669055f18 100644
--- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
@@ -1799,8 +1799,8 @@ return view.extend({
zoneval = zoneopt ? zoneopt.formvalue('_new_') : null,
enc = L.isObject(bss.encryption) ? bss.encryption : null,
is_wep = (enc && Array.isArray(enc.wep)),
- is_psk = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'psk' })),
- is_sae = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'sae' }));
+ is_psk = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'psk' }).length > 0),
+ is_sae = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'sae' }).length > 0);
if (nameval == null || (passopt && passval == null))
return;
@@ -1841,11 +1841,11 @@ return view.extend({
uci.set('wireless', section_id, 'bssid', bss.bssid);
}
- if (is_sae.length > 0) {
+ if (is_sae) {
uci.set('wireless', section_id, 'encryption', 'sae');
uci.set('wireless', section_id, 'key', passval);
}
- else if (is_psk.length > 0) {
+ else if (is_psk) {
for (var i = enc.wpa.length - 1; i >= 0; i--) {
if (enc.wpa[i] == 2) {
uci.set('wireless', section_id, 'encryption', 'psk2');