aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-03-08 12:45:38 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-03-12 20:37:57 +0100
commit369af473743623fd89685cdfd8bf31b3430ed489 (patch)
treeac32782bf8c944456acc481664384e5038a155a4
parentd93ffb9cb28843f95a970fdaae0d8296546cbb9d (diff)
hotspot-to-wpa: switch to $LogPrint
-rw-r--r--hotspot-to-wpa.capsman.rsc15
-rw-r--r--hotspot-to-wpa.template.rsc15
-rw-r--r--hotspot-to-wpa.wifi.rsc15
3 files changed, 24 insertions, 21 deletions
diff --git a/hotspot-to-wpa.capsman.rsc b/hotspot-to-wpa.capsman.rsc
index a6ad2a1..37c8464 100644
--- a/hotspot-to-wpa.capsman.rsc
+++ b/hotspot-to-wpa.capsman.rsc
@@ -17,7 +17,7 @@
:local ScriptName [ :jobname ];
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -29,7 +29,8 @@
}
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
+ :error false;
}
:local Date [ /system/clock/get date ];
@@ -42,28 +43,28 @@
:if ([ :len [ /caps-man/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={
/caps-man/access-list/add comment="--- hotspot-to-wpa above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.");
}
:local PlaceBefore ([ /caps-man/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ]->0);
:if ([ :len [ /caps-man/access-list/find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={
/caps-man/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
- $LogPrintExit2 warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.");
}
:local Template [ /caps-man/access-list/get ([ find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
- $LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
:error true;
}
# allow login page to load
:delay 1s;
- $LogPrintExit2 info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
- " (user " . $UserName . ").") false;
+ $LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
+ " (user " . $UserName . ").");
/caps-man/access-list/remove [ find where mac-address=$MacAddress comment~"^hotspot-to-wpa: " ];
/caps-man/access-list/add private-passphrase=($UserVal->"password") ssid-regexp="-wpa\$" \
mac-address=$MacAddress comment=("hotspot-to-wpa: " . $UserName . ", " . $MacAddress . ", " . $Date) \
diff --git a/hotspot-to-wpa.template.rsc b/hotspot-to-wpa.template.rsc
index b7869c4..cbce42a 100644
--- a/hotspot-to-wpa.template.rsc
+++ b/hotspot-to-wpa.template.rsc
@@ -18,7 +18,7 @@
:local ScriptName [ :jobname ];
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -30,7 +30,8 @@
}
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
+ :error false;
}
:local Date [ /system/clock/get date ];
@@ -45,7 +46,7 @@
:if ([ :len [ /interface/wifi/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={
/caps-man/access-list/add comment="--- hotspot-to-wpa above ---" disabled=yes;
/interface/wifi/access-list/add comment="--- hotspot-to-wpa above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.");
}
:local PlaceBefore ([ /caps-man/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ]->0);
:local PlaceBefore ([ /interface/wifi/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ]->0);
@@ -55,22 +56,22 @@
comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={
/caps-man/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
/interface/wifi/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
- $LogPrintExit2 warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.");
}
:local Template [ /caps-man/access-list/get ([ find where \
:local Template [ /interface/wifi/access-list/get ([ find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
- $LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
:error true;
}
# allow login page to load
:delay 1s;
- $LogPrintExit2 info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
- " (user " . $UserName . ").") false;
+ $LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
+ " (user " . $UserName . ").");
/caps-man/access-list/remove [ find where mac-address=$MacAddress comment~"^hotspot-to-wpa: " ];
/interface/wifi/access-list/remove [ find where mac-address=$MacAddress comment~"^hotspot-to-wpa: " ];
/caps-man/access-list/add private-passphrase=($UserVal->"password") ssid-regexp="-wpa\$" \
diff --git a/hotspot-to-wpa.wifi.rsc b/hotspot-to-wpa.wifi.rsc
index e728d7f..86aeed7 100644
--- a/hotspot-to-wpa.wifi.rsc
+++ b/hotspot-to-wpa.wifi.rsc
@@ -17,7 +17,7 @@
:local ScriptName [ :jobname ];
:global EitherOr;
- :global LogPrintExit2;
+ :global LogPrint;
:global ParseKeyValueStore;
:global ScriptLock;
@@ -29,7 +29,8 @@
}
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
- $LogPrintExit2 error $ScriptName ("This script is supposed to run from hotspot on login.") true;
+ $LogPrint error $ScriptName ("This script is supposed to run from hotspot on login.");
+ :error false;
}
:local Date [ /system/clock/get date ];
@@ -42,28 +43,28 @@
:if ([ :len [ /interface/wifi/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={
/interface/wifi/access-list/add comment="--- hotspot-to-wpa above ---" disabled=yes;
- $LogPrintExit2 warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.") false;
+ $LogPrint warning $ScriptName ("Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'.");
}
:local PlaceBefore ([ /interface/wifi/access-list/find where comment="--- hotspot-to-wpa above ---" disabled ]->0);
:if ([ :len [ /interface/wifi/access-list/find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={
/interface/wifi/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
- $LogPrintExit2 warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'.");
}
:local Template [ /interface/wifi/access-list/get ([ find where \
comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
- $LogPrintExit2 info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.") false;
+ $LogPrint info $ScriptName ("Ignoring login for hotspot '" . $Hotspot . "'.");
:error true;
}
# allow login page to load
:delay 1s;
- $LogPrintExit2 info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
- " (user " . $UserName . ").") false;
+ $LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
+ " (user " . $UserName . ").");
/interface/wifi/access-list/remove [ find where mac-address=$MacAddress comment~"^hotspot-to-wpa: " ];
/interface/wifi/access-list/add passphrase=($UserVal->"password") ssid-regexp="-wpa\$" \
mac-address=$MacAddress comment=("hotspot-to-wpa: " . $UserName . ", " . $MacAddress . ", " . $Date) \