From: Arran Cudbard-Bell Date: Wed, 24 Jan 2024 23:09:44 +0000 (-0600) Subject: Rename ldap escape and unescape xlats... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13cd69e7f7f4c36aa3ee72e475bcc819c5129b6a;p=thirdparty%2Ffreeradius-server.git Rename ldap escape and unescape xlats... --- diff --git a/doc/antora/modules/raddb/pages/mods-available/ldap.adoc b/doc/antora/modules/raddb/pages/mods-available/ldap.adoc index e8a6d5fc79c..1fc1b45ce69 100644 --- a/doc/antora/modules/raddb/pages/mods-available/ldap.adoc +++ b/doc/antora/modules/raddb/pages/mods-available/ldap.adoc @@ -744,7 +744,7 @@ binds which there can be on a single thread. The rlm_ldap provides the below xlat's functions. -### %ldap_escape(...} +### %ldap.escape(...} Escape a string for use in an LDAP filter or DN. @@ -755,7 +755,7 @@ Escape a string for use in an LDAP filter or DN. [source,unlang] ---- &my-string := "ldap:///ou=profiles,dc=example,dc=com??sub?(objectClass=radiusprofile)" -&reply.Reply-Message := "The LDAP url is %ldap_escape(%{my-string}}" +&reply.Reply-Message := "The LDAP url is %ldap.escape(%{my-string}}" ---- .Output @@ -764,7 +764,7 @@ Escape a string for use in an LDAP filter or DN. "The LDAP url is ldap:///ou=profiles,dc=example,dc=com??sub?\28objectClass=radiusprofile\29" ``` -### %ldap_unescape(...) +### %ldap.unescape(...) Unescape a string for use in an LDAP filter or DN. @@ -775,7 +775,7 @@ Unescape a string for use in an LDAP filter or DN. [source,unlang] ---- &my-string := "ldap:///ou=profiles,dc=example,dc=com??sub?\28objectClass=radiusprofile\29" -&reply.Reply-Message := "The LDAP url is %ldap_unescape(%{my-string})" +&reply.Reply-Message := "The LDAP url is %ldap.unescape(%{my-string})" ---- .Output diff --git a/raddb/mods-available/ldap b/raddb/mods-available/ldap index 912452f8032..ec45c5cfe9a 100644 --- a/raddb/mods-available/ldap +++ b/raddb/mods-available/ldap @@ -884,7 +884,7 @@ ldap { # # The rlm_ldap provides the below xlat's functions. # -# ### %ldap_escape(...} +# ### %ldap.escape(...} # # Escape a string for use in an LDAP filter or DN. # @@ -895,7 +895,7 @@ ldap { # [source,unlang] # ---- # &my-string := "ldap:///ou=profiles,dc=example,dc=com??sub?(objectClass=radiusprofile)" -# &reply.Reply-Message := "The LDAP url is %ldap_escape(%{my-string}}" +# &reply.Reply-Message := "The LDAP url is %ldap.escape(%{my-string}}" # ---- # # .Output @@ -904,7 +904,7 @@ ldap { # "The LDAP url is ldap:///ou=profiles,dc=example,dc=com??sub?\28objectClass=radiusprofile\29" # ``` # -# ### %ldap_unescape(...) +# ### %ldap.unescape(...) # # Unescape a string for use in an LDAP filter or DN. # @@ -915,7 +915,7 @@ ldap { # [source,unlang] # ---- # &my-string := "ldap:///ou=profiles,dc=example,dc=com??sub?\28objectClass=radiusprofile\29" -# &reply.Reply-Message := "The LDAP url is %ldap_unescape(%{my-string})" +# &reply.Reply-Message := "The LDAP url is %ldap.unescape(%{my-string})" # ---- # # .Output diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 513b0ffd613..a64c3a6e607 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -2562,10 +2562,10 @@ static int mod_load(void) { xlat_t *xlat; - if (unlikely(!(xlat = xlat_func_register(NULL, "ldap_escape", ldap_escape_xlat, FR_TYPE_STRING)))) return -1; + if (unlikely(!(xlat = xlat_func_register(NULL, "ldap.escape", ldap_escape_xlat, FR_TYPE_STRING)))) return -1; xlat_func_mono_set(xlat, ldap_escape_xlat_arg); xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE); - if (unlikely(!(xlat = xlat_func_register(NULL, "ldap_unescape", ldap_unescape_xlat, FR_TYPE_STRING)))) return -1; + if (unlikely(!(xlat = xlat_func_register(NULL, "ldap.unescape", ldap_unescape_xlat, FR_TYPE_STRING)))) return -1; xlat_func_mono_set(xlat, ldap_escape_xlat_arg); xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE); @@ -2574,8 +2574,8 @@ static int mod_load(void) static void mod_unload(void) { - xlat_func_unregister("ldap_escape"); - xlat_func_unregister("ldap_unescape"); + xlat_func_unregister("ldap.escape"); + xlat_func_unregister("ldap.unescape"); } /* globally exported name */ diff --git a/src/tests/modules/ldap/xlat.unlang b/src/tests/modules/ldap/xlat.unlang index b8aa18259b9..8daae49be23 100644 --- a/src/tests/modules/ldap/xlat.unlang +++ b/src/tests/modules/ldap/xlat.unlang @@ -8,13 +8,13 @@ string result_string &test_string := "safe string" # String with no escaping -&result_string := %ldap_escape(%{test_string}) +&result_string := %ldap.escape(%{test_string}) if (!(&result_string == "safe string")) { test_fail } -&result_string := %ldap_unescape(%{result_string}) +&result_string := %ldap.unescape(%{result_string}) if (!(&result_string == 'safe string')) { test_fail @@ -22,13 +22,13 @@ if (!(&result_string == 'safe string')) { # String with some characters to escape &test_string := 'non safe,+"\<>;*=() string' -&result_string := %ldap_escape(%{test_string}) +&result_string := %ldap.escape(%{test_string}) if (!(&result_string == 'non safe\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29 string')) { test_fail } -&result_string := %ldap_unescape(%{result_string}) +&result_string := %ldap.unescape(%{result_string}) if (!(&result_string == 'non safe,+"\<>;*=() string')) { test_fail @@ -36,13 +36,13 @@ if (!(&result_string == 'non safe,+"\<>;*=() string')) { # String where all characters require escaping &test_string := ',+"\<>;*=()' -&result_string := %ldap_escape(%{test_string}) +&result_string := %ldap.escape(%{test_string}) if (!(&result_string == '\2c\2b\22\5c\3c\3e\3b\2a\3d\28\29')) { test_fail } -&result_string := %ldap_unescape(%{result_string}) +&result_string := %ldap.unescape(%{result_string}) if (!(&result_string == ',+"\<>;*=()')) { test_fail