Commit c2a2a5a5 authored by Ted Trask's avatar Ted Trask

Added ssl support to fetchmail. Plus a few bug fixes.

git-svn-id: svn://svn.alpinelinux.org/acf/fetchmail/trunk@1440 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent c86a24ab
......@@ -8,6 +8,6 @@ require("viewfunctions")
if page_info.action == "editentry" then
form.value.remotehost.contenteditable = false
end
local order = { "remotehost", "enabled", "method", "remotemailbox", "remotepassword", "localhost", "localmailbox", "localdomain" }
local order = { "remotehost", "enabled", "method", "remotemailbox", "remotepassword", "ssl", "localhost", "localmailbox", "localdomain" }
displayform(form, order)
%>
......@@ -36,7 +36,7 @@ local function parseconfigfile(file)
break
elseif string.find(word, "^\"") then
endword = select(2, string.find(line, "\"[^\"]*\"", offset))
word = string.sub(line, string.find(line, "\"", offset), endword)
word = string.sub(line, string.find(line, "\"", offset)+1, endword-1)
end
table.insert(retval[#retval], word)
offset = endword + 1
......@@ -158,6 +158,7 @@ local function writeentryline(entrystruct, entryline)
deleteoptionandvalue("smtphost")
deletenooption("rewrite")
deleteoption("fetchall")
deleteoption("ssl")
else -- Method not etrn
if not reverseentry["dns"] then
insertentries[table.maxn(insertentries)+1] = "no"
......@@ -173,6 +174,11 @@ local function writeentryline(entrystruct, entryline)
if not reverseentry["fetchall"] then
entryline[table.maxn(entryline)+1] = "fetchall"
end
if entrystruct.value.ssl.value and not reverseentry["ssl"] then
entryline[table.maxn(entryline)+1] = "ssl"
elseif not entrystruct.value.ssl.value and reverseentry["ssl"] then
entryline[reverseentry["ssl"]] = nil
end
end
-- Now, insert the insertentries and remove the nil entries
......@@ -288,9 +294,9 @@ end
function startstop_service(action)
local cmd
if action:lower() == "run" then
cmd = "/usr/bin/fetchmail -d0 -v 2>&1"
cmd = "/usr/bin/fetchmail -d0 -v -f "..configfile.." 2>&1"
elseif action:lower() == "test" then
cmd = "/usr/bin/fetchmail -d0 -v -k 2>&1"
cmd = "/usr/bin/fetchmail -d0 -v -k -f "..configfile.." 2>&1"
else
return modelfunctions.startstop_service(processname, action)
end
......@@ -408,6 +414,7 @@ function readentry(entryname)
local localhost = cfe({ label="Local Host" })
local localmailbox = cfe({ label="Local Mailbox" })
local localdomain = cfe({ label="Local Domain" })
local ssl = cfe({ type="boolean", value=false, label="SSL Encryption" })
local entry = findentryline(entryname)
if entry then
......@@ -426,7 +433,7 @@ function readentry(entryname)
remotemailbox.value = entry[(reverseentry["user"] or reverseentry["username"])+1] or remotemailbox.value
end
if reverseentry["pass"] or reverseentry["password"] then
remotepassword.value = string.sub(entry[(reverseentry["pass"] or reverseentry["password"])+1] or "", 2, -2) or remotepassword.value
remotepassword.value = entry[(reverseentry["pass"] or reverseentry["password"])+1] or remotepassword.value
end
if reverseentry["smtphost"] then
localhost.value = entry[reverseentry["smtphost"]+1] or localhost.value
......@@ -437,9 +444,12 @@ function readentry(entryname)
if reverseentry["fetchdomains"] then
localdomain.value = entry[reverseentry["fetchdomains"]+1] or localdomain.value
end
if reverseentry["ssl"] then
ssl.value = true
end
end
return cfe({ type="group", value={enabled=enabled, method=method, remotehost=remotehost, remotemailbox=remotemailbox, remotepassword=remotepassword, localhost=localhost, localmailbox=localmailbox, localdomain=localdomain}, label="Fetchmail Entry" })
return cfe({ type="group", value={enabled=enabled, method=method, remotehost=remotehost, remotemailbox=remotemailbox, remotepassword=remotepassword, localhost=localhost, localmailbox=localmailbox, localdomain=localdomain, ssl=ssl}, label="Fetchmail Entry" })
end
function updateentry(entrystruct)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment