From: Jorge Pereira Date: Tue, 20 Aug 2019 23:43:46 +0000 (-0300) Subject: Add some documentation for missing xlat's functions. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af18effb0673344d14563cc9cacc3898278c1955;p=thirdparty%2Ffreeradius-server.git Add some documentation for missing xlat's functions. for the below modules: rlm_dhcpv4 rlm_eap rlm_json rlm_ldap rlm_yubikey --- diff --git a/raddb/mods-available/dhcpv4 b/raddb/mods-available/dhcpv4 index 94fc4035916..693635f51ac 100644 --- a/raddb/mods-available/dhcpv4 +++ b/raddb/mods-available/dhcpv4 @@ -33,3 +33,69 @@ # dhcpv4 { } + +# +# ## Expansions +# +# The rlm_dhcpv4 provides the below xlat's functions to handle the DHCPV4 packets. +# +# ### %{dhcpv4_decode:...} +# +# Decode DHCP option declared in dictionary.rfc2131. +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# update request { +# &Tmp-Octets-0 := 0x520d0103abcdef0206010203040506 +# } +# if ("%{dhcpv4_decode:%{Tmp-Octets-0}}" != 2) { +# update reply { +# &Reply-Message := "Problems to decode the DHPCv4 fields." +# } +# reject +# } +# update reply { +# &Reply-Message := "The value of DHCP-Relay-Circuit-Id=%{DHCP-Relay-Circuit-Id}, DHCP-Relay-Remote-Id=%{DHCP-Relay-Remote-Id}" +# } +# ---- +# +# .Output +# +# ``` +# "The value of DHCP-Relay-Circuit-Id=0xabcdef, DHCP-Relay-Remote-Id=0x010203040506" +# ``` +# +# ### %{dhcpv4_encode:...} +# +# Encode DHCP option declared in dictionary.rfc2131. +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# update request { +# &DHCP-Relay-Circuit-Id := 0xabcdef +# &DHCP-Relay-Remote-Id := 0x010203040506 +# } +# update request { +# &Tmp-Octets-0 := "%{dhcpv4_encode:&request:[*]}" +# } +# if (&Tmp-Octets-0 != 0x520d0103abcdef0206010203040506) { +# update reply { +# &Reply-Message := "Invalid DHCP packets" +# } +# reject +# } +# ---- +# +# .Output +# +# ``` +# +# ``` diff --git a/raddb/mods-available/eap b/raddb/mods-available/eap index bcdd144cc26..2e268d6b082 100644 --- a/raddb/mods-available/eap +++ b/raddb/mods-available/eap @@ -1389,3 +1389,103 @@ eap { } } + +# +# ## Expansions +# +# The rlm_eap module provides the below functions to interact with the `3GPP` and `SIM` protocols. +# +# ### %{3gpp_pseudonym_decrypt:...} +# +# TODO +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# TODO +# ---- +# +# .Output +# +# ``` +# TODO +# ``` +# +# ### %{3gpp_pseudonym_encrypt:...} +# +# TODO +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# TODO +# ---- +# +# .Output +# +# ``` +# TODO +# ``` +# +# ### %{3gpp_pseudonym_key_index:...} +# +# TODO +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# TODO +# ---- +# +# .Output +# +# ``` +# TODO +# ``` +# +# ### %{sim_id_method:...} +# +# TODO +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# TODO +# ---- +# +# .Output +# +# ``` +# TODO +# ``` +# +# ### %{sim_id_type:...} +# +# TODO +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# TODO +# ---- +# +# .Output +# +# ``` +# TODO +# ``` diff --git a/raddb/mods-available/json b/raddb/mods-available/json index 32122816d4c..773fc768fb7 100644 --- a/raddb/mods-available/json +++ b/raddb/mods-available/json @@ -80,3 +80,59 @@ json { # } # ---- # + +# +# ## Expansions +# +# The rlm_json provides the below xlat's functions to handle the JSON string. +# +# ### %{jpathvalidate:...} +# +# Determine if a jpath expression is valid. +# +# NOTE: Validate parser for everything except unions and expressions. +# +# .Return: _size_t_ +# +# .Example +# +# [source,unlang] +# ---- +# update control { +# &Tmp-String-0 := '$.my.json.payload[1]' +# } +# update reply { +# &Reply-Message := "Validation of %{control:Tmp-String-0} is %{jpathvalidate:$.my.json.payload[1]}" +# } +# ---- +# +# .Output +# +# ``` +# Validation of $.my.json.payload[1] is 20:$.my.json.payload[1] +# ``` +# +# ### %{jsonquote:...} +# +# Escapes string for use as a JSON string. +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# update control { +# &Tmp-String-0 := "caipirinha/gelada" +# } +# update reply { +# &Reply-Message := "The string %{control:Tmp-String-0} should be %{jsonquote:%{control:Tmp-String-0}} to be a valid JSON string." +# } +# ---- +# +# .Output +# +# ``` +# The string caipirinha/gelada should be caipirinha\\/gelada to be a valid JSON string. +# ``` +# \ No newline at end of file diff --git a/raddb/mods-available/ldap b/raddb/mods-available/ldap index 9e37ee012fa..edd3dc1b257 100644 --- a/raddb/mods-available/ldap +++ b/raddb/mods-available/ldap @@ -818,3 +818,57 @@ ldap { # } } + +# +# ## Expansions +# +# The rlm_ldap provides the below xlat's functions. +# +# ### %{ldap_escape:...} +# +# Escape a string for use in an LDAP filter or DN. +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# update control { +# &Tmp-String-0 := "ldap:///ou=profiles,dc=example,dc=com??sub?(objectClass=radiusprofile)" +# } +# update reply { +# &Reply-Message := "The LDAP url is %{ldap_escape:%{control:Tmp-String-0}}" +# } +# ---- +# +# .Output +# +# ``` +# "The LDAP url is ldap:///ou=profiles,dc=example,dc=com??sub?\28objectClass=radiusprofile\29" +# ``` +# +# ### %{ldap_unescape:...} +# +# Unescape a string for use in an LDAP filter or DN. +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# update control { +# &Tmp-String-0 := "ldap:///ou=profiles,dc=example,dc=com??sub?\28objectClass=radiusprofile\29" +# } +# update reply { +# &Reply-Message := "The LDAP url is %{ldap_unescape:%{control:Tmp-String-0}}" +# } +# ---- +# +# .Output +# +# ``` +# "The LDAP url is ldap:///ou=profiles,dc=example,dc=com??sub?(objectClass=radiusprofile)" +# ``` +# diff --git a/raddb/mods-available/yubikey b/raddb/mods-available/yubikey index 8f9451b0e0d..80f0921344e 100644 --- a/raddb/mods-available/yubikey +++ b/raddb/mods-available/yubikey @@ -259,3 +259,28 @@ yubikey { } } } + +# +# ## Expansions +# +# The rlm_yubikey provides the below xlat's functions. +# +# ### %{modhextohex:...} +# +# Convert Yubikey modhex to standard hex. +# +# .Return: _string_ +# +# .Example +# +# [source,unlang] +# ---- +# "%{modhextohex:vvrbuctetdhc}" == "ffc1e0d3d260" +# ---- +# +# .Output +# +# ``` +# TODO +# ``` +#