From 2e8f457109ed2689866501137e93a7378654b195 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 26 Apr 2022 14:21:28 +0200 Subject: hotspot-to-wpa: create template if missing (cherry picked from commit 3f8d3acd60dab580c590a5a5e87f65cdcceb3433) --- hotspot-to-wpa | 9 +++++++-- 1 file 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; -- cgit v1.2.3-70-g09d2