aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-04-26 14:21:28 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-04-28 10:38:29 +0200
commit2e8f457109ed2689866501137e93a7378654b195 (patch)
tree64783dbdc5ab0760378b1127a448924d0bb469ca
parent7a714ad182baf8e757b908d6298d6eec085029ab (diff)
hotspot-to-wpa: create template if missing
(cherry picked from commit 3f8d3acd60dab580c590a5a5e87f65cdcceb3433)
-rw-r--r--hotspot-to-wpa9
1 files changed, 7 insertions, 2 deletions
diff --git a/hotspot-to-wpa b/hotspot-to-wpa
index 9ffee91..628d748 100644
--- a/hotspot-to-wpa
+++ b/hotspot-to-wpa
@@ -27,8 +27,13 @@
}
:local PlaceBefore ([ / caps-man access-list find where comment="--- hotspot-to-wpa above ---" disabled ]->0);
-:local Template [ / caps-man access-list get ([ find where disabled \
- comment=("hotspot-to-wpa template " . $Hotspot) ]->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 $0 ("Added template in access-list for hotspot '" . $Hotspot . "'.") false;
+}
+:local Template [ / caps-man access-list get ([ find where \
+ comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ];
:if ($Template->"action" = "reject") do={
$LogPrintExit2 info $0 ("Ignoring login for hotspot '" . $Hotspot . "'.") true;