From: Alan T. DeKok Date: Thu, 8 May 2025 17:50:55 +0000 (-0400) Subject: rename %client() to %request.client() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=183cc69ca65ad6f6a357fc030847bca85190cf36;p=thirdparty%2Ffreeradius-server.git rename %client() to %request.client() the old name is still supported for compatibility --- diff --git a/doc/antora/modules/reference/pages/raddb/mods-available/client.adoc b/doc/antora/modules/reference/pages/raddb/mods-available/client.adoc index 20de856a91c..69c8ad15778 100644 --- a/doc/antora/modules/reference/pages/raddb/mods-available/client.adoc +++ b/doc/antora/modules/reference/pages/raddb/mods-available/client.adoc @@ -72,9 +72,9 @@ map client [] { // <1> [options="header,autowidth"] |=== -| XLAT | Description -| `%client()` | Expands to the named _field_ in the current client definition. -| `%client(, )` | Expands to the named _field_ in the client specified by _ipaddr_. +| Function | Description +| `%request.client()` | Expands to the named _field_ in the current client definition. +| `%request.client(, )` | Expands to the named _field_ in the client specified by _ipaddr_. |=== diff --git a/raddb/mods-available/client b/raddb/mods-available/client index 6e907d95733..3f64dbd845b 100644 --- a/raddb/mods-available/client +++ b/raddb/mods-available/client @@ -75,9 +75,9 @@ # # [options="header,autowidth"] # |=== -# | XLAT | Description -# | `%client()` | Expands to the named _field_ in the current client definition. -# | `%client(, )` | Expands to the named _field_ in the client specified by _ipaddr_. +# | Function | Description +# | `%request.client()` | Expands to the named _field_ in the current client definition. +# | `%request.client(, )` | Expands to the named _field_ in the client specified by _ipaddr_. # |=== # diff --git a/src/modules/rlm_client/rlm_client.c b/src/modules/rlm_client/rlm_client.c index 44c8058856f..349df530e31 100644 --- a/src/modules/rlm_client/rlm_client.c +++ b/src/modules/rlm_client/rlm_client.c @@ -226,7 +226,7 @@ static xlat_arg_parser_t const xlat_client_args[] = { * * Example: @verbatim -%client(foo, []) +%request.client(foo, []) @endverbatim * * @ingroup xlat_functions @@ -357,6 +357,9 @@ static int mod_load(void) if (unlikely((xlat = xlat_func_register(NULL, "client", xlat_client, FR_TYPE_STRING)) == NULL)) return -1; xlat_func_args_set(xlat, xlat_client_args); + if (unlikely((xlat = xlat_func_register(NULL, "request.client", xlat_client, FR_TYPE_STRING)) == NULL)) return -1; + xlat_func_args_set(xlat, xlat_client_args); + map_proc_register(NULL, NULL, "client", map_proc_client, NULL, 0, FR_VALUE_BOX_SAFE_FOR_ANY); return 0; diff --git a/src/modules/rlm_perl/rlm_perl.c b/src/modules/rlm_perl/rlm_perl.c index 89f37fe2ea8..b8167b0b369 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -235,7 +235,7 @@ static XS(XS_radiusd_log) /* * This is a wrapper for xlat_aeval * Now users are able to get data that is accessible only via xlat - * e.g. %client(...) + * e.g. %request.client(...) * Call syntax is radiusd::xlat(string), string will be handled as * a double-quoted string in the configuration files. */ diff --git a/src/tests/modules/client/xlat.unlang b/src/tests/modules/client/xlat.unlang index 3277ebd0b92..879501200bc 100644 --- a/src/tests/modules/client/xlat.unlang +++ b/src/tests/modules/client/xlat.unlang @@ -1,24 +1,24 @@ string test_string -test_string := "%client('nas_type')" +test_string := "%request.client('nas_type')" if (test_string != 'a_type') { test_fail } -test_string := "%client('nas_type',127.0.0.1)" +test_string := "%request.client('nas_type',127.0.0.1)" if (test_string != 'a_type') { test_fail } -test_string := "%client('nas_type',127.0.0.2)" +test_string := "%request.client('nas_type',127.0.0.2)" if (test_string != 'b_type') { test_fail } -test_string := "%client('nas_type',127.0.0.5)" +test_string := "%request.client('nas_type',127.0.0.5)" if (test_string != 'b_type') { test_fail @@ -27,12 +27,12 @@ if (test_string != 'b_type') { # # Test non-existent client properties # -test_string := "%client('non-existent-attr')" +test_string := "%request.client('non-existent-attr')" if !(test_string == "") { test_fail } -test_string := "%client('non-existing-attr2')" +test_string := "%request.client('non-existing-attr2')" if !(test_string == "") { test_fail } diff --git a/src/tests/modules/perl/test.pl b/src/tests/modules/perl/test.pl index d7bb2a23ce0..b19cbb1f83c 100644 --- a/src/tests/modules/perl/test.pl +++ b/src/tests/modules/perl/test.pl @@ -71,7 +71,7 @@ sub authenticate { return RLM_MODULE_NOTFOUND; } else { # Accept user and set some attribute - if (&radiusd::xlat("%client(group)") eq 'UltraAllInclusive') { + if (&radiusd::xlat("%request.client(group)") eq 'UltraAllInclusive') { # User called from NAS with unlim plan set, set higher limits $RAD_REPLY{'Vendor-Specific'}{'Cisco'}{'h323-credit-amount'} = "1000000"; $RAD_REPLY{'Filter-Id'} = 'Everything'