]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use new xlat function syntax in inline comments
authorNick Porter <nick@portercomputing.co.uk>
Tue, 31 Oct 2023 08:56:07 +0000 (08:56 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 31 Oct 2023 15:07:52 +0000 (15:07 +0000)
24 files changed:
src/lib/eap_aka_sim/xlat.c
src/lib/server/main_config.c
src/lib/server/trigger.c
src/lib/tls/conf.c
src/lib/unlang/edit.c
src/lib/unlang/xlat_builtin.c
src/lib/unlang/xlat_expr.c
src/lib/unlang/xlat_tokenize.c
src/modules/rlm_chap/rlm_chap.c
src/modules/rlm_cipher/rlm_cipher.c
src/modules/rlm_client/rlm_client.c
src/modules/rlm_date/rlm_date.c
src/modules/rlm_delay/rlm_delay.c
src/modules/rlm_dict/rlm_dict.c
src/modules/rlm_exec/rlm_exec.c
src/modules/rlm_icmp/rlm_icmp.c
src/modules/rlm_mschap/rlm_mschap.c
src/modules/rlm_pap/rlm_pap.c
src/modules/rlm_perl/rlm_perl.c
src/modules/rlm_radius/test_plan.adoc
src/modules/rlm_redis/rlm_redis.c
src/modules/rlm_rest/rlm_rest.c
src/modules/rlm_unbound/rlm_unbound.5
src/modules/rlm_unpack/rlm_unpack.c

index 1805a8f34cf25c2056ffc0198abe49d43bc8f34f..79070b05c567cd199fd758c3b8517fed5a64751e 100644 (file)
@@ -41,7 +41,7 @@ static xlat_arg_parser_t const aka_sim_xlat_id_method_xlat_args[] = {
 /** Returns the SIM method EAP-SIM or EAP-AKA hinted at by the user identifier
  *
 @verbatim
-%(aka_sim_id_method:%{id_attr})
+%aka_sim_id_method(%{id_attr})
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -98,7 +98,7 @@ static xlat_arg_parser_t const aka_sim_xlat_id_type_xlat_args[] = {
 /** Returns the type of identity used
  *
 @verbatim
-%(aka_sim_id_type:%{id_attr})
+%aka_sim_id_type(%{id_attr})
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -154,7 +154,7 @@ static xlat_arg_parser_t const aka_sim_id_3gpp_temporary_id_key_index_xlat_args[
 /** Returns the key index from a 3gpp temporary id
  *
 @verbatim
-%(3gpp_temporary_id_key_index:%{id_attr})
+%3gpp_temporary_id_key_index(%{id_attr})
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -193,7 +193,7 @@ xlat_arg_parser_t aka_sim_3gpp_temporary_id_decrypt_xlat_args[] = {
 /** Decrypt a 3gpp temporary id
  *
  @verbatim
- %(3gpp_temporary_id_decrypt:<id> <key>)
+ %3gpp_temporary_id_decrypt(<id> <key>)
  @endverbatim
  *
  * The pseudonym is in the format
@@ -337,7 +337,7 @@ xlat_arg_parser_t aka_sim_3gpp_temporary_id_encrypt_xlat_args[] = {
 /** Encrypts a 3gpp pseudonym
  *
 @verbatim
-%(3gpp_temporary_id_encrypt:<id> <key> <index> [(pseudonym|fastauth)])
+%3gpp_temporary_id_encrypt(<id>, <key>, <index>, [(pseudonym|fastauth)])
 @endverbatim
  *
  * @ingroup xlat_functions
index 8e2deae6180c8c6fd79739fcfa39021e0bcde09e..89a38ad358d1cfb9190bc26161097f320ec05788 100644 (file)
@@ -556,7 +556,7 @@ static xlat_arg_parser_t const xlat_config_args[] = {
 /** xlat to get config values
  *
 @verbatim
-%(config:section.subsection.attribute)
+%config(section.subsection.attribute)
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -1390,7 +1390,7 @@ do {\
        if (!client_list_parse_section(cs, 0, false)) goto failure;
 
        /*
-        *      Register the %(config:section.subsection) xlat function.
+        *      Register the %config(section.subsection) xlat function.
         */
        if (unlikely((xlat = xlat_func_register(NULL, "config", xlat_config, FR_TYPE_STRING)) == NULL)) goto failure;
        xlat_func_args_set(xlat, xlat_config_args);
index eb600b3e85796d968dbb02e5335e55b2f459a77c..2c121d0b185ecd0ef53221b0cad782393136e811 100644 (file)
@@ -272,7 +272,7 @@ static unlang_action_t trigger_run(rlm_rcode_t *p_result, UNUSED int *priority,
  * @param[in] name             the path relative to the global trigger section ending in the trigger name
  *                             e.g. module.ldap.pool.start.
  * @param[in] rate_limit       whether to rate limit triggers.
- * @param[in] args             to make available via the @verbatim %(trigger:<arg>) @endverbatim xlat.
+ * @param[in] args             to make available via the @verbatim %trigger(<arg>) @endverbatim xlat.
  * @return
  *     - 0 on success.
  *     - -1 on failure.
index 9378923d08ad915f0c07bd8b183a792c8b333de6..27196617dea0164c8884412b4dd23cf32a9d2361 100644 (file)
@@ -89,7 +89,7 @@ static CONF_PARSER tls_cache_config[] = {
                         },
                         .dflt = "auto" },
        { FR_CONF_OFFSET("name", FR_TYPE_TMPL, fr_tls_cache_conf_t, id_name),
-                        .dflt = "%{EAP-Type}%(interpreter:server)", .quote = T_DOUBLE_QUOTED_STRING },
+                        .dflt = "%{EAP-Type}%interpreter(server)", .quote = T_DOUBLE_QUOTED_STRING },
        { FR_CONF_OFFSET("lifetime", FR_TYPE_TIME_DELTA, fr_tls_cache_conf_t, lifetime), .dflt = "1d" },
 
 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
index d9f92fb22f9f2cf2dc3378341f6029034c880418..25348a522f5cdfc31512e5cfa3fe331727f3ab26 100644 (file)
@@ -935,12 +935,12 @@ static int check_rhs(request_t *request, unlang_frame_state_edit_t *state, edit_
         *      If we deleted the attribute when processing the LHS, then you couldn't reference an attribute
         *      in it's own assignment:
         *
-        *              &foo := %(tolower:foo)
+        *              &foo := %tolower(foo)
         *
         *      so we have to delay the deletion until the RHS has been fully expanded.  But we don't always
         *      delete everything. e.g. if the map is:
         *
-        *              &foo[1] := %(tolower:foo[1])
+        *              &foo[1] := %tolower(foo[1])
         *
         *      The we just apply the assignment to the LHS, over-writing it's value.
         */
index 619746f90717d0d6d1338d56eb2c4bbfaa40e33b..f2685a186522ca23f106f01e9fcfa74abb01f02d 100644 (file)
@@ -440,7 +440,7 @@ static xlat_arg_parser_t const xlat_func_file_name_args[] = {
 };
 
 static xlat_arg_parser_t const xlat_func_file_name_count_args[] = {
-       { .required = true, .type = FR_TYPE_STRING },   
+       { .required = true, .type = FR_TYPE_STRING },
        { .required = false, .type = FR_TYPE_UINT32 },
        XLAT_ARG_PARSER_TERMINATOR
 };
@@ -1242,7 +1242,7 @@ static xlat_arg_parser_t const xlat_func_next_time_args[] = {
 
 /** Calculate number of seconds until the next n hour(s), day(s), week(s), year(s).
  *
- * For example, if it were 16:18 %(nexttime:1h) would expand to 2520.
+ * For example, if it were 16:18 %nexttime(1h) would expand to 2520.
  *
  * The envisaged usage for this function is to limit sessions so that they don't
  * cross billing periods. The output of the xlat should be combined with %{rand:} to create
@@ -2851,7 +2851,7 @@ static xlat_action_t xlat_func_strlen(TALLOC_CTX *ctx, fr_dcursor_t *out,
 #ifdef HAVE_REGEX_PCRE2
 /** Perform regex substitution TODO CHECK
  *
- * Called when %(subst:) pattern begins with "/"
+ * Called when %subst() pattern begins with "/"
  *
 @verbatim
 %subst(<subject>, /<regex>/[flags], <replace>)
index 79eac596ebb43c41c5f7e6d47642d0bdb876e3ce..bc753ed5d1a8894905a9f8c599c5d89f04aef1a4 100644 (file)
@@ -1154,7 +1154,7 @@ static bool xlat_logical_or(xlat_logical_rctx_t *rctx, fr_value_box_list_t const
        fr_value_box_list_foreach(in, box) {
                if (fr_box_is_group(box)) {
                        if (!xlat_logical_or(rctx, &box->vb_group)) return false;
-                       continue;                       
+                       continue;
                }
 
                /*
@@ -1261,7 +1261,7 @@ static bool xlat_logical_and(xlat_logical_rctx_t *rctx, fr_value_box_list_t cons
        fr_value_box_list_foreach(in, box) {
                if (fr_box_is_group(box)) {
                        if (!xlat_logical_or(rctx, &box->vb_group)) return false;
-                       continue;                       
+                       continue;
                }
 
                /*
@@ -1488,7 +1488,7 @@ static xlat_action_t xlat_func_unary_complement(TALLOC_CTX *ctx, fr_dcursor_t *o
  *  xlat_tokenize() just makes all unknown arguments into XLAT_BOX, of data type FR_TYPE_STRING.  Whereas
  *  xlat_tokenize_expr() calls tmpl_afrom_substr(), which tries hard to create a particular data type.
  *
- *  This function fixes up calls of the form %(op_add: 3 4), which normally passes 2 arguments of "3" and "4",
+ *  This function fixes up calls of the form %op_add(3, 4), which normally passes 2 arguments of "3" and "4",
  *  so that the arguments are instead passed as integers 3 and 4.
  *
  *  This fixup isn't *strictly* necessary, but it's good to have no surprises in the code, if the user creates
index 86414a91151dbe3772c9c0a835cae6b87c75e622..6d1d76fc59f3e43bef6f98c3b1a741b3bcf3dade 100644 (file)
@@ -607,7 +607,7 @@ int xlat_tokenize_function_args(xlat_exp_head_t *head, fr_sbuff_t *in,
 /** Parse an xlat function and its child argument
  *
  * Parses a function call string in the format
- * @verbatim %{<func>:<argument>} @endverbatim
+ * @verbatim %<func>(<argument>) @endverbatim
  *
  * @return
  *     - 0 if the string was parsed into a function.
@@ -689,7 +689,7 @@ static int xlat_tokenize_function_new(xlat_exp_head_t *head, fr_sbuff_t *in, tmp
                 *      Anything else, it must be a full function name.
                 */
                fr_sbuff_set(in, &m_s);
-       }             
+       }
 
        fr_sbuff_adv_past_allowed(in, SIZE_MAX, xlat_func_chars, NULL);
 
@@ -1237,7 +1237,7 @@ static int xlat_tokenize_input(xlat_exp_head_t *head, fr_sbuff_t *in,
                        TALLOC_FREE(node); /* nope, couldn't use it */
                        if (xlat_tokenize_function_args(head, in, t_rules) < 0) goto error;
                        continue;
-               }               
+               }
 
                /*
                 *      More migration hacks: allow %foo(...)
index 19fc285796b7fb2643ac9a85e84caa643b59da28..8734eaaaa4bf31c57d46b3e44583ca1585a67a7f 100644 (file)
@@ -121,7 +121,7 @@ static xlat_arg_parser_t const xlat_func_chap_password_args[] = {
  *
  * Example:
 @verbatim
-"%(chap.password:<password>)" == 0x<id><md5_hash>
+%chap.password(<password>) == 0x<id><md5_hash>
 @endverbatim
  *
  * @ingroup xlat_functions
index 6db7e87d1fda9e45912aa263e3d804dc313e34e0..e60e40e9948298c4a857eaee1ad15701ddbf0336 100644 (file)
@@ -775,7 +775,7 @@ static xlat_arg_parser_t const cipher_rsa_verify_xlat_arg[] = {
  * Arguments are @verbatim(<signature>, <plaintext>...)@endverbatim
  *
 @verbatim
-%(<inst>.verify:<signature> <plaintext>...)
+%<inst>.verify(<signature> <plaintext>...)
 @endverbatim
  *
  * If multiple arguments are provided (after @verbatim<signature>@endverbatim)
@@ -809,7 +809,7 @@ static xlat_action_t cipher_rsa_verify_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
         */
        if (in_head->type != FR_TYPE_OCTETS) {
                REDEBUG("Signature argument wrong type, expected %s, got %s.  "
-                       "Use %%(base64.decode:<text>) or %%{hex_decode:<text>} if signature is armoured",
+                       "Use %%base64.decode(<text>) or %%hex_decode(<text>) if signature is armoured",
                        fr_type_to_str(FR_TYPE_OCTETS),
                        fr_type_to_str(in_head->type));
                return XLAT_ACTION_FAIL;
@@ -890,7 +890,7 @@ static xlat_arg_parser_t const cipher_certificate_xlat_args[] = {
  * Arguments are @verbatim(<digest>)@endverbatim
  *
 @verbatim
-%(<inst>.certificate:fingerprint <digest>)
+%<inst>.certificate(fingerprint, <digest>)
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -939,7 +939,7 @@ static xlat_action_t cipher_fingerprint_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
 /** Return the serial of the public certificate
  *
 @verbatim
-%(<inst>.certificate:serial)
+%<inst>.certificate(serial)
 @endverbatim
  *
  * @ingroup xlat_functions
index 247efbfbf68f5fc04929dbafbe22e1e63f7a1f66..8fdbf2b8e0b84efeceabc24bb25317e522ce2ef7 100644 (file)
@@ -226,7 +226,7 @@ static xlat_arg_parser_t const xlat_client_args[] = {
  *
  * Example:
 @verbatim
-%(client:foo [<ipaddr>])
+%client(foo, [<ipaddr>])
 @endverbatim
  *
  * @ingroup xlat_functions
index 2c0c325a0eba2323486373301809ce8bbdd560d6..fac0d857f1eb2d364704db1d9cbe0dd20daeb755 100644 (file)
@@ -148,19 +148,19 @@ static xlat_arg_parser_t const xlat_date_convert_args[] = {
  *
  * When the request arrived:
 @verbatim
-%(date:request)
+%date(request)
 @endverbatim
  *
  * Now:
 @verbatim
-%(date:now}
+%date(now)
 @endverbatim
  *
  * Examples (Tmp-Integer-0 = 1506101100):
 @verbatim
 update request {
-  &Tmp-String-0 := "%(date:%{Tmp-Integer-0})" ("Fri 22 Sep 18:25:00 BST 2017")
-  &Tmp-Integer-1 := "%(date:%{Tmp-String-0})" (1506101100)
+  &Tmp-String-0 := %date(%{Tmp-Integer-0}) ("Fri 22 Sep 18:25:00 BST 2017")
+  &Tmp-Integer-1 := %date(%{Tmp-String-0}) (1506101100)
 }
 @endverbatim
  *
index 5c34cb62bd680f47e3f78d538c5bd5b3a620a621..c3971d46cfee19091602f4f325b63492dc879116 100644 (file)
@@ -211,7 +211,7 @@ static xlat_arg_parser_t const xlat_delay_args[] = {
  *
  * Example (delay 2 seconds):
 @verbatim
-"%(delay:2)"
+%delay(2)
 @endverbatim
  *
  * @ingroup xlat_functions
index 49d82dd8797ef864b2e508e8d0bbe11fb529b0e3..9f6ba3946d21d9db16405f2592bd4bde4993f1e6 100644 (file)
@@ -33,7 +33,7 @@ static xlat_arg_parser_t const xlat_dict_attr_by_num_args[] = {
        XLAT_ARG_PARSER_TERMINATOR
 };
 
-/** Xlat for %(attr_by_num:\<number\>)
+/** Xlat for %attr_by_num(\<number\>)
  *
  * @ingroup xlat_functions
  */
@@ -67,7 +67,7 @@ static xlat_arg_parser_t const xlat_dict_attr_by_oid_args[] = {
        XLAT_ARG_PARSER_TERMINATOR
 };
 
-/** Xlat for %(attr_by_oid:\<oid\>)
+/** Xlat for %attr_by_oid(\<oid\>)
  *
  * @ingroup xlat_functions
  */
index 3483c6f8dff95d3e71c83a2aab48dc7076203622..7c4e94005be15208a260bb5b11d8fcf943973f15 100644 (file)
@@ -122,7 +122,7 @@ static xlat_arg_parser_t const exec_xlat_args[] = {
  *
  * Example:
 @verbatim
-"%(exec:/bin/echo hello)" == "hello"
+%exec('/bin/echo', 'hello') == "hello"
 @endverbatim
  *
  * Exactly one request is consumed during the process lifetime,
index 203d02b2836635658e221fff9dc4169293c1a9e1..68eecf657b3084749b81ac49fc5a200f37ffd539 100644 (file)
@@ -161,7 +161,7 @@ static xlat_arg_parser_t const xlat_icmp_args[] = {
  *
  * Example (ping 192.0.2.1):
 @verbatim
-"%(icmp:192.0.2.1)"
+%icmp(192.0.2.1)
 @endverbatim
  *
  * @ingroup xlat_functions
index 739408daf5790fc60bcbd3e2d4cf6e064ee2ea9c..10be67dddf595cf9495e59c7e9be1fdb18f5d57b 100644 (file)
@@ -830,8 +830,8 @@ static int CC_HINT(nonnull (1, 2, 4, 5)) do_mschap_cpw(rlm_mschap_t const *inst,
                 * we're expecting to use the ntlm-change-password-1 protocol
                 * which needs the following on stdin:
                 *
-                * username: %(mschap:User-Name)
-                * nt-domain: %(mschap:NT-Domain)
+                * username: %mschap(User-Name)
+                * nt-domain: %mschap(NT-Domain)
                 * new-nt-password-blob: bin2hex(new_nt_password) - 1032 bytes encoded
                 * old-nt-hash-blob: bin2hex(old_nt_hash) - 32 bytes encoded
                 * new-lm-password-blob: 00000...0000 - 1032 bytes null
@@ -999,11 +999,11 @@ ntlm_auth_err:
                 *
                 *  this allows is to write e..g
                 *
-                *  %{sql:insert into ...}
+                *  %sql(insert into ...)
                 *
                 *  ...or...
                 *
-                *  %(exec:/path/to %(mschap:User-Name) %{MS-CHAP-New-Password})"
+                *  %exec('/path/to', %mschap(User-Name), %{MS-CHAP-New-Password})"
                 *
                 */
        } else if (inst->local_cpw) {
index 40c6402c86ee53735413b5e45d7d814b77c2c796..0a134e9541a375fa414c618bfda9b2d405d3ce1b 100644 (file)
@@ -795,7 +795,7 @@ static unlang_action_t CC_HINT(nonnull) pap_auth_lm(rlm_rcode_t *p_result,
                RETURN_MODULE_INVALID;
        }
 
-       len = xlat_eval(charbuf, sizeof(charbuf), request, "%(mschap:LM-Hash %{User-Password})", NULL, NULL);
+       len = xlat_eval(charbuf, sizeof(charbuf), request, "%mschap(LM-Hash, %{User-Password})", NULL, NULL);
        if (len < 0) RETURN_MODULE_FAIL;
 
        if ((fr_base16_decode(NULL, &digest_dbuff, &FR_SBUFF_IN(charbuf, len), false) !=
index 6167caf1ec1bb980df94bdebb72f6f3f7f7c3ef3..2a4994909b9550c0b87fd9435398e0eb25303fb3 100644 (file)
@@ -202,7 +202,7 @@ static XS(XS_radiusd_log)
 /*
  *     This is a wraper for xlat_aeval
  *     Now users are able to get data that is accessible only via xlat
- *     e.g. %(client:...)
+ *     e.g. %client(...)
  *     Call syntax is radiusd::xlat(string), string will be handled the
  *     same way it is described in EXPANSIONS section of man unlang
  */
index d4dca7dd8a74766daf9860cec8d712066c4bfec0..66b21026d81444f5f1b047214accc098d539d1ca 100644 (file)
@@ -45,7 +45,7 @@ Class = 0x69616D616E6F706171756576616C756569616D616E6F706171756576616C7565
 ==== CHAP Access-Request - unlang
 ```
 User-Name = "testuser"
-Chap-Password = %(chap.password:supersecret)
+Chap-Password = %chap.password(supersecret)
 Service-Type = Framed-User
 NAS-IP-Address = 127.0.0.1
 Tunnel-Password = "supersecret"
index 2cd540b1c6e94382b65bc974c37cd748c8ffb322..5d36dd964bd0f6bd594f94ea6d36651504622a5c 100644 (file)
@@ -317,7 +317,7 @@ static xlat_arg_parser_t const redis_node_xlat_args[] = {
 /** Return the node that is currently servicing a particular key
  *
 @verbatim
-%(redis.node:<key> [<index>])
+%redis.node(<key>[, <index>])
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -581,7 +581,7 @@ static xlat_arg_parser_t const redis_args[] = {
 /** Xlat to make calls to redis
  *
 @verbatim
-%(redis:<redis command>)
+%redis(<redis command>)
 @endverbatim
  *
  * @ingroup xlat_functions
@@ -867,7 +867,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
        xlat_func_args_set(xlat, redis_args);
 
        /*
-        *      %(redis.node:<key>[ idx])
+        *      %redis.node(<key>[, idx])
         */
        if (unlikely((xlat = xlat_func_register_module(inst, mctx, "node", redis_node_xlat, FR_TYPE_STRING)) == NULL)) return -1;
        xlat_func_args_set(xlat, redis_node_xlat_args);
index 35918e42c013b56a7f5d5f69764b35f2672e0113..8388c79d5e39e9dddf958a65c006d2be1f564d98 100644 (file)
@@ -395,7 +395,7 @@ static xlat_arg_parser_t const rest_xlat_args[] = {
  *
  * Example:
 @verbatim
-%(rest:http://example.com/)
+%rest(http://example.com/)
 @endverbatim
  *
  * @ingroup xlat_functions
index 2d3ffc4afc19f1527a4dd8ac9116e993fb1f93bf..613015a63ce9412f18f8d8b68148c5ece9961333 100644 (file)
@@ -36,19 +36,19 @@ any libunbound configuration values.
 .PP
 An instance named, for example, "dns" will provide the following xlat
 functionalities:
-.IP %(dns:<owner> <record type> [<limit>])
+.IP %dns(<owner>, <record type>[, <limit>])
 Perform the lookup of <record type> against <owner> returning up to
 <limit> results.  The returned data type is appropriate to the record
 type being queried.
-.IP %(dns:<owner> A)
+.IP %dns(<owner>, A)
 Performs an A lookup for the owner name, returning the results as IPv4
 addresses.
-.IP %(dns:<owner> AAAA)
+.IP %dns(<owner>, AAAA)
 Performs an AAAA lookup for the owner name, returning the results as IPv6
 addresses.
-.IP %(dns:<owner> PTR)
+.IP %dns(<owner>, PTR)
 Performs a PTR lookup for the owner.
-.IP %(dns:<owner> MX 1)
+.IP %dns(<owner>, MX, 1)
 Performs an MX lookup for the owner, returning just the first result.
 .PP
 .SH CAVEATS
index 3f9208d4c870b689aabd64b935c11a4eb9a3806c..5aa05cd96f030539d3f51f9b5da4bcee7f8ccd76 100644 (file)
@@ -42,7 +42,7 @@ static xlat_arg_parser_t const unpack_xlat_args[] = {
  *
  * Example:
 @verbatim
-%(unpack:%{Class} 0 integer)
+%unpack(%{Class}, 0, integer)
 @endverbatim
  * Expands Class, treating octet at offset 0 (bytes 0-3) as an "integer".
  *