aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--driver.c28
-rw-r--r--fetchmail.c4
-rw-r--r--fetchmail.h1
-rw-r--r--fetchmail.man16
-rw-r--r--rcfile_l.l1
-rw-r--r--rcfile_y.y5
-rw-r--r--sample.rcfile3
8 files changed, 55 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 059211dd..3423705f 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@
fetchmail 4.0.3 ()
* Replace vsprintf with vnsprintf to avoid buffer-overrun screws.
* Added via option to make ssh configuration cleaner.
+* Added dropstatus option to cope with xbuffy.
* Allow either `login' or `user' in .netrc files.
There are 257 people on the fetchmail-friends list.
diff --git a/driver.c b/driver.c
index 934ddacb..44e2e309 100644
--- a/driver.c
+++ b/driver.c
@@ -598,6 +598,34 @@ char *realname; /* real name of host */
}
/*
+ * If we see a Status line, it may have been inserted by an MUA
+ * on the mail host, or it may have been inserted by the server
+ * program after the headers in the transaction stream. This
+ * can actually hose some new-mail notifiers such as xbuffy,
+ * which assumes any Status line came from a *local* MDA and
+ * therefore indicates that the message has been seen.
+ *
+ * Some buggy POP servers (including at least the 3.3(20)
+ * version of the one distributed with IMAP) insert empty
+ * Status lines in the transaction stream; we'll chuck those
+ * unconditionally. Nonempty ones get chucked if the user
+ * turns on the dropstatus flag.
+ */
+ if (!strncasecmp(line, "Status:", 7))
+ {
+ char *cp;
+
+ for (cp = line + 7; *cp && isspace(*cp); cp++)
+ continue;
+
+ if (!*cp || ctl->dropstatus)
+ {
+ free(line);
+ continue;
+ }
+ }
+
+ /*
* OK, this is messy. If we're forwarding by SMTP, it's the
* SMTP-receiver's job (according to RFC821, page 22, section
* 4.1.1) to generate a Return-Path line on final delivery.
diff --git a/fetchmail.c b/fetchmail.c
index dfd0c300..68e8e4dc 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -602,6 +602,7 @@ static int load_params(int argc, char **argv, int optind)
DEFAULT(ctl->stripcr, (ctl->mda != (char *)NULL));
DEFAULT(ctl->forcecr, FALSE);
DEFAULT(ctl->pass8bits, FALSE);
+ DEFAULT(ctl->dropstatus, FALSE);
DEFAULT(ctl->server.dns, TRUE);
DEFAULT(ctl->server.uidl, FALSE);
#undef DEFAULT
@@ -878,6 +879,9 @@ void dump_params (struct query *ctl)
printf(" Interpretation of Content-Transfer-Encoding is %sabled (pass8bits %s).\n",
ctl->pass8bits ? "dis" : "en",
ctl->pass8bits ? "on" : "off");
+ printf(" Nonempty Status lines will be %s (dropstatus %s)\n",
+ ctl->dropstatus ? "discarded" : "kept",
+ ctl->dropstatus ? "on" : "off");
if (ctl->limit > 0)
printf(" Message size limit is %d bytes (--limit %d).\n",
ctl->limit, ctl->limit);
diff --git a/fetchmail.h b/fetchmail.h
index 24ef5ee0..aa3d6474 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -131,6 +131,7 @@ struct query
flag stripcr; /* if TRUE, strip CRs in text */
flag forcecr; /* if TRUE, force CRs before LFs in text */
flag pass8bits; /* if TRUE, ignore Content-Transfer-Encoding */
+ flag dropstatus; /* if TRUE, drop Status lines in mail */
int limit; /* limit size of retrieved messages */
int fetchlimit; /* max # msgs to get in single poll */
int batchlimit; /* max # msgs to pass in single SMTP session */
diff --git a/fetchmail.man b/fetchmail.man
index 792093fb..1311cfe6 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -686,6 +686,7 @@ Legal user options are
stripcr
forcecr
pass8bits
+ dropstatus
dns
no keep
no flush
@@ -694,6 +695,7 @@ Legal user options are
no stripcr
no forcecr
no pass8bits
+ no dropstatus
no dns
no envelope
limit
@@ -706,9 +708,9 @@ comma-separated list of names following them.
.PP
All options correspond to the obvious command-line arguments, except
the following: `via', `interval', `aka', `is', `to', `dns'/`no dns',
-\&`password', \&`preconnect', `localdomains', `stripcr'/`no stripcr' ,
-\&`forcecr'/`no forcecr', `pass8bits'/`no pass8bits' and `no
-received'.
+\&`password', \&`preconnect', `localdomains', `stripcr'/`no stripcr',
+\&`forcecr'/`no forcecr', `pass8bits'/`no pass8bits' `dropstatus/no
+dropstatus', and `no received'.
.PP
The `via' option is for use with ssh, or if you want to have more
than one configuration pointing at the same site. If it is present,
@@ -819,6 +821,14 @@ is forced to declare BODY=8BITMIME to any ESMTP-capable listener. If
the listener is 8-bit-clean (as all the major ones now are) the right
thing will probably result.
.PP
+The `dropstatus' option controls whether nonempty Status lines are
+retained in fetched mail (the default) or discarded. Retaining them
+allows your MUA to see what messages (if any) were marked seen on the
+client. On the other hand, it can confuse some new-mail notifiers,
+which assume that anything with a Status line in it has been seen.
+(Note: the empty Status lines inserted by some buggy POP servers are
+unconditionally discarded.)
+.PP
Legal protocol identifiers are
auto (or AUTO)
diff --git a/rcfile_l.l b/rcfile_l.l
index fdb6e03d..64e26017 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -67,6 +67,7 @@ rewrite { return REWRITE; }
forcecr { return FORCECR; }
stripcr { return STRIPCR; }
pass8(bits)? { return PASS8BITS; }
+dropstatus? { return DROPSTATUS; }
dns { return DNS; }
uidl { return UIDL; }
diff --git a/rcfile_y.y b/rcfile_y.y
index d9705945..55b5f7b3 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -62,7 +62,7 @@ extern char * yytext;
%token <proto> PROTO
%token <sval> STRING
%token <number> NUMBER
-%token NO KEEP FLUSH FETCHALL REWRITE FORCECR STRIPCR PASS8BITS
+%token NO KEEP FLUSH FETCHALL REWRITE FORCECR STRIPCR PASS8BITS DROPSTATUS
%token DNS PORT UIDL INTERVAL
%%
@@ -227,6 +227,7 @@ user_option : TO localnames HERE
| FORCECR {current.forcecr = FLAG_TRUE;}
| STRIPCR {current.stripcr = FLAG_TRUE;}
| PASS8BITS {current.pass8bits = FLAG_TRUE;}
+ | DROPSTATUS {current.dropstatus = FLAG_TRUE;}
| NO KEEP {current.keep = FLAG_FALSE;}
| NO FLUSH {current.flush = FLAG_FALSE;}
@@ -234,6 +235,8 @@ user_option : TO localnames HERE
| NO REWRITE {current.rewrite = FLAG_FALSE;}
| NO FORCECR {current.forcecr = FLAG_FALSE;}
| NO STRIPCR {current.stripcr = FLAG_FALSE;}
+ | NO PASS8BITS {current.pass8bits = FLAG_FALSE;}
+ | NO DROPSTATUS {current.dropstatus = FLAG_FALSE;}
| LIMIT NUMBER {current.limit = $2;}
| FETCHLIMIT NUMBER {current.fetchlimit = $2;}
diff --git a/sample.rcfile b/sample.rcfile
index fd648fc6..aa1a31b8 100644
--- a/sample.rcfile
+++ b/sample.rcfile
@@ -49,6 +49,7 @@
# forcecr
# stripcr
# pass8bits
+# dropstatus
# dns
# no keep
# no flush
@@ -58,6 +59,8 @@
# no stripcr
# no dns
# no envelope
+# no pass8bits
+# no dropstatus
# limit -- must be followed by numeric size limit
# fetchlimit -- must be followed by numeric msg fetch limit
# batchlimit -- must be followed by numeric SMTP batch limit