diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | driver.c | 20 | ||||
-rw-r--r-- | fetchmail.c | 2 | ||||
-rw-r--r-- | fetchmail.h | 3 | ||||
-rw-r--r-- | fetchmail.man | 10 | ||||
-rw-r--r-- | options.c | 58 | ||||
-rw-r--r-- | rcfile_l.l | 1 | ||||
-rw-r--r-- | rcfile_y.y | 4 | ||||
-rw-r--r-- | sample.rcfile | 1 |
9 files changed, 63 insertions, 37 deletions
@@ -15,6 +15,7 @@ fetchmail-4.3.1 () * Minor portation fixes for early AIX version and NextSTEP. * Fixed a bad interaction between --limit and the repoll feature. * = is now optional in global options. +* Added --invisible option. There are 276 people on fetchmail-friends and 20 on fetchmail-announce. @@ -394,9 +394,10 @@ static int smtp_open(struct query *ctl) { /* * RFC 1123 requires that the domain name in HELO address is a - * "valid principal domain name" for the client host. We - * violate this with malice aforethought in order to make the - * Received headers and logging look right. + * "valid principal domain name" for the client host. If we're + * running in invisible mode, violate this with malice + * aforethought in order to make the Received headers and + * logging look right. * * In fact this code relies on the RFC1123 requirement that the * SMTP listener must accept messages even if verification of the @@ -410,6 +411,7 @@ static int smtp_open(struct query *ctl) * What it will affect is the listener's logging. */ struct idlist *idp; + char *id_me = use_invisible ? ctl->server.truename : fetchmailhost; errno = 0; @@ -422,8 +424,7 @@ static int smtp_open(struct query *ctl) continue; if (SMTP_ok(ctl->smtp_socket) == SM_OK && - SMTP_ehlo(ctl->smtp_socket, - ctl->server.truename, + SMTP_ehlo(ctl->smtp_socket, id_me, &ctl->server.esmtp_options) == SM_OK) break; /* success */ @@ -439,7 +440,7 @@ static int smtp_open(struct query *ctl) continue; if (SMTP_ok(ctl->smtp_socket) == SM_OK && - SMTP_helo(ctl->smtp_socket, ctl->server.truename) == SM_OK) + SMTP_helo(ctl->smtp_socket, id_me) == SM_OK) break; /* success */ close(ctl->smtp_socket); @@ -1138,7 +1139,7 @@ int num; /* index of message */ n = stuffline(ctl, headers); *rcv = 'R'; } - if (n != -1) + if (!use_invisible && n != -1) { /* utter any per-message Received information we need here */ sprintf(buf, "Received: from %s\n", ctl->server.truename); @@ -1177,12 +1178,13 @@ int num; /* index of message */ time(&now); strcat(buf, ctime(&now)); n = stuffline(ctl, buf); - if (n != -1) - n = stuffline(ctl, rcv); /* ship out rest of headers */ } } } + if (n != -1) + n = stuffline(ctl, rcv); /* ship out rest of headers */ + if (n == -1) { error(0, errno, "writing RFC822 headers"); diff --git a/fetchmail.c b/fetchmail.c index 73a1cb3f..4e346a77 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -170,6 +170,8 @@ int main (int argc, char **argv) if (use_syslog) printf("Progress messages will be logged via syslog\n"); #endif + if (use_invisible) + printf("Fetchmail will masquerade and will not generate Received\n"); for (ctl = querylist; ctl; ctl = ctl->next) { if (ctl->active && !(implicitmode && ctl->server.skip)) dump_params(ctl); diff --git a/fetchmail.h b/fetchmail.h index 89891d54..4d35dded 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -203,7 +203,8 @@ extern int yydebug; /* enable parse debugging */ extern int poll_interval; /* poll interval in seconds */ extern flag nodetach; /* if TRUE, don't detach daemon process */ extern char *logfile; /* log file for daemon mode */ -extern flag use_syslog; /* if --syslog was set */ +extern flag use_syslog; /* if syslog was set */ +extern flag use_invisible; /* if invisible was set */ extern flag quitmode; /* if --quit was set */ extern flag check_only; /* if --check was set */ extern char *cmd_logfile; /* if --logfile was set */ diff --git a/fetchmail.man b/fetchmail.man index 638f7f02..f044017c 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -572,6 +572,16 @@ or option was used. .PP The +.B --invisible +option tries to make fetchmail invisible. Normally, fetchmail behaves +like any other MTA would -- it generates a Received header into each +message describing its place in the chain of transmission, and tells +the MTA it forwards to that the mail came from the machine fetchmail +itself is running on. If the invisible option is on, the Received +header is suppressed and fetchmail tries to spoof the MTA it forwards +to into thinking it came directly from the mailserver host. +.PP +The .B \-N or --nodetach option suppresses backgrounding and detachment of the daemon process from its control terminal. This is primarily useful @@ -25,32 +25,33 @@ #define LA_NODETACH 7 #define LA_QUIT 8 #define LA_LOGFILE 9 -#define LA_SYSLOG 10 -#define LA_RCFILE 11 -#define LA_IDFILE 12 -#define LA_PROTOCOL 13 -#define LA_UIDL 14 -#define LA_PORT 15 -#define LA_AUTHENTICATE 16 -#define LA_TIMEOUT 17 -#define LA_ENVELOPE 18 -#define LA_USERNAME 19 -#define LA_ALL 20 -#define LA_NOKEEP 21 -#define LA_KEEP 22 -#define LA_FLUSH 23 -#define LA_NOREWRITE 24 -#define LA_LIMIT 25 -#define LA_FOLDER 26 -#define LA_SMTPHOST 27 -#define LA_BATCHLIMIT 28 -#define LA_FETCHLIMIT 29 -#define LA_EXPUNGE 30 -#define LA_MDA 31 -#define LA_INTERFACE 32 -#define LA_MONITOR 33 -#define LA_YYDEBUG 34 -#define LA_QVIRTUAL 35 +#define LA_INVISIBLE 10 +#define LA_SYSLOG 11 +#define LA_RCFILE 12 +#define LA_IDFILE 13 +#define LA_PROTOCOL 14 +#define LA_UIDL 15 +#define LA_PORT 16 +#define LA_AUTHENTICATE 17 +#define LA_TIMEOUT 18 +#define LA_ENVELOPE 19 +#define LA_USERNAME 20 +#define LA_ALL 21 +#define LA_NOKEEP 22 +#define LA_KEEP 23 +#define LA_FLUSH 24 +#define LA_NOREWRITE 25 +#define LA_LIMIT 26 +#define LA_FOLDER 27 +#define LA_SMTPHOST 28 +#define LA_BATCHLIMIT 29 +#define LA_FETCHLIMIT 30 +#define LA_EXPUNGE 31 +#define LA_MDA 32 +#define LA_INTERFACE 33 +#define LA_MONITOR 34 +#define LA_YYDEBUG 35 +#define LA_QVIRTUAL 36 /* options still left: CDgGhHjJoORTUwWxXYzZ */ static const char *shortoptions = @@ -67,6 +68,7 @@ static const struct option longoptions[] = { {"nodetach", no_argument, (int *) 0, LA_NODETACH }, {"quit", no_argument, (int *) 0, LA_QUIT }, {"logfile", required_argument, (int *) 0, LA_LOGFILE }, + {"invisible", no_argument, (int *) 0, LA_INVISIBLE }, {"syslog", no_argument, (int *) 0, LA_SYSLOG }, {"fetchmailrc",required_argument,(int *) 0, LA_RCFILE }, {"idfile", required_argument, (int *) 0, LA_IDFILE }, @@ -169,6 +171,9 @@ struct query *ctl; /* option record to be initialized */ case LA_LOGFILE: cmd_logfile = optarg; break; + case LA_INVISIBLE: + use_invisible = TRUE; + break; case 'f': case LA_RCFILE: rcfile = (char *) xmalloc(strlen(optarg)+1); @@ -360,6 +365,7 @@ struct query *ctl; /* option record to be initialized */ fputs(" -q, --quit kill daemon process\n", stderr); fputs(" -L, --logfile specify logfile name\n", stderr); fputs(" --syslog use syslog(3) for most messages when running as a daemon\n", stderr); + fputs(" --invisible suppress Received line & enable host spoofing\n", stderr); fputs(" -f, --fetchmailrc specify alternate run control file\n", stderr); fputs(" -i, --idfile specify alternate UIDs file\n", stderr); #ifdef linux @@ -24,6 +24,7 @@ set { return SET; } logfile { return LOGFILE; } daemon { return DAEMON; } syslog { return SYSLOG; } +invisible { return INVISIBLE; } defaults { return DEFAULTS; } server { return POLL; } @@ -30,6 +30,7 @@ struct query cmd_opts; /* where to put command-line info */ int poll_interval; /* poll interval in seconds */ char *logfile; /* log file for daemon mode */ flag use_syslog; /* if syslog was set */ +flag use_invisible; /* if invisible was set */ struct query *querylist; /* head of server list (globally visible) */ int yydebug; /* in case we didn't generate with -- debug */ @@ -60,7 +61,7 @@ extern char * yytext; %token PRECONNECT POSTCONNECT LIMIT %token IS HERE THERE TO MAP WILDCARD %token BATCHLIMIT FETCHLIMIT EXPUNGE -%token SET LOGFILE DAEMON SYSLOG INTERFACE MONITOR +%token SET LOGFILE DAEMON SYSLOG INVISIBLE INTERFACE MONITOR %token <proto> PROTO %token <sval> STRING %token <number> NUMBER @@ -83,6 +84,7 @@ optmap : MAP | /* EMPTY */; statement : SET LOGFILE optmap STRING {logfile = xstrdup($4);} | SET DAEMON optmap NUMBER {poll_interval = $4;} | SET SYSLOG {use_syslog = TRUE;} + | SET INVISIBLE {use_invisible = TRUE;} /* * The way the next two productions are written depends on the fact that diff --git a/sample.rcfile b/sample.rcfile index 191a9446..2250b4d6 100644 --- a/sample.rcfile +++ b/sample.rcfile @@ -88,6 +88,7 @@ # set logfile = -- must be followed by a string # set daemon -- must be followed by a number # set syslog +# set invisible # # The noise keywords `and', `with', `has', `wants', and `options' are ignored # anywhere in an entry; they can be used to make it resemble English. The |