summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openssl-model.lua17
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