aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2000-08-06 09:01:43 +0000
committerEric S. Raymond <esr@thyrsus.com>2000-08-06 09:01:43 +0000
commiteded3bba62428f6cc098c3bd8658d32aee3e2c58 (patch)
tree7f19d576bb20e4ad49b09d65833cefa1726ee3c5
parentba5207121664860a31125c9552ece6a8ffb51e54 (diff)
downloadfetchmail-eded3bba62428f6cc098c3bd8658d32aee3e2c58.tar.gz
fetchmail-eded3bba62428f6cc098c3bd8658d32aee3e2c58.tar.bz2
fetchmail-eded3bba62428f6cc098c3bd8658d32aee3e2c58.zip
David Taylor's fixes for the UIDL code.
svn path=/trunk/; revision=2943
-rw-r--r--NEWS3
-rw-r--r--driver.c3
-rw-r--r--fetchmail-features.html8
-rw-r--r--fetchmail.c3
-rw-r--r--fetchmail.man20
-rw-r--r--socket.c49
-rw-r--r--uid.c6
7 files changed, 79 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index fa3c62fc..bc88f165 100644
--- a/NEWS
+++ b/NEWS
@@ -2,11 +2,14 @@
(The `lines' figures total .c, .h, .l, and .y files under version control.)
+* Dave Zarzycki's patch to enhance plugins, adding %h and %p.
* Vitezslav Samel's patch to fix a Y2K bug in lsmgen.sh.
* Fixed a fatal typo in fetchmailconf.
* Resolved Debian bug #67559. It was a misdiagnosis.
* Resolved Debian bugs #62115, #61983.
* Return PS_NOMAIL when no server entries are active.
+* pt_BR Update from George Godoy.
+* David Taylor's fixes for the UIDL code.
fetchmail-5.4.4 (Sun Jul 23 15:56:16 EDT 2000), 19172 lines:
diff --git a/driver.c b/driver.c
index c0301cdd..5828b184 100644
--- a/driver.c
+++ b/driver.c
@@ -2201,7 +2201,8 @@ const int maxfetch; /* maximum number of messages to fetch */
struct idlist *sdp;
for (sdp = ctl->newsaved; sdp; sdp = sdp->next)
- if (sdp->val.status.num == num)
+ if ((sdp->val.status.num == num)
+ && (!toolarge || oldmsg))
sdp->val.status.mark = UID_SEEN;
}
diff --git a/fetchmail-features.html b/fetchmail-features.html
index 563596d7..6bc065d4 100644
--- a/fetchmail-features.html
+++ b/fetchmail-features.html
@@ -10,7 +10,7 @@
<table width="100%" cellpadding=0><tr>
<td width="30%">Back to <a href="index.html">Fetchmail Home Page</a>
<td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a>
-<td width="30%" align=right>$Date: 2000/07/23 13:21:22 $
+<td width="30%" align=right>$Date: 2000/08/06 09:01:42 $
</table>
<HR>
@@ -19,6 +19,10 @@
<H2>Since 5.0:</H2>
<UL>
<LI>
+The plugin facility has been enhanced; %h and %p options are now
+available to pass in the hostname and service port number.
+
+<LI>
Added a dropdelivered option to discard Delivered-To headers. This
addresses a problem with using fetchmail and postfix as a relay inside
a domain; when postfix sees incoming messages with delivered-to
@@ -228,7 +232,7 @@ get-mail, gwpop, pimp-1.0, pop-perl5-1.2, popc, popmail-1.6 and upop.<P>
<table width="100%" cellpadding=0><tr>
<td width="30%">Back to <a href="index.html">Fetchmail Home Page</a>
<td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a>
-<td width="30%" align=right>$Date: 2000/07/23 13:21:22 $
+<td width="30%" align=right>$Date: 2000/08/06 09:01:42 $
</table>
<P><ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com">&lt;esr@snark.thyrsus.com&gt;</A></ADDRESS>
diff --git a/fetchmail.c b/fetchmail.c
index 970e1ac1..6c392f4a 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -653,7 +653,8 @@ int main(int argc, char **argv)
#ifdef POP3_ENABLE
/* leave the UIDL state alone if there have been any errors */
- if (!check_only && !querystatus)
+ if (!check_only &&
+ ((querystatus==PS_SUCCESS) || (querystatus==PS_NOMAIL)))
uid_swap_lists(ctl);
#endif /* POP3_ENABLE */
diff --git a/fetchmail.man b/fetchmail.man
index 55296cc7..730b89a1 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -238,11 +238,11 @@ the calkling user will be notified by email if this happens.
.B \--plugin <command>
(Keyword: plugin)
The plugin option allows you to use an external program to establish the
-TCP connection. This is useful if you want to use socks or need some
-special firewalling setup. The program will be looked up in $PATH and
-it will be passed two arguments: the name of the server and the name of
-the port. Fetchmail will write to the plugin's stdin and read from
-the plugin's stdout.
+TCP connection. This is useful if you want to use socks, SSL, ssh, or
+need some special firewalling setup. The program will be looked up in
+$PATH and can optionally be passed the hostname and port as arguments
+using "%h" and "%p" respectively. Fetchmail will write to the plugin's
+stdin and read from the plugin's stdout.
.TP
.B \--plugout <command>
(Keyword: plugout)
@@ -1712,6 +1712,16 @@ poll mailhost.net via localhost port 1234 with proto pop3:
mailhost.net sleep 20 </dev/null >/dev/null";
.fi
+.PP
+Here's an another example configuration using ssh and the plugin option.
+The queries are made directly on the stdin and stdout of imapd via ssh.
+Note that in this setup, IMAP authentication can be skipped.
+
+.nf
+poll mailhost.net with proto imap and preauth ssh:
+ plugin "ssh %h /usr/sbin/imapd";
+.fi
+
.SH THE USE AND ABUSE OF MULTIDROP MAILBOXES
Use the multiple-local-recipients feature with caution -- it can bite.
Also note that all multidrop features are ineffective in ETRN mode.
diff --git a/socket.c b/socket.c
index 1d9dbef8..50533c33 100644
--- a/socket.c
+++ b/socket.c
@@ -70,11 +70,55 @@ static int h_errno;
#endif /* NET_SECURITY */
#ifdef HAVE_SOCKETPAIR
+const char **parse_plugin(const char *plugin, const char *host, const char *service)
+{ const char **argvec;
+ char *c, *p, *plugin_copy;
+ unsigned int s = 2 * sizeof(char*), i;
+
+ plugin_copy = strdup(plugin);
+ if (!plugin_copy)
+ {
+ report(stderr, _("fetchmail: malloc failed\n"));
+ return NULL;
+ }
+ for (c = p = plugin_copy; *c; c++)
+ { if (isspace(*c) && !isspace(*p))
+ s += sizeof(char*);
+ p = c;
+ }
+ argvec = malloc(s);
+ if (!argvec)
+ {
+ report(stderr, _("fetchmail: malloc failed\n"));
+ return NULL;
+ }
+ memset(argvec, 0, s);
+ for (c = p = plugin_copy, i = 0; *c; c++)
+ { if ((!isspace(*c)) && (c == p ? 1 : isspace(*p))) {
+ argvec[i] = c;
+ i++;
+ }
+ p = c;
+ }
+ for (c = plugin_copy; *c; c++)
+ { if (isspace(*c))
+ *c = 0;
+ }
+ for (i = 0; argvec[i]; i++)
+ { if (strcmp(argvec[i], "%h") == 0)
+ argvec[i] = host;
+ if (strcmp(argvec[i], "%p") == 0)
+ argvec[i] = service;
+ }
+ return argvec;
+}
+
static int handle_plugin(const char *host,
const char *service, const char *plugin)
/* get a socket mediated through a given external command */
{
int fds[2];
+ const char **argvec;
if (socketpair(AF_UNIX,SOCK_STREAM,0,fds))
{
report(stderr, _("fetchmail: socketpair failed\n"));
@@ -98,8 +142,9 @@ static int handle_plugin(const char *host,
(void) close(fds[0]);
if (outlevel >= O_VERBOSE)
report(stderr, _("running %s %s %s\n"), plugin, host, service);
- execlp(plugin,plugin,host,service,0);
- report(stderr, _("execl(%s) failed\n"), plugin);
+ argvec = parse_plugin(plugin,host,service);
+ execvp(*argvec, argvec);
+ report(stderr, _("execvp(%s) failed\n"), *argvec);
exit(0);
break;
default: /* parent */
diff --git a/uid.c b/uid.c
index 12405519..33e01293 100644
--- a/uid.c
+++ b/uid.c
@@ -470,8 +470,10 @@ void write_saved_lists(struct query *hostlist, const char *idfile)
/* if all lists are empty, nuke the file */
idcount = 0;
for (ctl = hostlist; ctl; ctl = ctl->next) {
- if (ctl->oldsaved)
- idcount++;
+ for (idp = ctl->oldsaved; idp; idp = idp->next)
+ if (idp->val.status.mark == UID_SEEN
+ || idp->val.status.mark == UID_DELETED)
+ idcount++;
}
/* either nuke the file or write updated last-seen IDs */