]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
more tests for cast
authorAlan T. DeKok <aland@freeradius.org>
Fri, 29 Sep 2023 17:46:55 +0000 (13:46 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 29 Sep 2023 22:43:32 +0000 (18:43 -0400)
(uint32) &Service-Type

has the cast omitted, as Service-Type is already uint32

However, the cast is still useful, as we may want to print the
integer value of Service-Type!

So we have to do:

(uint32) (&Service-Type)

which is a bit stupid

src/tests/unit/xlat/expr.txt
src/tests/xlat/expr.txt
src/tests/xlat/packet

index a99d9c70a268fc37ad9681597360e2731d583f34..f29dcd55369f1d1e433db974dab80c362b09b4a1 100644 (file)
@@ -135,5 +135,14 @@ match (&reply && (1 < 2))
 xlat_expr 5 + 5 - 10
 match ((5 + 5) - 10)
 
+#
+#  This is arguably wrong
+#
+xlat_expr (integer) &Service-Type
+match &Service-Type
+
+xlat_expr (uint32) (&Service-Type)
+match %(cast:uint32 &Service-Type)
+
 count
-match 65
+match 69
index 38d117956a9708d80399db25e5ebb0d42367dbfa..0ae53f498504a2b5f55749de3d28e3e3ef4a15cc 100644 (file)
@@ -158,3 +158,9 @@ match 0x9f9d51bc70ef21ca5c14f307980a29d8
 #
 xlat_expr (octets) %md5(&User-Name)
 match 0x9f9d51bc70ef21ca5c14f307980a29d8
+
+xlat_expr &Service-Type
+match Framed-User
+
+xlat_expr (uint32) (&Service-Type)
+match 2
index 8b9b0952f5a913549e17ec4ab44810977b7b21cd..f283da7b58541c932589984fd4fdebf716bdcdfa 100644 (file)
@@ -2,3 +2,4 @@ Packet-Type = Access-Request
 User-Name = "bob"
 User-Password = "hello"
 NAS-Identifier = "test"
+Service-Type = ::Framed-User