Merge pull request #2806 from dibdot/magic

system-wide: fix escaping of magic chars
This commit is contained in:
Jo-Philipp Wich 2019-07-07 15:39:56 +02:00 committed by GitHub
commit 1fad6c0eed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View file

@ -26,7 +26,7 @@ pwd.password = false
function pwd.write(self, section, value)
local pass
if string.match(value, "^\$%d\$.*") then
if string.match(value, "^%$%d%$.*") then
pass = value
else
local t = tonumber(nixio.getpid()*os.time())

View file

@ -418,7 +418,7 @@ function maxlength(val, max)
end
function phonedigit(val)
return (val:match("^[0-9\*#!%.]+$") ~= nil)
return (val:match("^[0-9%*#!%.]+$") ~= nil)
end
function timehhmmss(val)

View file

@ -207,9 +207,8 @@ end
-- handling. It may actually be a property of the getopt function
-- rather than the shell proper.
function shellstartsqescape(value)
res, _ = string.gsub(value, "^\-", "\\-")
res, _ = string.gsub(res, "^-", "\-")
return shellsqescape(value)
res, _ = string.gsub(value, "^%-", "\\-")
return shellsqescape(res)
end
-- containing the resulting substrings. The optional max parameter specifies