]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
just use %l or %c directly
authorAlan T. DeKok <aland@freeradius.org>
Thu, 12 Oct 2023 20:04:03 +0000 (16:04 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 12 Oct 2023 20:04:03 +0000 (16:04 -0400)
there's no need to convert them to dates, and then cast them to
integers.  Those expansions are already integers

src/tests/modules/redis_ippool/release.unlang
src/tests/modules/redis_ippool/static.unlang
src/tests/modules/redis_ippool/static_unassign.unlang

index 9f80498de79046bcf7a329871367d2e7e1cdfb95..97fc1204d609e7acc667c5bd0c176c9f7c7cf70a 100644 (file)
@@ -59,13 +59,11 @@ if (!("%(redis:HGET {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address} rang
 }
 
 # Check the ZSCORE - releasing an address sets the ZSCORE to now - 1
-&Tmp-Date-0 := "%c"
-
-if (%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) > %(integer:%{Tmp-Date-0})) {
+if (%(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) > %c) {
        test_fail
 }
 
-if (%(integer:%{Tmp-Date-0}) - %(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) > 10) {
+if ((%c - %(redis:ZSCORE {%{control.IP-Pool.Name}}:pool %{reply.Framed-IP-Address}) > 10)) {
        test_fail
 }
 
index 3b44b896e8ea27715b32eac4db9cca0bf71d0297..a23a0a7f136ca2be5f0508ccce245785bef7af4e 100644 (file)
@@ -85,8 +85,7 @@ if ("%(redis:EXISTS {%{control.IP-Pool.Name}}:ip:%{reply.Framed-IP-Address})" ==
 }
 
 # Check the ZSCORE
-&Tmp-Date-0 := "%l"
-if ("%(redis:ZSCORE {%{control.IP-Pool.Name}%}:pool %{reply.Framed-IP-Address})" <= %(integer:%{Tmp-Date-0})) {
+if ("%(redis:ZSCORE {%{control.IP-Pool.Name}%}:pool %{reply.Framed-IP-Address})" <= %l) {
        test_fail
 }
 
index 078f6369d14d7bb6092057c58fd70b24f597b193..d511dcc262bfcfecc55995bd5f95f7f959a1e8d9 100644 (file)
@@ -85,8 +85,7 @@ if ("%(redis:EXISTS {%{control.IP-Pool.Name}}:device:%{Calling-Station-ID})" !=
 }
 
 # Check the ZSCORE
-&Tmp-Date-0 := "%l"
-if ("%(redis:ZSCORE {%{control.IP-Pool.Name}%}:pool %{reply.Framed-IP-Address})" > %(integer:%{Tmp-Date-0})) {
+if ("%(redis:ZSCORE {%{control.IP-Pool.Name}%}:pool %{reply.Framed-IP-Address})" > %l) {
        test_fail
 }