diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-01-21 22:04:37 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-01-21 22:04:37 +0000 |
commit | e5cdb84647b17427ed0f8afc77ab83af6f537ac0 (patch) | |
tree | a08a425cb3704fbc75143d09715c6815ed3ec6f6 /lib/fs.lua | |
parent | 1a930fe2020e3d309f4716c4814d1dd8a92ee03c (diff) | |
download | acf-core-e5cdb84647b17427ed0f8afc77ab83af6f537ac0.tar.bz2 acf-core-e5cdb84647b17427ed0f8afc77ab83af6f537ac0.tar.xz |
Added escapespecialcharacters to format.lua to escape shell special characters. Reviewed all calls to io.popen and os.execute to escape special characters. Fixed file uploads in openssl and ipsectools with viewfunctions.lua. Tried to fix openssl renew when subject contains special characters, but not done yet.release-0.4.19
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1687 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/fs.lua')
-rw-r--r-- | lib/fs.lua | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -7,7 +7,8 @@ module (..., package.seeall) -require ("posix") +require("posix") +require("format") basename = function (string, suffix) string = string or "" @@ -43,7 +44,7 @@ end -- Creates a directory if it doesn't exist function create_directory ( path ) - local cmd = "mkdir -p "..(path or "") + local cmd = "mkdir -p " .. format.escapespecialcharacters(path) local f = io.popen(cmd) f:close() return is_dir(path) @@ -53,7 +54,7 @@ end function create_file ( path ) path = path or "" if dirname(path) and not posix.stat(dirname(path)) then create_directory(dirname(path)) end - local cmd = "touch "..path + local cmd = "touch "..format.escapespecialcharacters(path) local f = io.popen(cmd) f:close() return is_file(path) @@ -116,9 +117,9 @@ end --will return a string with md5sum and filename function md5sum_file ( path ) - cmd = "/usr/bin/md5sum " .. (path or "") + local cmd = "/usr/bin/md5sum "..format.escapespecialcharacters(path) f = io.popen(cmd) - checksum = f:read("*a") + local checksum = f:read("*a") f:close() return checksum end |