aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--driver.c9
-rw-r--r--fetchmail.c6
-rw-r--r--fetchmail.h1
-rw-r--r--fetchmail.man7
-rw-r--r--rcfile_y.y17
6 files changed, 40 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index c324f1f0..5136f85d 100644
--- a/NEWS
+++ b/NEWS
@@ -18,11 +18,12 @@ fetchmail-4.3.1 ()
* Code for parsing Received headers now strips out RFC822 routes.
* Fixed processing of -S/-r arguments so giving a comma-separated list works.
* Don't query for the fetchmail host machine by default in ETRN mode.
+* Added skip prefix clause on `envelope' option
* Added --invisible option. Note: you can now either make fetchmail generate
a Received header (the default) *or* spoof your listener into thinking
fetchmail connected from the mailserver machine, *but not both*.
-There are 271 people on fetchmail-friends and 37 on fetchmail-announce.
+There are 270 people on fetchmail-friends and 37 on fetchmail-announce.
------------------------------------------------------------------------------
fetchmail-4.3.0 (Mon Oct 6 16:44:38 EDT 1997)
diff --git a/driver.c b/driver.c
index 756ab2b1..01014f96 100644
--- a/driver.c
+++ b/driver.c
@@ -543,7 +543,7 @@ int num; /* index of message */
char buf[MSGBUFSIZE+1], return_path[MSGBUFSIZE+1];
int from_offs, ctt_offs, env_offs, next_address;
char *headers, *received_for, *desthost, *rcv;
- int n, linelen, oldlen, ch, remaining;
+ int n, linelen, oldlen, ch, remaining, skipcount;
char *cp;
struct idlist *idp, *xmit_names;
flag good_addresses, bad_addresses, has_nuls;
@@ -562,6 +562,7 @@ int num; /* index of message */
from_offs = ctt_offs = env_offs = -1;
oldlen = 0;
msglen = 0;
+ skipcount = 0;
for (remaining = fetchlen; remaining > 0 || protocol->delimited; remaining -= linelen)
{
@@ -778,11 +779,17 @@ int num; /* index of message */
if (env_offs == -1 && !strncasecmp(ctl->server.envelope,
line,
strlen(ctl->server.envelope)))
+ if (skipcount++ != ctl->server.envskip)
+ continue;
env_offs = (line - headers);
}
#ifdef HAVE_RES_SEARCH
else if (!received_for && !strncasecmp("Received:", line, 9))
+ {
+ if (skipcount++ != ctl->server.envskip)
+ continue;
received_for = parse_received(ctl, line);
+ }
#endif /* HAVE_RES_SEARCH */
}
}
diff --git a/fetchmail.c b/fetchmail.c
index f70d2d71..66c4331a 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -568,6 +568,7 @@ static int load_params(int argc, char **argv, int optind)
save_str(&def_opts.smtphunt, FALSE, fetchmailhost);
save_str(&def_opts.smtphunt, FALSE, "localhost");
def_opts.expunge = 1;
+ def_opts.server.envskip = 0;
/* this builds the host list */
if (prc_parse_file(rcfile, !versioninfo) != 0)
@@ -1044,8 +1045,13 @@ void dump_params (struct query *ctl)
if (ctl->server.envelope == STRING_DISABLED)
printf(" Envelope-address routing is disabled\n");
else
+ {
printf(" Envelope header is assumed to be: %s\n",
ctl->server.envelope ? ctl->server.envelope:"Received");
+ if (ctl->server.envskip > 1 || outlevel >= O_VERBOSE)
+ printf(" Number of envelope header to be parsed: %d\n",
+ ctl->server.envskip);
+ }
if (ctl->server.akalist)
{
diff --git a/fetchmail.h b/fetchmail.h
index 4d35dded..c7e5795e 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -90,6 +90,7 @@ struct hostdata /* shared among all user connections to given server */
int preauthenticate; /* preauthentication mode to try */
int timeout; /* inactivity timout in seconds */
char *envelope; /* envelope address list header */
+ int envskip; /* skip to numbered envelope header */
char *qvirtual; /* prefix removed from local user id */
flag skip; /* suppress poll in implicit mode? */
flag dns; /* do DNS lookup on multidrop? */
diff --git a/fetchmail.man b/fetchmail.man
index bcd349e2..e1c5cbe7 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -899,6 +899,13 @@ T}
.TE
.PP
Remember that all user options must \fIfollow\fR all server options.
+.PP
+In the .fetchmailrc file, the `envelope' string argument may be
+preceded by a whitespace-separated number. This number, if specified,
+is the number of such headers to skip (that is, an argument of 1
+selects the second header of the given type). This is sometime useful
+for ignoring bogus Received headers created by an ISP's local delivery
+agent.
.SS Keywords Not Corresponding To Option Switches
.PP
The `folder' and `smtphost' options (unlike their command-line
diff --git a/rcfile_y.y b/rcfile_y.y
index 213caae5..13eb3d0d 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -133,7 +133,20 @@ serv_option : AKA alias_list
| AUTHENTICATE PASSWORD {current.server.preauthenticate = A_PASSWORD;}
| AUTHENTICATE KERBEROS4 {current.server.preauthenticate = A_KERBEROS_V4;}
| TIMEOUT NUMBER {current.server.timeout = $2;}
- | ENVELOPE STRING {current.server.envelope = xstrdup($2);}
+
+ | ENVELOPE NUMBER STRING
+ {
+ current.server.envelope =
+ xstrdup($3);
+ current.server.envskip = $2;
+ }
+ | ENVELOPE STRING
+ {
+ current.server.envelope =
+ xstrdup($2);
+ current.server.envskip = 0;
+ }
+
| QVIRTUAL STRING {current.server.qvirtual = xstrdup($2);}
| INTERFACE STRING {
#ifdef linux
@@ -401,6 +414,7 @@ static void record_current(void)
FLAG_FORCE(server.preauthenticate);
FLAG_FORCE(server.timeout);
FLAG_FORCE(server.envelope);
+ FLAG_FORCE(server.envskip);
FLAG_FORCE(server.qvirtual);
FLAG_FORCE(server.skip);
FLAG_FORCE(server.dns);
@@ -458,6 +472,7 @@ void optmerge(struct query *h2, struct query *h1)
FLAG_MERGE(server.preauthenticate);
FLAG_MERGE(server.timeout);
FLAG_MERGE(server.envelope);
+ FLAG_MERGE(server.envskip);
FLAG_MERGE(server.qvirtual);
FLAG_MERGE(server.skip);
FLAG_MERGE(server.dns);