aboutsummaryrefslogtreecommitdiffstats
path: root/hotspot-to-wpa.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-06-26 21:18:51 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-06-28 11:26:51 +0200
commita030e2f9468474bb883b36cae0828da575edcdb6 (patch)
treebff8e2ef7d13e6d3d1b12b0769d2bce817bc630f /hotspot-to-wpa.rsc
parent5ba34c819a93e27b0eb4c56e25435fe522e16ee3 (diff)
parent64ab9eec6756a95df14471b0ebf0f3014c478e9a (diff)
Merge branch 'hotspot-to-wpa' into next
Diffstat (limited to 'hotspot-to-wpa.rsc')
-rw-r--r--hotspot-to-wpa.rsc11
1 files changed, 9 insertions, 2 deletions
diff --git a/hotspot-to-wpa.rsc b/hotspot-to-wpa.rsc
index d7aeb65..35d4fa5 100644
--- a/hotspot-to-wpa.rsc
+++ b/hotspot-to-wpa.rsc
@@ -25,7 +25,10 @@ $ScriptLock $0;
}
:local Date [ /system/clock/get date ];
-:local UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
+:local UserVal ({});
+:if ([ :len [ /ip/hotspot/user/find where name=$UserName ] ] > 0) do={
+ :set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
+}
:local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ];
:local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ];
@@ -54,7 +57,8 @@ $LogPrintExit2 info $0 ("Adding/updating access-list entry for mac address " . $
" (user " . $UserName . ").") false;
/caps-man/access-list/remove [ find where mac-address=$MacAddress comment~"^hotspot-to-wpa: " ];
/caps-man/access-list/add comment=("hotspot-to-wpa: " . $UserName . ", " . $MacAddress . ", " . $Date) \
- mac-address=$MacAddress private-passphrase=($UserVal->"password") ssid-regexp="-wpa\$" place-before=$PlaceBefore;
+ mac-address=$MacAddress private-passphrase=($UserVal->"password") ssid-regexp="-wpa\$" \
+ action=reject place-before=$PlaceBefore;
:local Entry [ /caps-man/access-list/find where mac-address=$MacAddress \
comment=("hotspot-to-wpa: " . $UserName . ", " . $MacAddress . ", " . $Date) ];
@@ -78,3 +82,6 @@ $LogPrintExit2 info $0 ("Adding/updating access-list entry for mac address " . $
:if ([ :len $VlanMode] > 0) do={
/caps-man/access-list/set $Entry vlan-mode=$VlanMode;
}
+
+:delay 2s;
+/caps-man/access-list/set $Entry action=accept;