From: Alan T. DeKok Date: Fri, 25 Apr 2025 15:44:06 +0000 (-0400) Subject: rename xlat functions. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec716723c4a8b300e3e6229bb44112f42c55a77c;p=thirdparty%2Ffreeradius-server.git rename xlat functions. via scripts, with some manual fixes to the unit tests. Changing the length of an xlat function changes the offset in a string where an error occurs. perl -p -i -e 's/%concat\(/%str.concat\(/g' $(git grep -l 'concat' doc/antora raddb src/tests) perl -p -i -e 's/%explode\(/%str.split\(/g' $(git grep -l 'explode' doc/antora raddb src/tests) perl -p -i -e 's/%hmacmd5\(/%hmac.md5\(/g' $(git grep -l 'hmacmd5' doc/antora raddb src/tests) perl -p -i -e 's/%hmacmd4\(/%hmac.md4\(/g' $(git grep -l 'hmacmd4' doc/antora raddb src/tests) perl -p -i -e 's/%hmacsha1\(/%hmac.sha1\(/g' $(git grep -l 'hmacsha1' doc/antora raddb src/tests) perl -p -i -e 's/%lpad\(/%str.lpad\(/g' $(git grep -l 'lpad' doc/antora raddb src/tests) perl -p -i -e 's/%rpad\(/%str.rpad\(/g' $(git grep -l 'rpad' doc/antora raddb src/tests) perl -p -i -e 's/%substr\(/%str.substr\(/g' $(git grep -l 'substr' doc/antora raddb src/tests) perl -p -i -e 's/%randstr\(/%str.rand\(/g' $(git grep -l 'randstr' doc/antora raddb src/tests) perl -p -i -e 's/%md4\(/%hash.md4\(/g' $(git grep -l 'md4' doc/antora raddb src/tests) perl -p -i -e 's/%md5\(/%hash.md5\(/g' $(git grep -l 'md5' doc/antora raddb src/tests) perl -p -i -e 's/%sha2_224\(/%hash.sha2_224\(/g' $(git grep -l 'sha2_224' doc/antora raddb src/tests) perl -p -i -e 's/%sha2_256\(/%hash.sha2_256\(/g' $(git grep -l 'sha2_256' doc/antora raddb src/tests) perl -p -i -e 's/%sha2_384\(/%hash.sha2_384\(/g' $(git grep -l 'sha2_384' doc/antora raddb src/tests) perl -p -i -e 's/%sha2_512\(/%hash.sha2_512\(/g' $(git grep -l 'sha2_512' doc/antora raddb src/tests) perl -p -i -e 's/%blake2s_256\(/%hash.blake2s_256\(/g' $(git grep -l 'blake2s_256' doc/antora raddb src/tests) perl -p -i -e 's/%blake2b_512\(/%hash.blake2b_512\(/g' $(git grep -l 'blake2b_512' doc/antora raddb src/tests) perl -p -i -e 's/%sha3_224\(/%hash.sha3_224\(/g' $(git grep -l 'sha3_224' doc/antora raddb src/tests) perl -p -i -e 's/%sha3_256\(/%hash.sha3_256\(/g' $(git grep -l 'sha3_256' doc/antora raddb src/tests) perl -p -i -e 's/%sha3_384\(/%hash.sha3_384\(/g' $(git grep -l 'sha3_384' doc/antora raddb src/tests) perl -p -i -e 's/%sha3_512\(/%hash.sha3_512\(/g' $(git grep -l 'sha3_512' doc/antora raddb src/tests) perl -p -i -e 's/%tolower\(/%str.lower\(/g' $(git grep -l 'tolower' doc/antora raddb src/tests) perl -p -i -e 's/%toupper\(/%str.upper\(/g' $(git grep -l 'toupper' doc/antora raddb src/tests) perl -p -i -e 's/%urlquote\(/%url.quote\(/g' $(git grep -l 'urlquote' doc/antora raddb src/tests) perl -p -i -e 's/%urlunquote\(/%url.unquote\(/g' $(git grep -l 'urlunquote' doc/antora raddb src/tests) --- diff --git a/doc/antora/modules/ROOT/pages/index.adoc b/doc/antora/modules/ROOT/pages/index.adoc index 27669983b4..4bc73b8d61 100644 --- a/doc/antora/modules/ROOT/pages/index.adoc +++ b/doc/antora/modules/ROOT/pages/index.adoc @@ -63,7 +63,7 @@ As of the time of this release, FreeRADIUS: ** The server still doesn't always require (or print) the `::` prefix. That will change. ** By implementing `::` for enums, the requirement to use `&` as a prefix for attribute names is not needed. ** This change may require an update to all of the configuration. We will try to allow `&`, but that may not be possible. -* Dynamic expansions have changed from `%{md5:foo}` to a more standard syntax of `%md5(foo)`. +* Dynamic expansions have changed from `%{md5:foo}` to a more standard syntax of `%hash.md5(foo)`. ** The new syntax supports multiple comma-separated arguments such as `%function(a, b, c)`. ** Expansions such as `%{User-Name}` work in addition to expressions like `%{1+2}` too. ** Alternation `%{foo || bar}` supersedes `%{%{foo}:-%{bar}}` now. diff --git a/doc/antora/modules/howto/pages/installation/upgrade.adoc b/doc/antora/modules/howto/pages/installation/upgrade.adoc index b83a62aaac..dfa1634aa4 100644 --- a/doc/antora/modules/howto/pages/installation/upgrade.adoc +++ b/doc/antora/modules/howto/pages/installation/upgrade.adoc @@ -735,7 +735,7 @@ for further information. == Xlat expansions -xref:reference:xlat/index.adoc[xlat] expansions have been changed from syntax like `%{md5:...}` to `%md5(...)`. +xref:reference:xlat/index.adoc[xlat] expansions have been changed from syntax like `%{md5:...}` to `%hash.md5(...)`. === Removed expansions diff --git a/doc/antora/modules/reference/pages/raddb/mods-available/cache.adoc b/doc/antora/modules/reference/pages/raddb/mods-available/cache.adoc index 29932ffa55..04ca629c81 100644 --- a/doc/antora/modules/reference/pages/raddb/mods-available/cache.adoc +++ b/doc/antora/modules/reference/pages/raddb/mods-available/cache.adoc @@ -432,7 +432,7 @@ cache { update { reply.Reply-Message := reply.Reply-Message reply.Reply-Message += "Cache last updated at %t" - reply.Class := "%randstr(ssssssssssssssssssssssssssssssss)" + reply.Class := "%str.rand(ssssssssssssssssssssssssssssssss)" } } ``` diff --git a/doc/antora/modules/reference/pages/raddb/mods-available/rest.adoc b/doc/antora/modules/reference/pages/raddb/mods-available/rest.adoc index 90acf6deea..bfaca7ce75 100644 --- a/doc/antora/modules/reference/pages/raddb/mods-available/rest.adoc +++ b/doc/antora/modules/reference/pages/raddb/mods-available/rest.adoc @@ -215,7 +215,7 @@ In the `request { ... }` subsection, the following config items may be listed: may be specified with `body`. Will be expanded. Values from expansion will not be escaped, this should be done using the appropriate `xlat` method e.g. - `%urlquote()` + `%url.quote()` | `auth` | HTTP auth method to use, one of 'none', 'srp', 'basic', | yes 'digest', 'digest-ie', 'gss-negotiate', 'ntlm', 'ntlm-winbind', 'any', 'safe'. defaults to _'none'_. diff --git a/doc/antora/modules/reference/pages/raddb/sites-available/challenge.adoc b/doc/antora/modules/reference/pages/raddb/sites-available/challenge.adoc index 96b2d99592..b32135cafe 100644 --- a/doc/antora/modules/reference/pages/raddb/sites-available/challenge.adoc +++ b/doc/antora/modules/reference/pages/raddb/sites-available/challenge.adoc @@ -66,7 +66,7 @@ immediately. Set the random number to save. ``` - session-state.challenge-string := "%randstr(n)" + session-state.challenge-string := "%str.rand(n)" reply.Reply-Message := "Please enter %{session-state.challenge-string}: " ``` diff --git a/doc/antora/modules/reference/pages/raddb/sites-available/coa-relay.adoc b/doc/antora/modules/reference/pages/raddb/sites-available/coa-relay.adoc index 8999458ee8..c35d6766f4 100644 --- a/doc/antora/modules/reference/pages/raddb/sites-available/coa-relay.adoc +++ b/doc/antora/modules/reference/pages/raddb/sites-available/coa-relay.adoc @@ -163,7 +163,7 @@ Keep a count of what we send. Split the string and split into pieces. ``` - if ("%explode(control.user-session, '|')") { + if ("%str.split(control.user-session, '|')") { foreach control.user-session { ``` diff --git a/doc/antora/modules/reference/pages/raddb/sites-available/default.adoc b/doc/antora/modules/reference/pages/raddb/sites-available/default.adoc index 13e60b6950..1db5ca3c7b 100644 --- a/doc/antora/modules/reference/pages/raddb/sites-available/default.adoc +++ b/doc/antora/modules/reference/pages/raddb/sites-available/default.adoc @@ -1276,7 +1276,7 @@ Service-Type = ::Authorize-Only. ``` # if (!reply.State) { -# reply.State := "0x%randstr(16h)" +# reply.State := "0x%str.rand(16h)" # } ``` diff --git a/doc/antora/modules/reference/pages/raddb/sites-available/eap-aka-sim.adoc b/doc/antora/modules/reference/pages/raddb/sites-available/eap-aka-sim.adoc index 6ceb7b3bdc..039281843d 100644 --- a/doc/antora/modules/reference/pages/raddb/sites-available/eap-aka-sim.adoc +++ b/doc/antora/modules/reference/pages/raddb/sites-available/eap-aka-sim.adoc @@ -567,7 +567,7 @@ values: - The encrypt expansions of the `rlm_cipher` module. - The `%3gpp_temporary_id_encrypt()` expansion. -- The `%randstr()` expansion. +- The `%str.rand()` expansion. NOTE: Add a `reply.Next-Pseudonym-Id` attribute in this section to avoid having the permanent Id of the SIM exposed during subsequent diff --git a/doc/antora/modules/reference/pages/raddb/sites-available/ldap_sync.adoc b/doc/antora/modules/reference/pages/raddb/sites-available/ldap_sync.adoc index 8cc7401e66..614027fbad 100644 --- a/doc/antora/modules/reference/pages/raddb/sites-available/ldap_sync.adoc +++ b/doc/antora/modules/reference/pages/raddb/sites-available/ldap_sync.adoc @@ -434,7 +434,7 @@ server settings as ldap_sync. ``` ``` -# csn := %concat(%ldap("ldap:///%ldap.uri.safe(%{LDAP-Sync.Directory-Root-DN})?contextCSN?base"), ';') +# csn := %str.concat(%ldap("ldap:///%ldap.uri.safe(%{LDAP-Sync.Directory-Root-DN})?contextCSN?base"), ';') # reply.LDAP-Sync.Cookie := "rid=000,csn=%{csn}" # } } diff --git a/doc/antora/modules/reference/pages/type/cast.adoc b/doc/antora/modules/reference/pages/type/cast.adoc index bccc06947e..668282a88a 100644 --- a/doc/antora/modules/reference/pages/type/cast.adoc +++ b/doc/antora/modules/reference/pages/type/cast.adoc @@ -147,24 +147,24 @@ attribute, which each carry one octet of the IP address. .Example Creating multiple Attributes ---- -Tmp-Integer-0 := %explode("192.168.0.1", '.') +Tmp-Integer-0 := %str.split("192.168.0.1", '.') ---- If you need to cast an entire list to a value, then the value being cast should be surrounded by brackets. -In the following example, the `%explode()` function will return a list +In the following example, the `%str.split()` function will return a list of four values: `{"192", "168", "0", "1"}`. Casting that to a string causes the values to be merged together, The resulting string is `"19216801"`. If you need to add text in between each list entry, see the -`%concat()` function in the xref:xlat/builtin.adoc[built-in +`%str.concat()` function in the xref:xlat/builtin.adoc[built-in expansions] list. .Example Creating multiple Attributes ---- -reply.Reply-Message := (string) (%explode("192.168.0.1", '.')) +reply.Reply-Message := (string) (%str.split("192.168.0.1", '.')) ---- === Other Data Types diff --git a/doc/antora/modules/reference/pages/xlat/concat.adoc b/doc/antora/modules/reference/pages/xlat/concat.adoc index d3475336f9..249481eedf 100644 --- a/doc/antora/modules/reference/pages/xlat/concat.adoc +++ b/doc/antora/modules/reference/pages/xlat/concat.adoc @@ -1,4 +1,4 @@ -= %concat(, ) += %str.concat(, ) Used to join two or more attributes, separated by an optional delimiter. @@ -6,7 +6,7 @@ This expansion is the inverse of xref:xlat/explode.adoc[explode]. .Return: _string_ -In most cases, `%concat(...)` is only useful inside of a dynamically +In most cases, `%str.concat(...)` is only useful inside of a dynamically expanded string. If you need to concatenate strings together in a policy, just use `+`. .Example @@ -20,8 +20,8 @@ control += { } reply += { - Reply-Message = "%concat(%{control.Tmp-String-0[*]}, ', ')" - Reply-Message = "%concat(%{control.Tmp-String-0[*]}, ',')" + Reply-Message = "%str.concat(%{control.Tmp-String-0[*]}, ', ')" + Reply-Message = "%str.concat(%{control.Tmp-String-0[*]}, ',')" } ---- diff --git a/doc/antora/modules/reference/pages/xlat/conversion.adoc b/doc/antora/modules/reference/pages/xlat/conversion.adoc index 34a7034aaf..6233d237a3 100644 --- a/doc/antora/modules/reference/pages/xlat/conversion.adoc +++ b/doc/antora/modules/reference/pages/xlat/conversion.adoc @@ -82,7 +82,7 @@ reply.Reply-Message := "The value of %{control.Tmp-String-0} in hex is %hex(%{co The value of 12345 in hex is 3132333435 ``` -== %urlquote( ... ) +== %url.quote( ... ) Quote URL special characters. @@ -94,7 +94,7 @@ Quote URL special characters. ---- control.Tmp-String-0 := "http://example.org/" reply += { - Reply-Message = "The urlquote of %{control.Tmp-String-0} is %urlquote(%{control.Tmp-String-0})" + Reply-Message = "The urlquote of %{control.Tmp-String-0} is %url.quote(%{control.Tmp-String-0})" } ---- @@ -104,7 +104,7 @@ reply += { The urlquote of http://example.org/ is http%3A%2F%2Fexample.org%2F ``` -== %urlunquote( ... ) +== %url.unquote( ... ) Unquote URL special characters. @@ -116,7 +116,7 @@ Unquote URL special characters. ---- control.Tmp-String-0 := "http%%3A%%2F%%2Fexample.org%%2F" # Attention for the double %. reply += { - Reply-Message = "The urlunquote of %{control.Tmp-String-0} is %urlunquote(%{control.Tmp-String-0})" + Reply-Message = "The urlunquote of %{control.Tmp-String-0} is %url.unquote(%{control.Tmp-String-0})" } ---- diff --git a/doc/antora/modules/reference/pages/xlat/dict.adoc b/doc/antora/modules/reference/pages/xlat/dict.adoc index 675a3193e3..dad1ef652d 100644 --- a/doc/antora/modules/reference/pages/xlat/dict.adoc +++ b/doc/antora/modules/reference/pages/xlat/dict.adoc @@ -5,13 +5,13 @@ The following functions perform lookups based on dictionary names and numbers. The functions are defined in the `dict` module. It must be listed in the `mods-enabled/` directory in order for the expansions to work. -== %concat(, ) +== %str.concat(, ) Used to join two or more attributes, separated by an optional delimiter. .Return: _string_ -In most cases, `%concat(...)` is only useful inside of a dynamically +In most cases, `%str.concat(...)` is only useful inside of a dynamically expanded string. If you need to concatenate strings together in a policy, just use `+`. .Example @@ -25,8 +25,8 @@ control += { } reply += { - Reply-Message = "%concat(%{control.Tmp-String-0[*]}, ', ')" - Reply-Message = "%concat(%{control.Tmp-String-0[*]}, ',')" + Reply-Message = "%str.concat(%{control.Tmp-String-0[*]}, ', ')" + Reply-Message = "%str.concat(%{control.Tmp-String-0[*]}, ',')" } ---- @@ -47,11 +47,11 @@ foo += { "a", "c", "c", "d" } # abcd foo += control.Tmp-String-0[*] ---- -== %explode(, ) +== %str.split(, ) Split an string into multiple new strings based on a delimiter. -This expansion is the opposite of `%concat( ... )`. +This expansion is the opposite of `%str.concat( ... )`. .Return: _the number exploded list of strings_. @@ -61,7 +61,7 @@ This expansion is the opposite of `%concat( ... )`. ---- control.Tmp-String-0 := "bob.toba@domain.com" -control.Tmp-String-1 := "%explode(control.Tmp-String-0, '@')" +control.Tmp-String-1 := "%str.split(control.Tmp-String-0, '@')" reply.Reply-Message := "Welcome %{control.Tmp-String-1[0]}" ---- @@ -72,7 +72,7 @@ reply.Reply-Message := "Welcome %{control.Tmp-String-1[0]}" Welcome bob.toba ``` -== %lpad(, , ) +== %str.lpad(, , ) Left-pad a string. @@ -84,7 +84,7 @@ Left-pad a string. ---- control.Tmp-String-0 := "123" -reply.Reply-Message := "Maximum should be %lpad(%{control.Tmp-String-0}, 11, '0')" +reply.Reply-Message := "Maximum should be %str.lpad(%{control.Tmp-String-0}, 11, '0')" ---- .Output @@ -93,7 +93,7 @@ reply.Reply-Message := "Maximum should be %lpad(%{control.Tmp-String-0}, 11, '0' Maximum should be 00000000123 ``` -== %rpad(, , ) +== %str.rpad(, , ) Right-pad a string. @@ -105,7 +105,7 @@ Right-pad a string. ---- control.Tmp-String-0 := "123" -reply.Reply-Message := "Maximum should be %rpad(%{control.Tmp-String-0}, 11, '0')" +reply.Reply-Message := "Maximum should be %str.rpad(%{control.Tmp-String-0}, 11, '0')" ---- .Output @@ -134,7 +134,7 @@ reply.Reply-Message := "Serialize output: %pairs(control.[*])" Serialize output: Tmp-String-0 = "\"This is a string\", Tmp-String-0 = \"This is another one\"" ``` -== %randstr( ...) +== %str.rand( ...) Get random string built from character classes. @@ -144,7 +144,7 @@ Get random string built from character classes. [source,unlang] ---- -reply.Reply-Message := "The random string output is %randstr(aaaaaaaa}" +reply.Reply-Message := "The random string output is %str.rand(aaaaaaaa}" ---- .Output @@ -153,7 +153,7 @@ reply.Reply-Message := "The random string output is %randstr(aaaaaaaa}" The random string output is 4Uq0gPyG ``` -== %tolower( ... ) +== %str.lower( ... ) Dynamically expands the string and returns the lowercase version of it. This definition is only available in version 2.1.10 and later. @@ -165,7 +165,7 @@ it. This definition is only available in version 2.1.10 and later. [source,unlang] ---- control.Tmp-String-0 := "CAIPIRINHA" -reply.Reply-Message := "tolower of %{control.Tmp-String-0} is %tolower(%{control.Tmp-String-0})" +reply.Reply-Message := "tolower of %{control.Tmp-String-0} is %str.lower(%{control.Tmp-String-0})" ---- .Output @@ -174,7 +174,7 @@ reply.Reply-Message := "tolower of %{control.Tmp-String-0} is %tolower(%{control tolower of CAIPIRINHA is caipirinha ``` -== %toupper( ... ) +== %str.upper( ... ) Dynamically expands the string and returns the uppercase version of it. This definition is only available in version 2.1.10 and later. @@ -186,7 +186,7 @@ it. This definition is only available in version 2.1.10 and later. [source,unlang] ---- control.Tmp-String-0 := "caipirinha" -reply.Reply-Message := "toupper of %{control.Tmp-String-0} is " + %toupper(%{control.Tmp-String-0}) +reply.Reply-Message := "toupper of %{control.Tmp-String-0} is " + %str.upper(%{control.Tmp-String-0}) ---- .Output diff --git a/doc/antora/modules/reference/pages/xlat/explode.adoc b/doc/antora/modules/reference/pages/xlat/explode.adoc index 09217687d5..bf174aef55 100644 --- a/doc/antora/modules/reference/pages/xlat/explode.adoc +++ b/doc/antora/modules/reference/pages/xlat/explode.adoc @@ -1,4 +1,4 @@ -= %explode(, ) += %str.split(, ) Split an string into multiple new strings based on a delimiter. @@ -12,7 +12,7 @@ This expansion is the inverse of xref:xlat/concat.adoc[concat]. ---- control.Tmp-String-0 := "bob.toba@domain.com" -control.Tmp-String-1 := "%explode(control.Tmp-String-0, '@')" +control.Tmp-String-1 := "%str.split(control.Tmp-String-0, '@')" reply.Reply-Message := "Welcome %{control.Tmp-String-1[0]}" ---- diff --git a/doc/antora/modules/reference/pages/xlat/function.adoc b/doc/antora/modules/reference/pages/xlat/function.adoc index 98d61e44f1..6cf8342eab 100644 --- a/doc/antora/modules/reference/pages/xlat/function.adoc +++ b/doc/antora/modules/reference/pages/xlat/function.adoc @@ -27,7 +27,7 @@ call syntax is for that function. .Example [source,unlang] ---- -if (User-Name == %md5(NAS-Identifier)) { +if (User-Name == %hash.md5(NAS-Identifier)) { reject } ---- diff --git a/doc/antora/modules/reference/pages/xlat/hash.adoc b/doc/antora/modules/reference/pages/xlat/hash.adoc index 6a0511768e..5492ffb602 100644 --- a/doc/antora/modules/reference/pages/xlat/hash.adoc +++ b/doc/antora/modules/reference/pages/xlat/hash.adoc @@ -6,7 +6,7 @@ Note that the server supports insecure hashing methods such as MD5 and SHA1. These functions are here for historical compatibility and completeness. -== %hmacmd5(, ) +== %hmac.md5(, ) Generate `HMAC-MD5` of string. @@ -18,7 +18,7 @@ Generate `HMAC-MD5` of string. ---- control.Tmp-String-0 := "mykey" control.Tmp-String-1 := "Caipirinha" -reply.control.Tmp-Octets-0 := "%hmacmd5(%{control.Tmp-String-0} %{control.Tmp-String-1})" +reply.control.Tmp-Octets-0 := "%hmac.md5(%{control.Tmp-String-0} %{control.Tmp-String-1})" reply += { Reply-Message = "The HMAC-MD5 of %{control.Tmp-String-1} in octets is %{control.Tmp-Octets-0}" @@ -33,7 +33,7 @@ The HMAC-MD5 of Caipirinha in octets is \317}\264@K\216\371\035\304\367\202,c\37 The HMAC-MD5 of Caipirinha in hex is 636f6e74726f6c3a546d702d4f63746574732d30 ``` -== %hmacsha1(, ) +== %hmac.sha1(, ) Generate `HMAC-SHA1` of string. @@ -45,7 +45,7 @@ Generate `HMAC-SHA1` of string. ---- control.Tmp-String-0 := "mykey" control.Tmp-String-1 := "Caipirinha" -control.Tmp-Octets-0 := "%hmacsha1(%{control.Tmp-String-0}, %{control.Tmp-String-1})" +control.Tmp-Octets-0 := "%hmac.sha1(%{control.Tmp-String-0}, %{control.Tmp-String-1})" reply += { Reply-Message = "The HMAC-SHA1 of %{control.Tmp-String-1} in octets is %{control.Tmp-Octets-0}" @@ -60,7 +60,7 @@ The HMAC-SHA1 of Caipirinha in octets is \311\007\212\234j\355\207\035\225\256\3 The HMAC-SHA1 of Caipirinha in hex is 636f6e74726f6c3a546d702d4f63746574732d30 ``` -== %md5( ... ) +== %hash.md5( ... ) Dynamically expands the string and performs an MD5 hash on it. The result is binary data. @@ -73,8 +73,8 @@ result is binary data. ---- control.Tmp-String-0 := "Caipirinha" reply += { - Reply-Message = "md5 of %{control.Tmp-String-0} is octal=%md5(%{control.Tmp-String-0})" - Reply-Message = "md5 of %{control.Tmp-String-0} is hex=%hex(%md5(%{control.Tmp-String-0}))" + Reply-Message = "md5 of %{control.Tmp-String-0} is octal=%hash.md5(%{control.Tmp-String-0})" + Reply-Message = "md5 of %{control.Tmp-String-0} is hex=%hex(%hash.md5(%{control.Tmp-String-0}))" } ---- @@ -90,8 +90,8 @@ md5 of Caipirinha is hex=14840b6d647c7c98a3e732f833d86ea9 The following hashes are supported for all versions of OpenSSL. * `%md2( ... }` -* `%md4( ... }` -* `%md5( ... }` +* `%hash.md4( ... }` +* `%hash.md5( ... }` * `%sha1( ... }` * `%sha224( ... }` * `%sha256( ... }` @@ -102,16 +102,16 @@ The following hashes are supported for when OpenSSL 1.1.1 or greater is installed. This version adds support for the `sha3` and `blake` families of digest functions. -* `%blake2s_256( ... )` -* `%blake2b_512( ... )` -* `%sha2_224( ... )` -* `%sha2_256( ... )` -* `%sha2_384( ... )` -* `%sha2_512( ... )` -* `%sha3_224( ... )` -* `%sha3_256( ... )` -* `%sha3_384( ... )` -* `%sha3_512( ... )` +* `%hash.blake2s_256( ... )` +* `%hash.blake2b_512( ... )` +* `%hash.sha2_224( ... )` +* `%hash.sha2_256( ... )` +* `%hash.sha2_384( ... )` +* `%hash.sha2_512( ... )` +* `%hash.sha3_224( ... )` +* `%hash.sha3_256( ... )` +* `%hash.sha3_384( ... )` +* `%hash.sha3_512( ... )` .Return: _octal_ @@ -121,8 +121,8 @@ families of digest functions. ---- control.Tmp-String-0 := "Caipirinha" reply += { - Reply-Message = "The md5 of %{control.Tmp-String-0} in octal is %md5(%{control.Tmp-String-0}}" - Reply-Message = "The md5 of %{control.Tmp-String-0} in hex is %hex(%md5(%{control.Tmp-String-0}}}" + Reply-Message = "The md5 of %{control.Tmp-String-0} in octal is %hash.md5(%{control.Tmp-String-0}}" + Reply-Message = "The md5 of %{control.Tmp-String-0} in hex is %hex(%hash.md5(%{control.Tmp-String-0}}}" } ---- diff --git a/doc/antora/modules/reference/pages/xlat/lpad.adoc b/doc/antora/modules/reference/pages/xlat/lpad.adoc index e4d194603b..32c1f77e7d 100644 --- a/doc/antora/modules/reference/pages/xlat/lpad.adoc +++ b/doc/antora/modules/reference/pages/xlat/lpad.adoc @@ -1,4 +1,4 @@ -= %lpad(, , ) += %str.lpad(, , ) Left-pad a string. @@ -10,7 +10,7 @@ Left-pad a string. ---- control.Tmp-String-0 := "123" -reply.Reply-Message := "Maximum should be %lpad(%{control.Tmp-String-0}, 11, '0')" +reply.Reply-Message := "Maximum should be %str.lpad(%{control.Tmp-String-0}, 11, '0')" ---- .Output diff --git a/doc/antora/modules/reference/pages/xlat/randstr.adoc b/doc/antora/modules/reference/pages/xlat/randstr.adoc index f3c784b1f1..fe8d7efebe 100644 --- a/doc/antora/modules/reference/pages/xlat/randstr.adoc +++ b/doc/antora/modules/reference/pages/xlat/randstr.adoc @@ -1,4 +1,4 @@ -= %randstr( ) += %str.rand( ) Get random string built from input character classes. @@ -32,7 +32,7 @@ There is no `h` for "hex". Instead, use `b` to create binary data, followed by [source,unlang] ---- -reply.Reply-Message := "The random string output is %randstr(8a)" +reply.Reply-Message := "The random string output is %str.rand(8a)" ---- .Output diff --git a/doc/antora/modules/reference/pages/xlat/rpad.adoc b/doc/antora/modules/reference/pages/xlat/rpad.adoc index 8e20957100..757308d07a 100644 --- a/doc/antora/modules/reference/pages/xlat/rpad.adoc +++ b/doc/antora/modules/reference/pages/xlat/rpad.adoc @@ -1,4 +1,4 @@ -= %rpad(, , ) += %str.rpad(, , ) Right-pad a string. @@ -10,7 +10,7 @@ Right-pad a string. ---- control.Tmp-String-0 := "123" -reply.Reply-Message := "Maximum should be %rpad(%{control.Tmp-String-0}, 11, '0')" +reply.Reply-Message := "Maximum should be %str.rpad(%{control.Tmp-String-0}, 11, '0')" ---- .Output diff --git a/doc/antora/modules/reference/pages/xlat/tolower.adoc b/doc/antora/modules/reference/pages/xlat/tolower.adoc index 0991fc066f..df503742ff 100644 --- a/doc/antora/modules/reference/pages/xlat/tolower.adoc +++ b/doc/antora/modules/reference/pages/xlat/tolower.adoc @@ -1,4 +1,4 @@ -= %tolower( ... ) += %str.lower( ... ) Dynamically expands the string and returns the lowercase version of it. @@ -12,7 +12,7 @@ The lowercase operation is done using the current locale. [source,unlang] ---- control.Tmp-String-0 := "CAIPIRINHA" -reply.Reply-Message := "tolower of %{control.Tmp-String-0} is %tolower(%{control.Tmp-String-0})" +reply.Reply-Message := "tolower of %{control.Tmp-String-0} is %str.lower(%{control.Tmp-String-0})" ---- .Output diff --git a/doc/antora/modules/reference/pages/xlat/toupper.adoc b/doc/antora/modules/reference/pages/xlat/toupper.adoc index 7a88d073f4..dd0288bf4a 100644 --- a/doc/antora/modules/reference/pages/xlat/toupper.adoc +++ b/doc/antora/modules/reference/pages/xlat/toupper.adoc @@ -1,4 +1,4 @@ -= %toupper( ... ) += %str.upper( ... ) Dynamically expands the string and returns the uppercase version of it. @@ -12,7 +12,7 @@ The uppercasecase operation is done using the current locale. [source,unlang] ---- control.Tmp-String-0 := "caipirinha" -reply.Reply-Message := "toupper of %{control.Tmp-String-0} is " + %toupper(%{control.Tmp-String-0}) +reply.Reply-Message := "toupper of %{control.Tmp-String-0} is " + %str.upper(%{control.Tmp-String-0}) ---- .Output diff --git a/raddb/mods-available/cache b/raddb/mods-available/cache index 91c4a0b9be..11d6450dab 100644 --- a/raddb/mods-available/cache +++ b/raddb/mods-available/cache @@ -269,7 +269,7 @@ cache { reply.Reply-Message += "Cache last updated at %t" # Add your own value for `Class`. - reply.Class := "%randstr(ssssssssssssssssssssssssssssssss)" + reply.Class := "%str.rand(ssssssssssssssssssssssssssssssss)" } # diff --git a/raddb/mods-available/rest b/raddb/mods-available/rest index 1c2762a115..8b2bb631bd 100644 --- a/raddb/mods-available/rest +++ b/raddb/mods-available/rest @@ -237,7 +237,7 @@ rest { # may be specified with `body`. Will be expanded. # Values from expansion will not be escaped, this should be # done using the appropriate `xlat` method e.g. - # `%urlquote()` + # `%url.quote()` # | `auth` | HTTP auth method to use, one of 'none', 'srp', 'basic', | yes # 'digest', 'digest-ie', 'gss-negotiate', 'ntlm', # 'ntlm-winbind', 'any', 'safe'. defaults to _'none'_. diff --git a/raddb/policy.d/accounting b/raddb/policy.d/accounting index a918aff997..a206305cf7 100644 --- a/raddb/policy.d/accounting +++ b/raddb/policy.d/accounting @@ -27,7 +27,7 @@ class_value_prefix = 'ai:' # We fix this issue by converting the MD5 inputs into printable # string form. # -# Similarly, the output of `%md5(..)` is binary safe, and is +# Similarly, the output of `%hash.md5(..)` is binary safe, and is # therefore a binary blob. We therefore convert the output # of it to a printable string via `%hex(...)` # @@ -58,7 +58,7 @@ acct_unique { # wireless environment). # if (Class =~ /${policy.class_value_prefix}([0-9a-f]{32})/i) { - request.Acct-Unique-Session-Id := %hex(%md5("%{1}%{Acct-Session-ID}")) + request.Acct-Unique-Session-Id := %hex(%hash.md5("%{1}%{Acct-Session-ID}")) } # @@ -68,7 +68,7 @@ acct_unique { # is not included # else { - request.Acct-Unique-Session-Id := %hex(%md5("%{User-Name},%{Acct-Multi-Session-ID},%{Acct-Session-ID},%{NAS-IPv6-Address || NAS-IP-Address},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}")) + request.Acct-Unique-Session-Id := %hex(%hash.md5("%{User-Name},%{Acct-Multi-Session-ID},%{Acct-Session-ID},%{NAS-IPv6-Address || NAS-IP-Address},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}")) } } @@ -76,7 +76,7 @@ acct_unique { # Insert a (hopefully unique) value into class # insert_acct_class { - reply.Class = '${policy.class_value_prefix}' + %hex(%md5("%t%I%{Net.Src.Port}%{Net.Src.IP}%{NAS-IP-Address}%{Calling-Station-ID}%{User-Name}")) + reply.Class = '${policy.class_value_prefix}' + %hex(%hash.md5("%t%I%{Net.Src.Port}%{Net.Src.IP}%{NAS-IP-Address}%{Calling-Station-ID}%{User-Name}")) } # diff --git a/raddb/policy.d/canonicalisation b/raddb/policy.d/canonicalisation index ba3f548c6d..c7f00c1596 100644 --- a/raddb/policy.d/canonicalisation +++ b/raddb/policy.d/canonicalisation @@ -52,7 +52,7 @@ mac-addr-regexp = '([0-9a-f]{2})[^0-9a-f]?([0-9a-f]{2})[^0-9a-f]?([0-9a-f]{2})[^ # rewrite_called_station_id { if (Called-Station-Id && (Called-Station-Id =~ /^${policy.mac-addr-regexp}([^0-9a-f](.+))?$/i)) { - request.Called-Station-Id := %toupper("%{1}-%{2}-%{3}-%{4}-%{5}-%{6}") + request.Called-Station-Id := %str.upper("%{1}-%{2}-%{3}-%{4}-%{5}-%{6}") # SSID component? if (%{8}) { @@ -74,7 +74,7 @@ rewrite_called_station_id { # rewrite_calling_station_id { if (Calling-Station-Id && (Calling-Station-Id =~ /^${policy.mac-addr-regexp}$/i)) { - request.Calling-Station-Id := %toupper("%{1}-%{2}-%{3}-%{4}-%{5}-%{6}") + request.Calling-Station-Id := %str.upper("%{1}-%{2}-%{3}-%{4}-%{5}-%{6}") updated } diff --git a/raddb/policy.d/cui b/raddb/policy.d/cui index 32d2f44522..68e52ca8ca 100644 --- a/raddb/policy.d/cui +++ b/raddb/policy.d/cui @@ -54,7 +54,7 @@ cui.authorize { cui.post-auth { if (!control.Proxy-To-Realm && Chargeable-User-Identity && !reply.Chargeable-User-Identity && (Operator-Name || ('${policy.cui_require_operator_name}' != 'yes')) ) { - reply.Chargeable-User-Identity = %sha1("${policy.cui_hash_key}%tolower(%{User-Name}%{Operator-Name || ''})") + reply.Chargeable-User-Identity = %sha1("${policy.cui_hash_key}%str.lower(%{User-Name}%{Operator-Name || ''})") } # @@ -77,7 +77,7 @@ cui.post-auth { cui-inner.post-auth { if (outer.request.Chargeable-User-Identity && \ (outer.request.Operator-Name || ('${policy.cui_require_operator_name}' != 'yes'))) { - reply.Chargeable-User-Identity := %sha1("${policy.cui_hash_key}%tolower(%{User-Name}%{outer.request.Operator-Name || ''})") + reply.Chargeable-User-Identity := %sha1("${policy.cui_hash_key}%str.lower(%{User-Name}%{outer.request.Operator-Name || ''})") } } diff --git a/raddb/policy.d/filter b/raddb/policy.d/filter index 3f12f2a443..d904f9e11b 100644 --- a/raddb/policy.d/filter +++ b/raddb/policy.d/filter @@ -37,7 +37,7 @@ filter_username { # # reject mixed case e.g. "UseRNaMe" # - #if (User-Name != %tolower(User-Name)) { + #if (User-Name != %str.lower(User-Name)) { # reject #} @@ -126,7 +126,7 @@ filter_password { # Because "\000" yields "zero length delimiter is not allowed" # delim = 0x00 - tmp.User-Password := %explode(%{User-Password}, "%{delim}") + tmp.User-Password := %str.split(%{User-Password}, "%{delim}") User-Password := tmp.User-Password[0] } diff --git a/raddb/sites-available/challenge b/raddb/sites-available/challenge index 02bc5348c8..15ca6191b4 100644 --- a/raddb/sites-available/challenge +++ b/raddb/sites-available/challenge @@ -58,7 +58,7 @@ authenticate step1 { # # Set the random number to save. # - session-state.challenge-string := "%randstr(n)" + session-state.challenge-string := "%str.rand(n)" reply.Reply-Message := "Please enter %{session-state.challenge-string}: " # diff --git a/raddb/sites-available/coa-relay b/raddb/sites-available/coa-relay index 3fa36dd24b..440cc8b68a 100644 --- a/raddb/sites-available/coa-relay +++ b/raddb/sites-available/coa-relay @@ -147,7 +147,7 @@ server coa { # # Split the string and split into pieces. # - if ("%explode(control.user-session, '|')") { + if ("%str.split(control.user-session, '|')") { foreach control.user-session { # diff --git a/raddb/sites-available/default b/raddb/sites-available/default index efd14d522d..e4508cfeb5 100644 --- a/raddb/sites-available/default +++ b/raddb/sites-available/default @@ -1132,7 +1132,7 @@ send Access-Accept { # Service-Type = ::Authorize-Only. # # if (!reply.State) { -# reply.State := "0x%randstr(16h)" +# reply.State := "0x%str.rand(16h)" # } # diff --git a/raddb/sites-available/eap-aka-sim b/raddb/sites-available/eap-aka-sim index cf5361c1d4..95d6ef848d 100644 --- a/raddb/sites-available/eap-aka-sim +++ b/raddb/sites-available/eap-aka-sim @@ -530,7 +530,7 @@ server eap-aka-sim { # # - The encrypt expansions of the `rlm_cipher` module. # - The `%3gpp_temporary_id_encrypt()` expansion. - # - The `%randstr()` expansion. + # - The `%str.rand()` expansion. # # NOTE: Add a `reply.Next-Pseudonym-Id` attribute in this section to # avoid having the permanent Id of the SIM exposed during subsequent diff --git a/raddb/sites-available/ldap_sync b/raddb/sites-available/ldap_sync index b92a43fdb0..9df4499f45 100644 --- a/raddb/sites-available/ldap_sync +++ b/raddb/sites-available/ldap_sync @@ -383,7 +383,7 @@ server ldap_sync { # if (!reply.LDAP-Sync.Cookie) { # string csn # -# csn := %concat(%ldap("ldap:///%ldap.uri.safe(%{LDAP-Sync.Directory-Root-DN})?contextCSN?base"), ';') +# csn := %str.concat(%ldap("ldap:///%ldap.uri.safe(%{LDAP-Sync.Directory-Root-DN})?contextCSN?base"), ';') # reply.LDAP-Sync.Cookie := "rid=000,csn=%{csn}" # } } diff --git a/src/tests/keywords/acct_unique b/src/tests/keywords/acct_unique index 8ef157297f..b168dd0006 100644 --- a/src/tests/keywords/acct_unique +++ b/src/tests/keywords/acct_unique @@ -4,7 +4,7 @@ # Test the acct_unique policy # # -Acct-Unique-Session-Id := %hex(%md5("%{User-Name},%{Acct-Multi-Session-ID},%{Acct-Session-ID},%{NAS-IPv6-Address || NAS-IP-Address},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}")) +Acct-Unique-Session-Id := %hex(%hash.md5("%{User-Name},%{Acct-Multi-Session-ID},%{Acct-Session-ID},%{NAS-IPv6-Address || NAS-IP-Address},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}")) if Acct-Unique-Session-Id != "159dccf021583d7413b0114a090529ca" { test_fail diff --git a/src/tests/keywords/alternation-error b/src/tests/keywords/alternation-error index a2410bb855..7a70206e8d 100644 --- a/src/tests/keywords/alternation-error +++ b/src/tests/keywords/alternation-error @@ -1 +1 @@ -request.Acct-Unique-Session-Id := %hex(%md5("%{User-Name},%{Acct-Multi-Session-ID},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}")) # ERROR +request.Acct-Unique-Session-Id := %hex(%hash.md5("%{User-Name},%{Acct-Multi-Session-ID},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}")) # ERROR diff --git a/src/tests/keywords/concat b/src/tests/keywords/concat index 11c4db3cfc..d83510fd8a 100644 --- a/src/tests/keywords/concat +++ b/src/tests/keywords/concat @@ -46,35 +46,35 @@ control -= NAS-Port[*] ok # separate updates -result_string := %concat(%{control.[*]}, ', ') +result_string := %str.concat(%{control.[*]}, ', ') "%{result_string}" if (!(result_string == "bob, hello, ab c, de fg, 123")) { test_fail } -result_string := %concat(%{control.Calling-Station-Id[*]}, ', ') +result_string := %str.concat(%{control.Calling-Station-Id[*]}, ', ') if (!(result_string == "ab c, de fg")) { test_fail } # Empty separator -result_string := %concat(%{control.Calling-Station-Id[*]}) +result_string := %str.concat(%{control.Calling-Station-Id[*]}) if (!(result_string == "ab cde fg")) { test_fail } # Single character separator -result_string := %concat(%{control.Calling-Station-Id[*]}, ',') +result_string := %str.concat(%{control.Calling-Station-Id[*]}, ',') if (!(result_string == "ab c,de fg")) { test_fail } # Multi character separator not delimited -result_string := %concat(%{control.Calling-Station-Id[*]}, '|-') +result_string := %str.concat(%{control.Calling-Station-Id[*]}, '|-') if !(result_string == "ab c|-de fg") { test_fail diff --git a/src/tests/keywords/edit-multivalue b/src/tests/keywords/edit-multivalue index d38ea9efbc..e16f2cc53c 100644 --- a/src/tests/keywords/edit-multivalue +++ b/src/tests/keywords/edit-multivalue @@ -7,7 +7,7 @@ baz = "a,b,c,d,e" # # Append, don't create multiple versions # -bar += %explode(baz, ',') +bar += %str.split(baz, ',') if !(bar == "abcde") { test_fail @@ -19,7 +19,7 @@ if !(bar == "abcde") { # We cannot have multiple copies of local variables. There's no real # reason why, but for now it's safer to be limited. # -foo := %explode(baz, ',') +foo := %str.split(baz, ',') if !(foo[#] == 1) { test_fail } diff --git a/src/tests/keywords/expr-double b/src/tests/keywords/expr-double index 772acbb270..0cd08610f2 100644 --- a/src/tests/keywords/expr-double +++ b/src/tests/keywords/expr-double @@ -1,5 +1,5 @@ # # We only care if this crashes or not. # -Filter-Id := "%{1 + 1} %tolower('1')" +Filter-Id := "%{1 + 1} %str.lower('1')" success diff --git a/src/tests/keywords/filter_password b/src/tests/keywords/filter_password index 2a1f66000c..48745dc28a 100644 --- a/src/tests/keywords/filter_password +++ b/src/tests/keywords/filter_password @@ -11,7 +11,7 @@ if %length(Reply-Message) != 9 { # # This assignment grabs the first element of the list, and tosses the remaining ones. # -Reply-Message := %explode(Reply-Message, 0x00) +Reply-Message := %str.split(Reply-Message, 0x00) if Reply-Message != "bob" { test_fail diff --git a/src/tests/keywords/foreach-error b/src/tests/keywords/foreach-error index 9cde9618c1..9bc4b9ff0a 100644 --- a/src/tests/keywords/foreach-error +++ b/src/tests/keywords/foreach-error @@ -1,3 +1,3 @@ -foreach thing ("%tolower('foo')") { # ERROR +foreach thing ("%str.lower('foo')") { # ERROR reply.Called-Station-Id += thing } diff --git a/src/tests/keywords/foreach-explode b/src/tests/keywords/foreach-explode index 11e3147337..c81d010234 100644 --- a/src/tests/keywords/foreach-explode +++ b/src/tests/keywords/foreach-explode @@ -7,7 +7,7 @@ string result input = "a b c d e f" result = "" -foreach string thing (%explode(input, ' ')) { +foreach string thing (%str.split(input, ' ')) { result += thing result += ',' } diff --git a/src/tests/keywords/foreach-explode-key b/src/tests/keywords/foreach-explode-key index 733fabf4c0..807da7d6ec 100644 --- a/src/tests/keywords/foreach-explode-key +++ b/src/tests/keywords/foreach-explode-key @@ -7,7 +7,7 @@ string result input = "a b c d e f" result = "" -foreach uint32 key,string thing (%explode(input, ' ')) { +foreach uint32 key,string thing (%str.split(input, ' ')) { result += thing result += ':' result += (string) key diff --git a/src/tests/keywords/if-function b/src/tests/keywords/if-function index 49e420317b..a9fa7e708c 100644 --- a/src/tests/keywords/if-function +++ b/src/tests/keywords/if-function @@ -1,14 +1,14 @@ # # PRE: if # -if !(%md5('foo') == 0xacbd18db4cc2f85cedef654fccc4a4d8) { +if !(%hash.md5('foo') == 0xacbd18db4cc2f85cedef654fccc4a4d8) { test_fail } group { octets hash - hash = %md5('foo') + hash = %hash.md5('foo') if !(hash == 0xacbd18db4cc2f85cedef654fccc4a4d8) { test_fail } diff --git a/src/tests/keywords/join b/src/tests/keywords/join index 6b8288b023..911b365263 100644 --- a/src/tests/keywords/join +++ b/src/tests/keywords/join @@ -30,13 +30,13 @@ debug_request # # @todo - fix this... # -result_string := %concat(%join(%{control.[*]}, request.Framed-IP-Address), '. ') +result_string := %str.concat(%join(%{control.[*]}, request.Framed-IP-Address), '. ') if (!(result_string == "bob. hello. ab c. de fg. 123. 192.168.1.254")) { test_fail } -result_string := %concat(%join(control.Filter-Id[*], control.NAS-Port), ',') +result_string := %str.concat(%join(control.Filter-Id[*], control.NAS-Port), ',') if (!(result_string == "ab c,de fg,123")) { test_fail } diff --git a/src/tests/keywords/map-arg3-xlat b/src/tests/keywords/map-arg3-xlat index f51251c6e9..06583eb6b9 100644 --- a/src/tests/keywords/map-arg3-xlat +++ b/src/tests/keywords/map-arg3-xlat @@ -7,6 +7,6 @@ # value of the field, but does allow us to test that # arg3 can be an xlat # -map csv "%tolower(%{User-Name})" { +map csv "%str.lower(%{User-Name})" { reply.Result-Status := 'field3' } diff --git a/src/tests/keywords/map-csv-lhs b/src/tests/keywords/map-csv-lhs index 809d793f86..4d2d93421d 100644 --- a/src/tests/keywords/map-csv-lhs +++ b/src/tests/keywords/map-csv-lhs @@ -2,6 +2,6 @@ # PRE: map # -map csv "%tolower(%{User-Name})" { +map csv "%str.lower(%{User-Name})" { reply.Result-Status := 'field3' } diff --git a/src/tests/keywords/md4 b/src/tests/keywords/md4 index 61ec0f170a..8713ce0c95 100644 --- a/src/tests/keywords/md4 +++ b/src/tests/keywords/md4 @@ -13,12 +13,12 @@ test_octets := 0x000504030201 # Put "This is a string" into a file and call "md4sum" on it. # You should get this string. # -result_octets := %md4("This is a string\n") +result_octets := %hash.md4("This is a string\n") if (!(result_octets == 0x1f60d5cd85e17bfbdda7c923822f060c)) { test_fail } -result_octets := %md4("%{test_string}") +result_octets := %hash.md4("%{test_string}") if (!(result_octets == 0x1f60d5cd85e17bfbdda7c923822f060c)) { test_fail } @@ -26,7 +26,7 @@ if (!(result_octets == 0x1f60d5cd85e17bfbdda7c923822f060c)) { # # MD4 should also be able to cope with references to octet attributes # -result_octets := %md4("%{test_octets}") +result_octets := %hash.md4("%{test_octets}") if (!(result_octets == 0xac3ed17b3cf19ec38352ec534a932fc6)) { test_fail } @@ -34,7 +34,7 @@ if (!(result_octets == 0xac3ed17b3cf19ec38352ec534a932fc6)) { # # MD4 of null string is d41d8cd98f00b204e9800998ecf8427e # -result_octets := %md4("%{dummy_string}") +result_octets := %hash.md4("%{dummy_string}") if (!(result_octets == 0x31d6cfe0d16ae931b73c59d7e0c089c0)) { test_fail } diff --git a/src/tests/keywords/md5 b/src/tests/keywords/md5 index 92117c5e81..ebbb16c0fe 100644 --- a/src/tests/keywords/md5 +++ b/src/tests/keywords/md5 @@ -17,12 +17,12 @@ test_hmac_data := "Jefe" # Put "This is a string" into a file and call "md5sum" on it. # You should get this string. # -result_octets := %md5("This is a string\n") +result_octets := %hash.md5("This is a string\n") if (!(result_octets == 0x9ac4dbbc3c0ad2429e61d0df5dc28add)) { test_fail } -result_octets := %md5("%{test_string}") +result_octets := %hash.md5("%{test_string}") if (!(result_octets == 0x9ac4dbbc3c0ad2429e61d0df5dc28add)) { test_fail } @@ -30,7 +30,7 @@ if (!(result_octets == 0x9ac4dbbc3c0ad2429e61d0df5dc28add)) { # # MD5 should also be able to cope with references to octet attributes # -result_octets := %md5("%{test_octets}") +result_octets := %hash.md5("%{test_octets}") if (!(result_octets == 0xc1e7fa505b2fc1fd0da6cac3db6f6f44)) { test_fail } @@ -38,7 +38,7 @@ if (!(result_octets == 0xc1e7fa505b2fc1fd0da6cac3db6f6f44)) { # # MD5 of null string is d41d8cd98f00b204e9800998ecf8427e # -result_octets := %md5("%{dummy_string}") +result_octets := %hash.md5("%{dummy_string}") if (!(result_octets == 0xd41d8cd98f00b204e9800998ecf8427e)) { test_fail } @@ -46,7 +46,7 @@ if (!(result_octets == 0xd41d8cd98f00b204e9800998ecf8427e)) { # # MD5 HMAC with attribute references # -result_octets := %hmacmd5("%{test_hmac_key}", "%{test_hmac_data}") +result_octets := %hmac.md5("%{test_hmac_key}", "%{test_hmac_data}") if (!(result_octets == 0x750c783e6ab0b503eaa86e310a5db738)) { test_fail } @@ -55,7 +55,7 @@ if (!(result_octets == 0x750c783e6ab0b503eaa86e310a5db738)) { # MD5 HMAC with empty key and data # dummy_string := '' -result_octets := %hmacmd5("%{dummy_string}", "%{dummy_string}") +result_octets := %hmac.md5("%{dummy_string}", "%{dummy_string}") if (!(result_octets == 0x74e6f7298a9c2d168935f58c001bad88)) { test_fail } diff --git a/src/tests/keywords/md5-error b/src/tests/keywords/md5-error index 50ce950798..a46b25cc79 100644 --- a/src/tests/keywords/md5-error +++ b/src/tests/keywords/md5-error @@ -9,7 +9,7 @@ test_string := "hello" # # MD5 HMAC with missing key should fail # -result_octets := %hmacmd5(%{test_string}, ) # ERROR +result_octets := %hmac.md5(%{test_string}, ) # ERROR if result_octets { test_fail } diff --git a/src/tests/keywords/pad b/src/tests/keywords/pad index 073c8961af..658ea67f0e 100644 --- a/src/tests/keywords/pad +++ b/src/tests/keywords/pad @@ -8,38 +8,38 @@ test_string = "test" # # rpad tests # -if (!(%rpad(%{test_string}, 7) == "test ")) { +if (!(%str.rpad(%{test_string}, 7) == "test ")) { test_fail } -if (!(%rpad(%{test_string}, 2) == "test")) { +if (!(%str.rpad(%{test_string}, 2) == "test")) { test_fail } -if (!(%rpad(%{test_string}, 7, 'x') == "testxxx")) { +if (!(%str.rpad(%{test_string}, 7, 'x') == "testxxx")) { test_fail } -if (!(%rpad(%{test_string}, 7, 'xy') == "testxyx")) { +if (!(%str.rpad(%{test_string}, 7, 'xy') == "testxyx")) { test_fail } # # lpad tests # -if (!(%lpad(%{test_string}, 7) == " test")) { +if (!(%str.lpad(%{test_string}, 7) == " test")) { test_fail } -if (!(%lpad(%{test_string}, 2) == "test")) { +if (!(%str.lpad(%{test_string}, 2) == "test")) { test_fail } -if (!(%lpad(%{test_string}, 7, 'x') == "xxxtest")) { +if (!(%str.lpad(%{test_string}, 7, 'x') == "xxxtest")) { test_fail } -if (!(%lpad(%{test_string}, 7, 'xy') == "xyxtest")) { +if (!(%str.lpad(%{test_string}, 7, 'xy') == "xyxtest")) { test_fail } diff --git a/src/tests/keywords/pairs b/src/tests/keywords/pairs index 18993fb505..e2527b771a 100644 --- a/src/tests/keywords/pairs +++ b/src/tests/keywords/pairs @@ -27,7 +27,7 @@ Tmp-Group-0 += { # #pairs := %cast('string', %{Tmp-Group-0.[*]}) -result_string := "%concat(%pairs('Tmp-Group-0.[*]'), ', ')" +result_string := "%str.concat(%pairs('Tmp-Group-0.[*]'), ', ')" if !(result_string == 'Filter-Id = "This is a string", Filter-Id = "This is another one", Class = 0x000504030201, NAS-Port = 7331') { test_fail } @@ -37,7 +37,7 @@ if !(result_string == 'Filter-Id = "This is a string"') { test_fail } -result_string := "%concat(%pairs('Tmp-Group-0.Filter-Id[*]'), ', ')" +result_string := "%str.concat(%pairs('Tmp-Group-0.Filter-Id[*]'), ', ')" if !(result_string == 'Filter-Id = "This is a string", Filter-Id = "This is another one"') { test_fail } @@ -45,7 +45,7 @@ if !(result_string == 'Filter-Id = "This is a string", Filter-Id = "This is anot # # Must be nested # -result_string := "%concat(%pairs('control.[*]'), ', ')" +result_string := "%str.concat(%pairs('control.[*]'), ', ')" if !(result_string == 'Password = { Cleartext = "hello" }') { test_fail } diff --git a/src/tests/keywords/pap-ssha2 b/src/tests/keywords/pap-ssha2 index 38330a2233..6d486993dc 100644 --- a/src/tests/keywords/pap-ssha2 +++ b/src/tests/keywords/pap-ssha2 @@ -24,7 +24,7 @@ salt := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK" # 60 byte # Hex encoded SSHA2-512 password # control += { - Password.With-Header = "{ssha512}%hex(%sha2_512(%{User-Password}%{salt}))%hex(%{salt})" + Password.With-Header = "{ssha512}%hex(%hash.sha2_512(%{User-Password}%{salt}))%hex(%{salt})" } pap.authorize @@ -40,7 +40,7 @@ control := {} # # Base64 encoded SSHA2-512 password # -result_string := "%hex(%sha2_512(%{User-Password}%{salt}))%hex(%{salt})" +result_string := "%hex(%hash.sha2_512(%{User-Password}%{salt}))%hex(%{salt})" # To Binary result_octets := "%bin(%{result_string})" @@ -65,7 +65,7 @@ control := {} # # Base64 of Base64 encoded SSHA2-512 password # -result_string := "%hex(%sha2_512(%{User-Password}%{salt}))%hex(%{salt})" +result_string := "%hex(%hash.sha2_512(%{User-Password}%{salt}))%hex(%{salt})" # To Binary result_octets := "%bin(%{result_string})" @@ -90,7 +90,7 @@ control := {} # # Base64 of SHA2-384 password (in SHA2-Password) # -control.Password.SHA2 := %hex(%sha2_384(%{User-Password})) +control.Password.SHA2 := %hex(%hash.sha2_384(%{User-Password})) pap.authorize pap.authenticate { @@ -107,7 +107,7 @@ control := { # # Base64 of SHA2-256 password (in SHA2-256-Password) # -control.Password.SHA2-256 := "%hex(%sha2_256(%{User-Password}))" +control.Password.SHA2-256 := "%hex(%hash.sha2_256(%{User-Password}))" pap.authorize pap.authenticate { @@ -122,7 +122,7 @@ control := {} # # Base64 of SHA2-224 password (in SHA2-224-Password - No hex armour) # -control.Password.SHA2-224 := "%sha2_224(%{User-Password})" +control.Password.SHA2-224 := "%hash.sha2_224(%{User-Password})" pap.authorize pap.authenticate { diff --git a/src/tests/keywords/radius.conf b/src/tests/keywords/radius.conf index 1724af657f..02902ff2e4 100644 --- a/src/tests/keywords/radius.conf +++ b/src/tests/keywords/radius.conf @@ -23,7 +23,7 @@ modules { csv { - key = "%tolower(%{User-Name})" + key = "%str.lower(%{User-Name})" filename = ${keyword}/csv.conf fields = "field1,,field3" index_field = 'field1' diff --git a/src/tests/keywords/randstr b/src/tests/keywords/randstr index f2613c8ede..9683ffedc6 100644 --- a/src/tests/keywords/randstr +++ b/src/tests/keywords/randstr @@ -3,7 +3,7 @@ string result_string # # Empty output on empty input # -result_string := "%randstr(result_string)" +result_string := "%str.rand(result_string)" if !(result_string == "") { test_fail } @@ -11,19 +11,19 @@ if !(result_string == "") { # # Check length of output # -result_string := "%randstr('nnn')" +result_string := "%str.rand('nnn')" if (!(%length(result_string) == 3)) { test_fail } -result_string := %randstr('24a') +result_string := %str.rand('24a') if (!(%length(result_string) == 24)) { test_fail } # # Check maximum repetition # -result_string := %randstr('1030aa') +result_string := %str.rand('1030aa') if (!(%length(result_string) == 1025)) { test_fail } @@ -31,7 +31,7 @@ if (!(%length(result_string) == 1025)) { # # Check invalid character class # -result_string := %randstr('G') +result_string := %str.rand('G') if !(result_string == "") { test_fail @@ -40,7 +40,7 @@ if !(result_string == "") { # # Check repetition of binary output # -result_string := %randstr('10b') +result_string := %str.rand('10b') if (!(%length(result_string) == 10)) { test_fail } diff --git a/src/tests/keywords/sha1 b/src/tests/keywords/sha1 index 98324d8d65..b3aafe4ac5 100644 --- a/src/tests/keywords/sha1 +++ b/src/tests/keywords/sha1 @@ -37,7 +37,7 @@ if (!(result_octets == 0xda39a3ee5e6b4b0d3255bfef95601890afd80709)) { # # SHA1 HMAC with attribute references # -result_octets := %hmacsha1("%{test_hmac_key}", "%{test_hmac_data}") +result_octets := %hmac.sha1("%{test_hmac_key}", "%{test_hmac_data}") if (!(result_octets == 0xeffcdf6ae5eb2fa2d27416d5f184df9c259a7c79)) { test_fail } @@ -46,7 +46,7 @@ if (!(result_octets == 0xeffcdf6ae5eb2fa2d27416d5f184df9c259a7c79)) { # SHA1 HMAC with empty key and data # dummy_string := '' -result_octets := %hmacsha1("%{dummy_string}", "%{dummy_string}") +result_octets := %hmac.sha1("%{dummy_string}", "%{dummy_string}") if (!(result_octets == 0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d)) { test_fail } diff --git a/src/tests/keywords/sha1-error b/src/tests/keywords/sha1-error index fd3426a7dc..fb3b09915e 100644 --- a/src/tests/keywords/sha1-error +++ b/src/tests/keywords/sha1-error @@ -5,7 +5,7 @@ test_string := "hello" # # SHA1 HMAC with missing key should fail # -result_octets := %hmacsha1(%{test_string}, ) # ERROR +result_octets := %hmac.sha1(%{test_string}, ) # ERROR if result_octets { test_fail } diff --git a/src/tests/keywords/sha2 b/src/tests/keywords/sha2 index 27345564d7..a3c8593ae7 100644 --- a/src/tests/keywords/sha2 +++ b/src/tests/keywords/sha2 @@ -13,12 +13,12 @@ test_octets := 0x000504030201 # Put "This is a string" into a file and call "sha2_256sum" on it. # You should get this string. # -result_octets := %sha2_256("This is a string\n") +result_octets := %hash.sha2_256("This is a string\n") if (!(result_octets == 0xb3716a1ab53042bb392034f29071e13b0c38aa19b4edd75d9a76022f91189124)) { test_fail } -result_octets := %sha2_256(%{test_string}) +result_octets := %hash.sha2_256(%{test_string}) if (!(result_octets == 0xb3716a1ab53042bb392034f29071e13b0c38aa19b4edd75d9a76022f91189124)) { test_fail } @@ -26,7 +26,7 @@ if (!(result_octets == 0xb3716a1ab53042bb392034f29071e13b0c38aa19b4edd75d9a76022 # # SHA256 should also be able to cope with references to octet attributes # -result_octets := %sha2_256(%{test_octets}) +result_octets := %hash.sha2_256(%{test_octets}) if (!(result_octets == 0xf307e202b881fded70e58017aa0c4d7b29c76ab25d02bf078301a5f6635187eb)) { test_fail } @@ -34,7 +34,7 @@ if (!(result_octets == 0xf307e202b881fded70e58017aa0c4d7b29c76ab25d02bf078301a5f # # SHA256 of empty string # -result_octets := %sha2_256(%{dummy_octets}) +result_octets := %hash.sha2_256(%{dummy_octets}) if (!(result_octets == 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855)) { test_fail } @@ -43,17 +43,17 @@ if (!(result_octets == 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991 # SHA512 and SHA256 share common code paths, so the tests don't need to be # as exhaustive. # -result_octets := %sha2_512("This is a string\n") +result_octets := %hash.sha2_512("This is a string\n") if (!(result_octets == 0x56b57df5cce42d4e35c644649798ea23ec16f4f4626e78faf4d2d8f430ea349bcc28cd5532457c82f0aa66bf68988346039fe75b900a92ff94fd53993d45990f)) { test_fail } -result_octets := %sha2_512(%{test_string}) +result_octets := %hash.sha2_512(%{test_string}) if (!(result_octets == 0x56b57df5cce42d4e35c644649798ea23ec16f4f4626e78faf4d2d8f430ea349bcc28cd5532457c82f0aa66bf68988346039fe75b900a92ff94fd53993d45990f)) { test_fail } -result_octets := %sha2_512(%{test_octets}) +result_octets := %hash.sha2_512(%{test_octets}) if (!(result_octets == 0xde80271eb5e03a1c24dd0cd823a22305a743ee3a54f1de5bf97adbf56984561154bfb6928b1da4ccc3f5dde9f4032ad461937b60b9ace4ad3898cf45c90596d7)) { test_fail } diff --git a/src/tests/keywords/substr b/src/tests/keywords/substr index a6a3598119..114c74dde6 100644 --- a/src/tests/keywords/substr +++ b/src/tests/keywords/substr @@ -9,47 +9,47 @@ test_string = "hello world" test_octets = 0x01234567 test_int = 123456 -if !(%substr(%{test_string}, 1, 3) == 'ell') { +if !(%str.substr(%{test_string}, 1, 3) == 'ell') { test_fail } -if !(%substr(%{test_string}, 0, 3) == 'hel') { +if !(%str.substr(%{test_string}, 0, 3) == 'hel') { test_fail } -if !(%substr(%{test_string}, 5) == ' world') { +if !(%str.substr(%{test_string}, 5) == ' world') { test_fail } -if !(%substr(%{test_string}, -3) == 'rld') { +if !(%str.substr(%{test_string}, -3) == 'rld') { test_fail } -if !(%substr(%{test_string}, -20) == 'hello world') { +if !(%str.substr(%{test_string}, -20) == 'hello world') { test_fail } -if !(%substr(%{test_string}, -4, 2) == 'or') { +if !(%str.substr(%{test_string}, -4, 2) == 'or') { test_fail } -if !(%substr(%{test_string}, -10, -3) == 'ello wo') { +if !(%str.substr(%{test_string}, -10, -3) == 'ello wo') { test_fail } -if (%substr(%{test_string}, 20)) { +if (%str.substr(%{test_string}, 20)) { test_fail } -if (%substr(%{test_string}, 5, -7)) { +if (%str.substr(%{test_string}, 5, -7)) { test_fail } -if !(%substr(%{test_octets}, 1, 2) == 0x2345) { +if !(%str.substr(%{test_octets}, 1, 2) == 0x2345) { test_fail } -if !(%substr(%{test_int}, 1, 2) == '23') { +if !(%str.substr(%{test_int}, 1, 2) == '23') { test_fail } diff --git a/src/tests/keywords/switch-escape b/src/tests/keywords/switch-escape index b40fd4a78b..82ff6fb082 100644 --- a/src/tests/keywords/switch-escape +++ b/src/tests/keywords/switch-escape @@ -1,7 +1,7 @@ string test_string test_string := 'foo' -switch "%tolower(%{test_string})" { +switch "%str.lower(%{test_string})" { case 'foo' { success } diff --git a/src/tests/keywords/tolower b/src/tests/keywords/tolower index 175f082fa6..544328c410 100644 --- a/src/tests/keywords/tolower +++ b/src/tests/keywords/tolower @@ -5,13 +5,13 @@ string test_string string dummy_string test_string := "AbCdE" -test_string := %tolower(test_string) +test_string := %str.lower(test_string) if !(test_string == "abcde") { test_fail } -test_string := %tolower('AAbbCCdd') +test_string := %str.lower('AAbbCCdd') if !(test_string == "aabbccdd") { test_fail } @@ -19,7 +19,7 @@ if !(test_string == "aabbccdd") { # # Doesn't exist # -test_string := "%tolower(dummy_string)" +test_string := "%str.lower(dummy_string)" if !(test_string == "") { test_fail } diff --git a/src/tests/keywords/toupper b/src/tests/keywords/toupper index dfccc039c9..540c37b138 100644 --- a/src/tests/keywords/toupper +++ b/src/tests/keywords/toupper @@ -5,17 +5,17 @@ string test_string string dummy_string test_string := "AbCdE" -test_string := %toupper(test_string) +test_string := %str.upper(test_string) if (!(test_string == "ABCDE")) { test_fail } -test_string := %toupper('AAbbCCdd') +test_string := %str.upper('AAbbCCdd') if (!(test_string == "AABBCCDD")) { test_fail } -test_string := "%toupper(dummy_string)" +test_string := "%str.upper(dummy_string)" if !(test_string == "") { test_fail } diff --git a/src/tests/keywords/urlquote b/src/tests/keywords/urlquote index 2e76e71525..2c66a266bb 100644 --- a/src/tests/keywords/urlquote +++ b/src/tests/keywords/urlquote @@ -15,37 +15,37 @@ test_string3 = '™œ¥¤' encoded_string2 := '%C2%B1%C2%A7%21%40%23%24%25%5E%26%2A%28%29%2B%3D%7B%5B%7D%5D%3A%3B%22%27%7C%5C%3C%2C%3E%3F%2F%60' encoded_string3 := '%E2%84%A2%C5%93%C2%A5%C2%A4' -result_string = "%urlquote(%{test_string1})" +result_string = "%url.quote(%{test_string1})" if (!(result_string == test_string1)) { test_fail } -result_string := "%urlunquote(%{test_string1})" +result_string := "%url.unquote(%{test_string1})" if (!(result_string == test_string1)) { test_fail } -result_string := "%urlquote(%{test_string2})" +result_string := "%url.quote(%{test_string2})" if (!(result_string == encoded_string2)) { test_fail } -result_string := "%urlquote(%{test_string3})" +result_string := "%url.quote(%{test_string3})" if (!(result_string == encoded_string3)) { test_fail } -result_string := "%urlunquote(%{encoded_string2})" +result_string := "%url.unquote(%{encoded_string2})" if (!(result_string == test_string2)) { test_fail } -result_string := "%urlunquote(%{encoded_string3})" +result_string := "%url.unquote(%{encoded_string3})" if (!(result_string == test_string3)) { test_fail } -result_string := "%urlunquote('%%E, 123')" +result_string := "%url.unquote('%%E, 123')" # Test decoding invalid encoded string if !(result_string == "") { diff --git a/src/tests/keywords/xlat-attr-index b/src/tests/keywords/xlat-attr-index index f78cbbcab0..1b31c0206d 100644 --- a/src/tests/keywords/xlat-attr-index +++ b/src/tests/keywords/xlat-attr-index @@ -19,7 +19,7 @@ if (!("%{Framed-IP-Address[*]}" == '192.0.2.1192.0.2.2')) { request += { NAS-IP-Address = Framed-IP-Address[1] NAS-IP-Address = Framed-IP-Address[0] - Filter-Id = "%concat(%{Framed-IP-Address[*]}, ',')" + Filter-Id = "%str.concat(%{Framed-IP-Address[*]}, ',')" NAS-Port = %{Framed-IP-Address[#]} } diff --git a/src/tests/keywords/xlat-escape b/src/tests/keywords/xlat-escape index 0586034eb8..64b3e33906 100644 --- a/src/tests/keywords/xlat-escape +++ b/src/tests/keywords/xlat-escape @@ -8,7 +8,7 @@ if !("\%{ FOO}" == '%{ FOO}') { test_fail } -if !(%tolower("\%{FOO}") == '%{foo}') { +if !(%str.lower("\%{FOO}") == '%{foo}') { test_fail } diff --git a/src/tests/keywords/xlat-explode b/src/tests/keywords/xlat-explode index ed710db99c..f879f27f3e 100644 --- a/src/tests/keywords/xlat-explode +++ b/src/tests/keywords/xlat-explode @@ -17,27 +17,27 @@ control += { Filter-Id = 'here. are . some. words. ' } -result_string := "%concat(%explode(Class, '|'), ',')" +result_string := "%str.concat(%str.split(Class, '|'), ',')" if (!(result_string == "1=1,my_attr=2,my_attr=hello")) { test_fail } -result_string := "%concat(%explode(Calling-Station-ID, '|'), ',')" +result_string := "%str.concat(%str.split(Calling-Station-ID, '|'), ',')" if (!(result_string == "")) { test_fail } -result_string := "%concat(%explode(control.User-Name[*], '|'), ',')" +result_string := "%str.concat(%str.split(control.User-Name[*], '|'), ',')" if (!(result_string == "hello,goodbye,morning,night,1")) { test_fail } -result_string := "%concat(%explode(control.Reply-Message, '|'), ',')" +result_string := "%str.concat(%str.split(control.Reply-Message, '|'), ',')" if !(result_string == 'Can\'t touch this') { test_fail } -result_string := "%concat(%explode(control.Filter-Id, '. '), ',')" +result_string := "%str.concat(%str.split(control.Filter-Id, '. '), ',')" if !(result_string == 'here, are ,some, words') { test_fail } diff --git a/src/tests/keywords/xlat-list b/src/tests/keywords/xlat-list index d98df841f0..8afb8205e4 100644 --- a/src/tests/keywords/xlat-list +++ b/src/tests/keywords/xlat-list @@ -31,7 +31,7 @@ if ("%{control.[*]}" != '192.0.2.1192.0.2.2') { request += { NAS-IP-Address = %{control.[1]} NAS-IP-Address = %{control.[0]} - Filter-Id = %concat(%{control.[*]}, ',') + Filter-Id = %str.concat(%{control.[*]}, ',') NAS-Port = %{control.[#]} } diff --git a/src/tests/keywords/xlat-redundant b/src/tests/keywords/xlat-redundant index 907deaf01f..ba8b724cf6 100644 --- a/src/tests/keywords/xlat-redundant +++ b/src/tests/keywords/xlat-redundant @@ -2,18 +2,18 @@ # # PRE: if # -if (%concat(%test1.passthrough('foo', 'bar'),'|') != "foo|bar") { +if (%str.concat(%test1.passthrough('foo', 'bar'),'|') != "foo|bar") { test_fail } -if (%concat(%test2.passthrough('foo', 'bar'), '|') != "foo|bar") { +if (%str.concat(%test2.passthrough('foo', 'bar'), '|') != "foo|bar") { test_fail } # # The config has a "redundant" block for test1 and test2. # -if (%concat(%redundant_test.passthrough('foo', 'bar'), '|') != "foo|bar") { +if (%str.concat(%redundant_test.passthrough('foo', 'bar'), '|') != "foo|bar") { test_fail } diff --git a/src/tests/ldap_sync/rfc4533/config/radiusd.conf b/src/tests/ldap_sync/rfc4533/config/radiusd.conf index 4c6b6571ed..5d6fc4fe90 100644 --- a/src/tests/ldap_sync/rfc4533/config/radiusd.conf +++ b/src/tests/ldap_sync/rfc4533/config/radiusd.conf @@ -194,7 +194,7 @@ server test { load Cookie { string csn - csn := %concat(%ldap("ldap:///%ldap.uri.safe(%{LDAP-Sync.Directory-Root-DN})?contextCSN?base"), ';') + csn := %str.concat(%ldap("ldap:///%ldap.uri.safe(%{LDAP-Sync.Directory-Root-DN})?contextCSN?base"), ';') reply.LDAP-Sync.Cookie := "rid=000,csn=%{csn}" } diff --git a/src/tests/modules/exec/module.conf b/src/tests/modules/exec/module.conf index faaf8a7796..f09f678bd5 100644 --- a/src/tests/modules/exec/module.conf +++ b/src/tests/modules/exec/module.conf @@ -56,5 +56,5 @@ exec exec_sync_xlat_args { wait = yes output_pairs = control timeout = 10 - program = "/bin/sh $ENV{MODULE_TEST_DIR}/attrs.sh %toupper(%{User-Name})" + program = "/bin/sh $ENV{MODULE_TEST_DIR}/attrs.sh %str.upper(%{User-Name})" } diff --git a/src/tests/modules/files/authorize b/src/tests/modules/files/authorize index b3227e51b1..8ecc37a3f6 100644 --- a/src/tests/modules/files/authorize +++ b/src/tests/modules/files/authorize @@ -156,7 +156,7 @@ undo Password.Cleartext := "hello" # otherwise it's a compile-time error. # undo - Framed-IP-Address := "hello %md5('foo')" + Framed-IP-Address := "hello %hash.md5('foo')" # # Test where additional checks uses the [*] filter diff --git a/src/tests/modules/ldap/module.conf b/src/tests/modules/ldap/module.conf index 9580968bef..ad2681a8bb 100644 --- a/src/tests/modules/ldap/module.conf +++ b/src/tests/modules/ldap/module.conf @@ -330,7 +330,7 @@ ldap { update { description := "User %{User-Name} authenticated" userPKCS12 := Class - carLicense += "%randstr('CCnnCCC')" + carLicense += "%str.rand('CCnnCCC')" } } } diff --git a/src/tests/modules/pap/bin_random.unlang b/src/tests/modules/pap/bin_random.unlang index 9d783fa5d5..9b0f4d4901 100644 --- a/src/tests/modules/pap/bin_random.unlang +++ b/src/tests/modules/pap/bin_random.unlang @@ -1,5 +1,5 @@ if (User-Name == 'test') { - User-Password := "%randstr('bbbbbbbbbbbbbbbb')" + User-Password := "%str.rand('bbbbbbbbbbbbbbbb')" control.Password.Cleartext := "%{User-Password}" pap.authorize diff --git a/src/tests/modules/redis/cluster_key.unlang b/src/tests/modules/redis/cluster_key.unlang index 28613142f1..5276c520f4 100644 --- a/src/tests/modules/redis/cluster_key.unlang +++ b/src/tests/modules/redis/cluster_key.unlang @@ -14,9 +14,9 @@ $INCLUDE cluster_reset.inc # - 127.0.0.1:30005 - slave # - 127.0.0.1:30003 - master [10923-16383] # - 127.0.0.1:30006 - slave -testdata1 := "1-%randstr('aaaaaaaa')" -testdata2 := "2-%randstr('aaaaaaaa')" -testdata3 := "3-%randstr('aaaaaaaa')" +testdata1 := "1-%str.rand('aaaaaaaa')" +testdata2 := "2-%str.rand('aaaaaaaa')" +testdata3 := "3-%str.rand('aaaaaaaa')" # Hashes to Redis cluster node master 1 (1) if (%redis('SET', 'b', %{testdata1}) == 'OK') { diff --git a/src/tests/modules/redis/cluster_reset.inc b/src/tests/modules/redis/cluster_reset.inc index ff48c651f4..ee47d31961 100644 --- a/src/tests/modules/redis/cluster_reset.inc +++ b/src/tests/modules/redis/cluster_reset.inc @@ -8,9 +8,9 @@ string data2 string data3 string cmdresult -data1 := "1-%randstr('aaaaaaaa')" -data2 := "2-%randstr('aaaaaaaa')" -data3 := "3-%randstr('aaaaaaaa')" +data1 := "1-%str.rand('aaaaaaaa')" +data2 := "2-%str.rand('aaaaaaaa')" +data3 := "3-%str.rand('aaaaaaaa')" if ("$ENV{REDIS_CLUSTER_CONTROL}" == '') { clusterctrl := 'scripts/ci/redis-setup.sh' diff --git a/src/tests/unit/condition/base.txt b/src/tests/unit/condition/base.txt index 45130d94d0..66647e760d 100644 --- a/src/tests/unit/condition/base.txt +++ b/src/tests/unit/condition/base.txt @@ -240,23 +240,23 @@ match ERROR offset 12: Attribute 'X' not found in namespace 'internal': Unresolv condition (ipaddr)127.0.0.1 == "127.0.0.1" match true -condition (ipaddr)127.0.0.1 == "%md4(' 127.0.0.1')" -match (127.0.0.1 == "%md4(0x203132372e302e302e31)") +condition (ipaddr)127.0.0.1 == "%hash.md4(' 127.0.0.1')" +match (127.0.0.1 == "%hash.md4(0x203132372e302e302e31)") # # Bare %{...} is allowed. # -condition (ipaddr)127.0.0.1 == %md4('127.0.0.1') -match (127.0.0.1 == %md4(0x3132372e302e302e31)) +condition (ipaddr)127.0.0.1 == %hash.md4('127.0.0.1') +match (127.0.0.1 == %hash.md4(0x3132372e302e302e31)) -condition (ipaddr)127.0.0.1 == %md4("SELECT user FROM table WHERE user='%{User-Name}'") -match (127.0.0.1 == %md4("SELECT user FROM table WHERE user='%{User-Name}'")) +condition (ipaddr)127.0.0.1 == %hash.md4("SELECT user FROM table WHERE user='%{User-Name}'") +match (127.0.0.1 == %hash.md4("SELECT user FROM table WHERE user='%{User-Name}'")) condition (ether) 00:11:22:33:44:55 == "00:11:22:33:44:55" match true -condition (ether) 00:11:22:33:44:55 == "%md4('00:11:22:33:44:55')" -match (00:11:22:33:44:55 == "%md4(0x30303a31313a32323a33333a34343a3535)") +condition (ether) 00:11:22:33:44:55 == "%hash.md4('00:11:22:33:44:55')" +match (00:11:22:33:44:55 == "%hash.md4(0x30303a31313a32323a33333a34343a3535)") condition (ether) 00:XX:22:33:44:55 == 00:11:22:33:44:55 match ERROR offset 10: Unexpected text after attribute reference @@ -309,11 +309,11 @@ match true condition ('foo' == 'foo') match true -condition ("foo" == "%md4(' foo')") -match ("foo" == "%md4(0x20666f6f)") +condition ("foo" == "%hash.md4(' foo')") +match ("foo" == "%hash.md4(0x20666f6f)") -condition ("foo bar" == "%md4(' foo')") -match ("foo bar" == "%md4(0x20666f6f)") +condition ("foo bar" == "%hash.md4(' foo')") +match ("foo bar" == "%hash.md4(0x20666f6f)") condition ("foo" == "bar") match false @@ -329,8 +329,8 @@ match false condition (User-Name == "bob") match (User-Name == "bob") -condition (User-Name == "%md4(' blah')") -match (User-Name == "%md4(0x20626c6168)") +condition (User-Name == "%hash.md4(' blah')") +match (User-Name == "%hash.md4(0x20626c6168)") condition (ipaddr)127.0.0.1 == 2130706433 match true @@ -418,8 +418,8 @@ match ("foo" == User-Name) # We should really add a "cast print" function which prints # out the casts in the same format in which they are parsed. # -condition (integer)"%md4(' 1 + 1')" < NAS-Port -match (%cast(uint32, "%md4(0x2031202b2031)") < NAS-Port) +condition (integer)"%hash.md4(' 1 + 1')" < NAS-Port +match (%cast(uint32, "%hash.md4(0x2031202b2031)") < NAS-Port) condition Filter-Id == Framed-IP-Address match (Filter-Id == Framed-IP-Address) diff --git a/src/tests/unit/condition/regex.txt b/src/tests/unit/condition/regex.txt index 8a852d80b9..d574ce9567 100644 --- a/src/tests/unit/condition/regex.txt +++ b/src/tests/unit/condition/regex.txt @@ -90,8 +90,8 @@ match ERROR offset 2: Invalid regex reference. Must be in range 0-32 condition User-Name == /foo/ match ERROR offset 13: Unexpected regular expression -condition %md5("foo") =~ /foo/ -match ((string)%md5(0x666f6f) =~ /foo/) +condition %hash.md5("foo") =~ /foo/ +match ((string)%hash.md5(0x666f6f) =~ /foo/) count match 50 diff --git a/src/tests/unit/xlat/base.txt b/src/tests/unit/xlat/base.txt index 4264751207..3d41d08d88 100644 --- a/src/tests/unit/xlat/base.txt +++ b/src/tests/unit/xlat/base.txt @@ -262,8 +262,8 @@ match ERROR offset 7: Invalid argument 1 - Failed parsing string as type 'int8' # # This is correct. # -xlat %rpad(User-Name, 5, 'x') -match %rpad(User-Name, 5, 'x') +xlat %str.rpad(User-Name, 5, 'x') +match %str.rpad(User-Name, 5, 'x') # # The second argument should be an integer. @@ -271,14 +271,14 @@ match %rpad(User-Name, 5, 'x') # @todo - parsing - we don't currently track string offsets for intermediate nodes, # so the "offset" is wrong. It also doesn't say *which* string is wrong. We'll fix that later. # -xlat %rpad(User-Name, 'foo', 'x') -match ERROR offset 17: Invalid argument 2 - Failed parsing string as type 'uint64' +xlat %str.rpad(User-Name, 'foo', 'x') +match ERROR offset 21: Invalid argument 2 - Failed parsing string as type 'uint64' # # Argument quoting # -xlat %md5('"arg"') -match %md5(0x2261726722) +xlat %hash.md5('"arg"') +match %hash.md5(0x2261726722) # # Arguably this should be a parse error. There's trailing text "} @@ -288,20 +288,20 @@ match %md5(0x2261726722) # escape_rules_double, but does NOT look for leading or trailing ". AND it # doesn't pass in a terminal which says to stop at ". # -xlat %md5('"arg')"} -match %md5(0x22617267)\"} +xlat %hash.md5('"arg')"} +match %hash.md5(0x22617267)\"} -xlat %md5('"arg') -match %md5(0x22617267) +xlat %hash.md5('"arg') +match %hash.md5(0x22617267) -xlat %md5('"arg\""') -match %md5(0x226172675c2222) +xlat %hash.md5('"arg\""') +match %hash.md5(0x226172675c2222) -xlat %md5('arg') -match %md5(0x617267) +xlat %hash.md5('arg') +match %hash.md5(0x617267) -xlat %md5('arg"') -match %md5(0x61726722) +xlat %hash.md5('arg"') +match %hash.md5(0x61726722) count match 161 diff --git a/src/tests/unit/xlat/cond_base.txt b/src/tests/unit/xlat/cond_base.txt index a06aa1acea..01243d8cd8 100644 --- a/src/tests/unit/xlat/cond_base.txt +++ b/src/tests/unit/xlat/cond_base.txt @@ -256,19 +256,19 @@ match true # # The MD4 output isn't a valid IP address or prefix. # -xlat_purify (ipaddr)127.0.0.1 == "%md4(' 127.0.0.1')" +xlat_purify (ipaddr)127.0.0.1 == "%hash.md4(' 127.0.0.1')" match ERROR purifying node - Failed to parse IPv4 prefix string "/" -xlat_purify (ipaddr)127.0.0.1 == %md4('127.0.0.1') +xlat_purify (ipaddr)127.0.0.1 == %hash.md4('127.0.0.1') match ERROR purifying node - Invalid cast from octets to ipaddr. Needed octet string of length 4, got 16 -xlat_purify (ipaddr)127.0.0.1 == %md4("SELECT user FROM table WHERE user='%{User-Name}'") -match (127.0.0.1 == %md4("SELECT user FROM table WHERE user='%{User-Name}'")) +xlat_purify (ipaddr)127.0.0.1 == %hash.md4("SELECT user FROM table WHERE user='%{User-Name}'") +match (127.0.0.1 == %hash.md4("SELECT user FROM table WHERE user='%{User-Name}'")) xlat_purify (ether) 00:11:22:33:44:55 == "00:11:22:33:44:55" match true -xlat_purify (ether)00:11:22:33:44:55 == "%md4('00:11:22:33:44:55')" +xlat_purify (ether)00:11:22:33:44:55 == "%hash.md4('00:11:22:33:44:55')" match ERROR purifying node - Missing separator, expected ':' xlat_purify (ether) 00:XX:22:33:44:55 == 00:11:22:33:44:55 @@ -315,10 +315,10 @@ match true # # MD4 hash is not equal to other things # -xlat_purify ("foo" == "%md4(' foo')") +xlat_purify ("foo" == "%hash.md4(' foo')") match false -xlat_purify ("foo bar" == "%md4(' foo')") +xlat_purify ("foo bar" == "%hash.md4(' foo')") match false xlat_purify ("foo" == "bar") @@ -335,11 +335,11 @@ match false xlat_purify (User-Name == "bob") match (User-Name == "bob") -xlat_purify (User-Name == %md4(' blah')) +xlat_purify (User-Name == %hash.md4(' blah')) match (User-Name == 0x544924d05ec4481925ba3749a096a0a7) # and without the double quotes. -xlat_purify (User-Name == %md4(' blah')) +xlat_purify (User-Name == %hash.md4(' blah')) match (User-Name == 0x544924d05ec4481925ba3749a096a0a7) xlat_purify (ipaddr)127.0.0.1 == 2130706433 @@ -430,7 +430,7 @@ match ("foo" == User-Name) # # ERROR: Failed casting 0x002ade8665c69219ca16bd108d92c8d5 to data type uint32: Invalid cast from octets to uint32. Source length 16 is greater than destination type size 4 # -xlat_purify (integer)"%md4(' 1 + 1')" < NAS-Port +xlat_purify (integer)"%hash.md4(' 1 + 1')" < NAS-Port match ERROR purifying node - # diff --git a/src/tests/unit/xlat/expr.txt b/src/tests/unit/xlat/expr.txt index b0a8a5fc33..e8a878b71d 100644 --- a/src/tests/unit/xlat/expr.txt +++ b/src/tests/unit/xlat/expr.txt @@ -93,8 +93,8 @@ match ((1 < 2) || (4 > 3) || (4 == 4) || (1 < 2)) xlat_expr Filter-Id match Filter-Id -xlat_expr %md5('foo') + "foo" -match (%md5(0x666f6f) + "foo") +xlat_expr %hash.md5('foo') + "foo" +match (%hash.md5(0x666f6f) + "foo") # We can name the xlat's, tho we don't need to xlat_expr %op_add(4, 3) + 6 @@ -110,8 +110,8 @@ match (1 < 2) xlat_expr 1 < 2 < 3 match ((1 < 2) < 3) -xlat_expr (uint32) %concat(1, 2) -match (uint32)%concat(1, 2) +xlat_expr (uint32) %str.concat(1, 2) +match (uint32)%str.concat(1, 2) # # Mashing multiple brackets together. The brackets are removed as diff --git a/src/tests/unit/xlat/func.txt b/src/tests/unit/xlat/func.txt index ef7d614ef5..2b1c5ef550 100644 --- a/src/tests/unit/xlat/func.txt +++ b/src/tests/unit/xlat/func.txt @@ -11,10 +11,10 @@ migrate xlat_new_functions = yes xlat %Y() match %Y -xlat %explode("a,b,c,d", ',') -match %explode("a,b,c,d", ',') +xlat %str.split("a,b,c,d", ',') +match %str.split("a,b,c,d", ',') -#xlat %md5(foo) +#xlat %hash.md5(foo) #match foo count diff --git a/src/tests/unit/xlat/purify.txt b/src/tests/unit/xlat/purify.txt index cc4ce2ce93..f126064366 100644 --- a/src/tests/unit/xlat/purify.txt +++ b/src/tests/unit/xlat/purify.txt @@ -121,7 +121,7 @@ match 2 xlat_purify Filter-Id match Filter-Id -xlat_purify %md5('foo') + "bar" +xlat_purify %hash.md5('foo') + "bar" match 0xacbd18db4cc2f85cedef654fccc4a4d8626172 # We can name the xlat's, tho we don't need to @@ -235,37 +235,37 @@ match "hello 3 bob" # migrate xlat_new_functions = yes -xlat_purify %md5('foo') +xlat_purify %hash.md5('foo') match 0xacbd18db4cc2f85cedef654fccc4a4d8 -xlat_purify %explode("a,b,c,d", ',') +xlat_purify %str.split("a,b,c,d", ',') match "a""b""c""d" -xlat_purify %md5('foo') +xlat_purify %hash.md5('foo') match 0xacbd18db4cc2f85cedef654fccc4a4d8 -xlat_purify %md5(%md5('foo')) +xlat_purify %hash.md5(%hash.md5('foo')) match 0x47847ae721df523d6388aebc9c94d656 -xlat_purify %md5('%md5(foo)') -match 0x5e153571422b69cf5c5f7ce5f03985b5 +xlat_purify %hash.md5('%hash.md5(foo)') +match 0xb98c435f641b131d05637746d30c62db # # Constant string # -xlat_purify %md5('%{User-Name}') +xlat_purify %hash.md5('%{User-Name}') match 0x892e91c7b175ab41826c9cb88eebf27a # # This is a reference to the contents of User-Name # -xlat_purify %md5(%{User-Name}) -match %md5(%{User-Name}) +xlat_purify %hash.md5(%{User-Name}) +match %hash.md5(%{User-Name}) -xlat_purify %md5('foo') +xlat_purify %hash.md5('foo') match 0xacbd18db4cc2f85cedef654fccc4a4d8 -xlat_purify %md5("foo") +xlat_purify %hash.md5("foo") match 0xacbd18db4cc2f85cedef654fccc4a4d8 count diff --git a/src/tests/xlat/expr.txt b/src/tests/xlat/expr.txt index 01f8fcd0d1..ead2644103 100644 --- a/src/tests/xlat/expr.txt +++ b/src/tests/xlat/expr.txt @@ -145,20 +145,20 @@ match bob # # We're not hashing the string value of the attribute reference # -xlat_expr (octets) %md5('&User-Name') +xlat_expr (octets) %hash.md5('&User-Name') match 0x14d23a6ed8e7d19fcb3a38dc86c1fc0b # # We're hashing the string contained by the User-Name # -xlat_expr (octets) %md5('bob') +xlat_expr (octets) %hash.md5('bob') match 0x9f9d51bc70ef21ca5c14f307980a29d8 # # And if we take it from the &User-Name ref, we get the same thing # as hashing the bare string. # -xlat_expr (octets) %md5(%{User-Name}) +xlat_expr (octets) %hash.md5(%{User-Name}) match 0x9f9d51bc70ef21ca5c14f307980a29d8 xlat_expr &Service-Type