summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-09-01 14:18:35 +0000
committerTed Trask <ttrask01@yahoo.com>2008-09-01 14:18:35 +0000
commitc2a2a5a5958946825588a46b408a5c82508825e0 (patch)
tree56b049b5d7803f707b360a62e06c5c83a50aed00
parentc86a24ab61ae44afb7c2a134f59bef15046fe7bf (diff)
downloadacf-fetchmail-c2a2a5a5958946825588a46b408a5c82508825e0.tar.bz2
acf-fetchmail-c2a2a5a5958946825588a46b408a5c82508825e0.tar.xz
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
-rw-r--r--fetchmail-editentry-html.lsp2
-rw-r--r--fetchmail-model.lua20
2 files changed, 16 insertions, 6 deletions
diff --git a/fetchmail-editentry-html.lsp b/fetchmail-editentry-html.lsp
index 410b3ef..8917bc1 100644
--- a/fetchmail-editentry-html.lsp
+++ b/fetchmail-editentry-html.lsp
@@ -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)
%>
diff --git a/fetchmail-model.lua b/fetchmail-model.lua
index 3f39ae8..8aa114f 100644
--- a/fetchmail-model.lua
+++ b/fetchmail-model.lua
@@ -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)