The rlm_ldap provides the below xlat's functions.
-### %ldap_escape(...}
+### %ldap.escape(...}
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
"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.
[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
#
# The rlm_ldap provides the below xlat's functions.
#
-# ### %ldap_escape(...}
+# ### %ldap.escape(...}
#
# 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
# "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.
#
# [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
{
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);
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 */
&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
# 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
# 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