aboutsummaryrefslogtreecommitdiffstats
path: root/hotspot-to-wpa.capsman.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-03-06 23:53:50 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-03-12 15:27:15 +0100
commit6fd39bd3c5d7c3fe5dca9e92275f60e0b3217f03 (patch)
tree7ced2fbdb536447b537a967e945600ba6dd78c8a /hotspot-to-wpa.capsman.rsc
parentb86d6314868596dacdf422db80ef0ff27c61c644 (diff)
parentf0856c264e07804a229668268a457f2154cb373a (diff)
Merge branch 'do-with-on-error' into nextrouteros-7.15beta4-2
Diffstat (limited to 'hotspot-to-wpa.capsman.rsc')
-rw-r--r--hotspot-to-wpa.capsman.rsc19
1 files changed, 9 insertions, 10 deletions
diff --git a/hotspot-to-wpa.capsman.rsc b/hotspot-to-wpa.capsman.rsc
index 7498ae2..a6ad2a1 100644
--- a/hotspot-to-wpa.capsman.rsc
+++ b/hotspot-to-wpa.capsman.rsc
@@ -13,21 +13,22 @@
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
-:local Main do={
- :local ScriptName [ :tostr $1 ];
- :local MacAddress [ :tostr $2 ];
- :local UserName [ :tostr $3 ];
+:do {
+ :local ScriptName [ :jobname ];
:global EitherOr;
:global LogPrintExit2;
:global ParseKeyValueStore;
:global ScriptLock;
+ :local MacAddress $"mac-address";
+ :local UserName $username;
+
:if ([ $ScriptLock $ScriptName ] = false) do={
- :return false;
+ :error false;
}
- :if ([ :len $MacAddress ] = 0 || [ :len $UserName ] = 0) do={
+ :if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
$LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
}
@@ -55,7 +56,7 @@
:if ($Template->"action" = "reject") do={
$LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
- :return true;
+ :error true;
}
# allow login page to load
@@ -93,6 +94,4 @@
:delay 2s;
/caps-man/access-list/set $Entry action=accept;
-}
-
-$Main [ :jobname ] $"mac-address" $username;
+} on-error={ }