summaryrefslogtreecommitdiffstats
path: root/tcpproxy-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tcpproxy-model.lua')
-rw-r--r--tcpproxy-model.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/tcpproxy-model.lua b/tcpproxy-model.lua
index d812bb3..e0e820b 100644
--- a/tcpproxy-model.lua
+++ b/tcpproxy-model.lua
@@ -5,7 +5,7 @@ require("modelfunctions")
require("validator")
require("fs")
require("posix")
-require("getopts")
+require("format")
-- Set variables
local configfile = "/etc/tcpproxy.conf"
@@ -68,7 +68,7 @@ end
local function setsmtpcmd(ipaddr, cmd)
if cmd then cmd = "exec "..cmd end
- local file = fs.read_file(configfile)
+ local file = fs.read_file(configfile) or ""
local inport25 = false
local ininterface = false
local done = false
@@ -115,7 +115,7 @@ end
local function parsesmtpcmd(exec)
-- parse the command line into a table
exec = exec or ""
- local options = getopts.opts_to_table(exec) or {}
+ local options = format.opts_to_table(exec) or {}
local server = string.match(exec, "rxmtp.*%s(%S+)%s*$")
if server and not string.match(server, "^%-") then
local test = string.match(exec, "rxmtp.*%s(%S+)%s+%S+%s*$")
@@ -269,9 +269,9 @@ function readsmtpentry(ipaddr)
server.value = options[""] or server.value
addressonly.value = (options["-b"] ~= nil)
if options["-o"] then
- domain.value = string.match(options["-o"], "^[^=]*")
- optionalserver.value = string.match(options["-o"], "=([^=]*)")
- optionalrewritelist.value = string.match(options["-o"], "=.*=(.*)")
+ domain.value = string.match(options["-o"], "^[^=]*") or ""
+ optionalserver.value = string.match(options["-o"], "=([^=]*)") or ""
+ optionalrewritelist.value = string.match(options["-o"], "=.*=(.*)") or ""
end
senderlistfile.value = options["-x"] or senderlistfile.value
rcptlistfile.value = options["-X"] or rcptlistfile.value