diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | conf.c | 1 | ||||
-rw-r--r-- | driver.c | 13 | ||||
-rw-r--r-- | fetchmail-features.html | 7 | ||||
-rw-r--r-- | fetchmail.c | 6 | ||||
-rw-r--r-- | fetchmail.h | 1 | ||||
-rw-r--r-- | fetchmail.man | 26 | ||||
-rwxr-xr-x | fetchmailconf | 9 | ||||
-rw-r--r-- | options.c | 9 | ||||
-rw-r--r-- | rcfile_l.l | 1 | ||||
-rw-r--r-- | rcfile_y.y | 3 |
11 files changed, 68 insertions, 9 deletions
@@ -3,6 +3,7 @@ (The `lines' figures total .c, .h, .l, and .y files under version control.) * Reject candidate headers for the MAIL FROM address that have \n in them. +* Add capability to insert poll trace data in the Received line. fetchmail-5.8.5 (Tue May 29 20:01:39 EDT 2001), 20650 lines: @@ -384,6 +384,7 @@ void dump_config(struct runctl *runp, struct query *querylist) listdump("smtphunt", ctl->smtphunt); stringdump("smtpaddress", ctl->smtpaddress); stringdump("smtpname", ctl->smtpname); + booldump("tracepolls", ctl->tracepolls); indent('\0'); fprintf(stdout, "'antispam':'"); @@ -1067,15 +1067,18 @@ static int readheaders(int sock, /* * This header is technically invalid under RFC822. * POP3, IMAP, etc. are not legal mail-parameter values. - * - * We used to include ctl->remotename in this log line, - * but this can be secure information that would be bad - * to reveal. */ - sprintf(buf, "\tby %s with %s (fetchmail-%s)\r\n", + sprintf(buf, "\tby %s with %s (fetchmail-%s)", fetchmailhost, protocol->name, VERSION); + if (ctl->tracepolls) + { + sprintf(buf + strlen(buf), " polling %s account %s", + ctl->server.pollname, + ctl->remotename); + } + strcat(buf, "\r\n"); n = stuffline(ctl, buf); if (n != -1) { diff --git a/fetchmail-features.html b/fetchmail-features.html index f75a0530..75c07875 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: 2001/05/14 16:13:22 $ +<td width="30%" align=right>$Date: 2001/06/05 06:57:54 $ </table> <HR> @@ -18,6 +18,9 @@ <H2>Since 5.0:</H2> <UL> +<LI>Has the capability of adding trace information to the Received header to +faciliate mail filtering by mailserver and remote account. + <LI>Fetchmail now has options to handle SSL certificate validation. <LI>Fetchmail now falls back to delivering via local MDA if it can't @@ -245,7 +248,7 @@ get-mail, gwpop, pimp-1.0, pop-perl5-1.2, popc, popmail-1.6 and upop. <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: 2001/05/14 16:13:22 $ +<td width="30%" align=right>$Date: 2001/06/05 06:57:54 $ </table> <P><ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com"><esr@snark.thyrsus.com></A></ADDRESS> diff --git a/fetchmail.c b/fetchmail.c index c2a2880e..3d145499 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -849,6 +849,7 @@ static void optmerge(struct query *h2, struct query *h1, int force) #endif FLAG_MERGE(expunge); + FLAG_MERGE(tracepolls); FLAG_MERGE(properties); #undef FLAG_MERGE } @@ -1817,6 +1818,11 @@ static void dump_params (struct runctl *runp, } } + if (ctl->tracepolls) + printf(_(" Poll trace information will be added to the Received header.\n")); + else if (outlevel >= O_VERBOSE) + printf(_(" No poll trace information will be added to the Received header.\n.\n")); + if (ctl->properties) printf(_(" Pass-through properties \"%s\".\n"), visbuf(ctl->properties)); diff --git a/fetchmail.h b/fetchmail.h index 29aa7015..f6e397ba 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -291,6 +291,7 @@ struct query flag sslcertck; /* Strictly check the server cert. */ char *sslfingerprint; /* Fingerprint to check against */ char *properties; /* passthrough properties for extensions */ + flag tracepolls; /* if TRUE, add poll trace info to Received */ /* internal use -- per-poll state */ flag active; /* should we actually poll this server? */ diff --git a/fetchmail.man b/fetchmail.man index 037cd35f..075907d3 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -268,6 +268,15 @@ comma-separated list of folders) to be retrieved. The syntax of the folder name is server-dependent. This option is not available under POP3, ETRN, or ODMR. .TP +.B \--tracepolls +(Keyword: tracepolls) +Tell fetchail to poll trace information in the form `polling %s +account %s' to the Received line it generates, where the %s parts are +replaced by the user's remote name and the poll label (the Received +header also normally inclodes the server's truename). This can be +used to facilate mail filtering based on the account it is being +received from. +.TP .B \--ssl (Keyword: ssl) Causes the connection to the mail server to be encrypted via SSL. Connect @@ -965,6 +974,20 @@ option (keyword: set showdots) forces fetchmail to show progress dots even if the current tty is not stdout (for example logfiles). Starting with fetchmail version 5.3.0, progress dots are only shown on stdout by default. +.PP +By specifying the +.B --tracepolls +option, you can ask fetchmail to add information to the Received +header on the form "polling {label} account {user}", where {label} is +the account label (from the specified rcfile, normally ~/.fetchmailrc) +and {user} is the username which is used to log on to the mail +server. This header can be used to make filtering email where no +useful header information is available and you want mail from +different accounts sorted into different mailboxes (this could, for +example, occur if you have an account on the same server running a +mailing list, and are subscribed to the list using that account). The +default is not adding any such header. In +.fetchmailrc, this is called `tracepolls'. .SH RETRIEVAL FAILURE MODES The protocols \fIfetchmail\fR uses to talk to mailservers are next to @@ -1411,6 +1434,9 @@ T} expunge -e T{ Perform an expunge on every #th message (IMAP and POP3 only) T} +tracepolls \& T{ +Add poll tracing information to the Received header +T} properties \& T{ String value is ignored by fetchmail (may be used by extension scripts) T} diff --git a/fetchmailconf b/fetchmailconf index ab4aa9de..e9924127 100755 --- a/fetchmailconf +++ b/fetchmailconf @@ -4,7 +4,7 @@ # by Eric S. Raymond, <esr@snark.thyrsus.com>. # Requires Python with Tkinter, and the following OS-dependent services: # posix, posixpath, socket -version = "1.35" +version = "1.36" from Tkinter import * from Dialog import * @@ -94,6 +94,7 @@ class Server: self.plugout = None # Plugin command for going to listener self.netsec = None # IPV6 security options self.principal = None # Kerberos principal + self.tracepolls = FALSE # Add X-Fetchmail-Account header? self.users = [] # List of user entries for site Server.typemap = ( ('pollname', 'String'), @@ -116,7 +117,8 @@ class Server: ('plugin', 'String'), ('plugout', 'String'), ('netsec', 'String'), - ('principal','String')) + ('principal','String'), + ('tracepolls','String')) def dump(self, folded): res = "" @@ -166,6 +168,9 @@ class Server: else: res = res + " " + if self.tracepolls: + res = res + "tracepolls\n" + if self.interface: res = res + "interface " + str(self.interface) if self.monitor: @@ -85,6 +85,8 @@ #define LA_SHOWDOTS 57 #define LA_PRINCIPAL 58 +#define LA_TRACEPOLLS 59 + /* options still left: CDgGhHjJoORwWxXYz */ static const char *shortoptions = "?Vcsvd:NqL:f:i:p:UP:A:t:E:Q:u:akKFnl:r:S:Z:b:B:e:m:T:I:M:yw:"; @@ -169,6 +171,8 @@ static const struct option longoptions[] = { {"yydebug", no_argument, (int *) 0, LA_YYDEBUG }, + {"tracepolls",no_argument, (int *) 0, LA_TRACEPOLLS }, + {(char *) 0, no_argument, (int *) 0, 0 } }; @@ -615,6 +619,10 @@ struct query *ctl; /* option record to be initialized */ rctl->use_syslog = FLAG_FALSE; break; + case LA_TRACEPOLLS: + ctl->tracepolls = FLAG_TRUE; + break; + case '?': case LA_HELP: default: @@ -664,6 +672,7 @@ struct query *ctl; /* option record to be initialized */ P(_(" -E, --envelope envelope address header\n")); P(_(" -Q, --qvirtual prefix to remove from local user id\n")); P(_(" --principal mail service principal\n")); + P(_(" --addaccthdr add an X-Fetchmail-Account header (\"label <user@host>\")\n")); P(_(" -u, --username specify users's login on server\n")); P(_(" -a, --all retrieve old and new messages\n")); @@ -70,6 +70,7 @@ postmaster { return POSTMASTER; } bouncemail { return BOUNCEMAIL; } spambounce { return SPAMBOUNCE; } warnings { return WARNINGS; } +tracepolls { return TRACEPOLLS; } defaults { return DEFAULTS; } server { return POLL; } @@ -75,6 +75,7 @@ extern char * yytext; %token DNS SERVICE PORT UIDL INTERVAL MIMEDECODE IDLE CHECKALIAS %token SSL SSLKEY SSLCERT SSLPROTO SSLCERTCK SSLCERTPATH SSLFINGERPRINT %token PRINCIPAL +%token TRACEPOLLS %% @@ -234,6 +235,8 @@ serv_option : AKA alias_list | DNS {current.server.dns = FLAG_TRUE;} | NO DNS {current.server.dns = FLAG_FALSE;} | NO ENVELOPE {current.server.envelope = STRING_DISABLED;} + | TRACEPOLLS {current.tracepolls = FLAG_TRUE;} + | NO TRACEPOLLS {current.tracepolls = FLAG_FALSE;} ; userspecs : user1opts {record_current(); user_reset();} |