diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-12-28 14:19:16 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-12-28 14:19:16 +0000 |
commit | 994bd9783c40699da12f1128c471d7f2802536bf (patch) | |
tree | 4f7d18ee4b8b9b57df93075b259d4ffedc2d6505 /openssl-model.lua | |
parent | c6cc30b44087e6af84283dcf8d199bb95f35fdf5 (diff) | |
download | acf-openssl-994bd9783c40699da12f1128c471d7f2802536bf.tar.bz2 acf-openssl-994bd9783c40699da12f1128c471d7f2802536bf.tar.xz |
basename/dirname functions are no longer in acf-core-0.9.0
Diffstat (limited to 'openssl-model.lua')
-rw-r--r-- | openssl-model.lua | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/openssl-model.lua b/openssl-model.lua index 8bc09e9..423809e 100644 --- a/openssl-model.lua +++ b/openssl-model.lua @@ -1,5 +1,6 @@ module(..., package.seeall) +require("posix") require("modelfunctions") require("fs") require("format") @@ -432,7 +433,7 @@ listrequests = function(user) local list={} local files = posix.glob(requestdir..user..".*\\.csr") or {} for i,x in ipairs(files) do - local name = basename(x,".csr") + local name = string.gsub(posix.basename(x), ".csr$", "") local a,b,c = string.match(name, "([^%.]*)%.([^%.]*)%.([^%.]*)") list[#list + 1] = {name=name, user=a, certtype=b, commonName=unhashname(c)} end @@ -520,7 +521,7 @@ listcerts = function(user) local crtlist = "cat <<-EOF | openssl\n" local crttab = {} for i,x in ipairs(files) do - local name = basename(x,".pfx") + local name = string.gsub(posix.basename(x), ".pfx$", "") local a,b,c,d = string.match(name, "([^%.]*)%.([^%.]*)%.([^%.]*).([^%.]*)") list[#list + 1] = {name=name, user=a, certtype=b, @@ -635,7 +636,7 @@ renewcert = function(cert, approve) end if success and approve then - approverequest(basename(reqname)) + approverequest(posix.basename(reqname)) end return cfe({ type="boolean", value=cmdresult, label="Renew result" }) @@ -821,26 +822,26 @@ checkenvironment = function(set) errtxt[#errtxt+1], cmdline[#cmdline+1] = checkdir("new_certs_dir", chkpath) local file = getconfigentry(config.ca.default_ca, "certificate") - chkpath = dirname(file) + chkpath = posix.dirname(file) errtxt[#errtxt+1], cmdline[#cmdline+1] = checkdir("certificate directory", chkpath) file = getconfigentry(config.ca.default_ca, "private_key") - chkpath = dirname(file) + chkpath = posix.dirname(file) errtxt[#errtxt+1], cmdline[#cmdline+1] = checkdir("private_key directory", chkpath) file = getconfigentry(config.ca.default_ca, "database") - chkpath = dirname(file) + chkpath = posix.dirname(file) errtxt[#errtxt+1], cmdline[#cmdline+1] = checkdir("database directory", chkpath) errtxt[#errtxt+1], cmdline[#cmdline+1] = checkfile("database", file) file = getconfigentry(config.ca.default_ca, "serial") - chkpath = dirname(file) + chkpath = posix.dirname(file) errtxt[#errtxt+1], cmdline[#cmdline+1] = checkdir("serial directory", chkpath) errtxt[#errtxt+1], cmdline[#cmdline+1] = checkfile("serial", file, "01") file = getconfigentry(config.ca.default_ca, "crlnumber") if file ~= "" then - chkpath = dirname(file) + chkpath = posix.dirname(file) errtxt[#errtxt+1], cmdline[#cmdline+1] = checkdir("crlnumber directory", chkpath) errtxt[#errtxt+1], cmdline[#cmdline+1] = checkfile("crlnumber", file, "01") end |