liquid_feedback_frontend
view env/ldap/escape_filter.lua @ 1800:b87997219042
Updated spanish translation
author | bsw |
---|---|
date | Thu Oct 21 15:22:29 2021 +0200 (2021-10-21) |
parents | 58f48a8a202a |
children |
line source
1 -- Escape a string to be used as safe LDAP filter
2 -- --------------------------------------------------------------------------
3 --
4 -- arguments:
5 -- filter: the string to be escaped (required)
6 --
7 -- returns:
8 -- escaped_filter: the escaped result
10 function ldap.escape_filter(filter)
12 local null_pattern = (_VERSION == "Lua 5.1") and "%z" or "\000"
14 return string.gsub(filter, "[\\%*%(%)\128-\255" .. null_pattern .. "]", function (char)
16 return string.format("%02x", string.byte(char))
18 end)
20 end