summaryrefslogtreecommitdiffstats
path: root/tcpproxy-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-09-29 18:01:28 +0000
committerTed Trask <ttrask01@yahoo.com>2008-09-29 18:01:28 +0000
commit131d8583638dd5b44d37c292d99740bde3dcf2b6 (patch)
tree24dc5d87aa93e05a1a17a71c478985d624703d33 /tcpproxy-model.lua
parent1d1f5083ddbb17148f8b1a68544890b34c2c8f96 (diff)
downloadacf-tcpproxy-131d8583638dd5b44d37c292d99740bde3dcf2b6.tar.bz2
acf-tcpproxy-131d8583638dd5b44d37c292d99740bde3dcf2b6.tar.xz
Removed getopts library and added functionality to format library as opts_to_table, table_to_opts, parse_configfile2, update_configfile2, get_section, and set_section. New functions work on strings, not files. Modified all code using getopts to use format instead. Fixed nil string bugs in TCPProxy. Fixed forward only bug in DNSCache.
git-svn-id: svn://svn.alpinelinux.org/acf/tcpproxy/trunk@1535 ab2d0c66-481e-0410-8bed-d214d4d58bed
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