]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
the protocol encode xlat can't actually take a quoted string
authorAlan T. DeKok <aland@freeradius.org>
Sun, 11 May 2025 13:22:37 +0000 (09:22 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 11 May 2025 13:32:09 +0000 (09:32 -0400)
it has to take an attribute reference, because it manually parses
the input as a tmpl_attr.

We arguably need to update the xlat function arguments to indicate
whether or not the argument expects to see a cursor.  And if so,
perhaps put a pointer to the cursor into a box of FR_TYPE_VOID.

which then lets functions like this either take a cursor of things
to encode, OR a string which is then parsed into a list of things
to encode.

doc/antora/modules/reference/pages/xlat/protocol.adoc

index 8db56059171ccabae1fcff68c23c86963d5cb3a2..7e18df04c737f7c879f3668f189cd1d6aadaf3b1 100644 (file)
@@ -69,15 +69,18 @@ It returns the raw encoded data
 
 [source,unlang]
 ----
-%dhcpv4.encode("Relay-Agent-Information.Circuit-Id = 0xabcdef, Relay-Agent-Information.Remote-Id = 0x010203040506")
-%radius.encode("User-Name = 'ABCD'")
-Tmp-Octets-1 := %dhcpv4.encode(request.Relay-Agent-Information.[*])
+octets data
+
+reply := {
+      User-Name = 'ABCD'
+}
+
+data = %radius.encode(reply)
 ----
 
 .Output
 
 ```
-0x520d0103abcdef0206010203040506
 0x010641424344
 ```