Software /
code /
prosody-modules
Diff
mod_firewall/mod_firewall.lua @ 2546:6e4494772328
mod_firewall: Add stripslashes() function
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 23 Feb 2017 13:57:48 +0000 |
parent | 2544:223eea31588d |
child | 2547:eb4f45bd7fef |
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua Tue Feb 21 22:41:58 2017 +0000 +++ b/mod_firewall/mod_firewall.lua Thu Feb 23 13:57:48 2017 +0000 @@ -125,6 +125,14 @@ :gsub([[%.%.""$]], "")); end +local escape_chars = { + a = "\a", b = "\b", f = "\f", n = "\n", r = "\r", t = "\t", + v = "\v", ["\\"] = "\\", ["\""] = "\"", ["\'"] = "\'" +}; +function stripslashes(s) + return (s:gsub("\\(.)", escape_chars)); +end + -- Dependency locations: -- <type lib> -- <type global>