liquid_feedback_frontend

view env/ldap/escape_filter.lua @ 1071:58f48a8a202a

Imported and merged LDAP patch
author bsw
date Fri Jul 18 21:42:59 2014 +0200 (2014-07-18)
parents
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

Impressum / About Us