aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-01-18 06:40:25 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-01-18 06:40:25 +0000
commit624b6bec3377d25849725c867d63bf7d98a7aa48 (patch)
treee56daa8947de3b7cd81324f61efbe05f76d84f81
parent194f6a69e8db6392c1c16e228e954312a1b9f347 (diff)
downloadfetchmail-624b6bec3377d25849725c867d63bf7d98a7aa48.tar.gz
fetchmail-624b6bec3377d25849725c867d63bf7d98a7aa48.tar.bz2
fetchmail-624b6bec3377d25849725c867d63bf7d98a7aa48.zip
Added dns/nodns.
svn path=/trunk/; revision=785
-rw-r--r--NEWS6
-rw-r--r--driver.c4
-rw-r--r--fetchmail.c16
-rw-r--r--fetchmail.h3
-rw-r--r--fetchmail.man72
-rw-r--r--options.c2
-rw-r--r--rcfile_l.l22
-rw-r--r--rcfile_y.y22
-rw-r--r--sample.rcfile10
9 files changed, 105 insertions, 52 deletions
diff --git a/NEWS b/NEWS
index e6f8963c..bdbd6906 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,12 @@ features --
* RFC822 header continuation for long address lists is is now handled properly.
+* There is now a `nodns' option to suppress DNS checking of address hostname
+ parts in multidrop mode (make sure your aka list is complete before you use
+ this!).
+
+* Options such as `nokeep' can now be written `no keep'.
+
Note: The first two changes mean that older .fetchmailrc files using
the `set' syntax for these options will cause fetchmail to die with a
parse error at initialization time. Conversion is trivial -- for
diff --git a/driver.c b/driver.c
index 4f934c38..910bf9fe 100644
--- a/driver.c
+++ b/driver.c
@@ -115,6 +115,8 @@ static int is_host_alias(const char *name, struct query *ctl)
return(TRUE);
else if (strcmp(name, ctl->server.canonical_name) == 0)
return(TRUE);
+ else if (ctl->server.no_dns)
+ return(FALSE);
/*
* We know DNS service was up at the beginning of this poll cycle.
@@ -423,7 +425,7 @@ char *realname; /* real name of host */
if (inheaders)
{
- if (!ctl->norewrite)
+ if (!ctl->no_rewrite)
reply_hack(bufp, realname);
if (!headers)
diff --git a/fetchmail.c b/fetchmail.c
index b621c056..c60c77ae 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -807,8 +807,8 @@ void dump_params (struct query *ctl)
ctl->flush ? "" : " not",
ctl->flush ? "on" : "off");
printf(" Rewrite of server-local addresses is %sabled (--norewrite %s).\n",
- ctl->norewrite ? "dis" : "en",
- ctl->norewrite ? "on" : "off");
+ ctl->no_rewrite ? "dis" : "en",
+ ctl->no_rewrite ? "on" : "off");
if (ctl->limit)
printf(" Message size limit is %d bytes (--limit %d).\n",
ctl->limit, ctl->limit);
@@ -855,18 +855,22 @@ void dump_params (struct query *ctl)
fputs("*\n", stdout);
}
+ printf(" DNS lookup for multidrop addresses is %sabled.\n",
+ ctl->server.no_dns ? "dis" : "en",
+ ctl->server.no_dns ? "on" : "off");
+
if (count > 1)
printf(" Envelope header is assumed to be: %s\n", ctl->server.envelope);
}
#ifdef linux
if (ctl->server.interface)
- printf("TCP/IP interface requirements for %s.\n", ctl->server.interface);
+ printf(" Connection must be through interface %s.\n", ctl->server.interface);
else if (outlevel == O_VERBOSE)
- printf("No TCP/IP interface requirements specified.\n");
+ printf(" No interface requirement specified.\n");
if (ctl->server.monitor)
- printf("Polling loop will monitor %s.\n", ctl->server.monitor);
+ printf(" Polling loop will monitor %s.\n", ctl->server.monitor);
else if (outlevel == O_VERBOSE)
- printf("No monitor interface specified.\n");
+ printf(" No monitor interrface specified.\n");
#endif
if (ctl->server.protocol > P_POP2)
diff --git a/fetchmail.h b/fetchmail.h
index bd046783..2c2fdb1b 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -67,6 +67,7 @@ struct hostdata /* shared among all user connections to given server */
int timeout;
char *envelope;
int skip;
+ int no_dns;
#ifdef linux
char *interface;
@@ -101,7 +102,7 @@ struct query
int keep;
int fetchall;
int flush;
- int norewrite;
+ int no_rewrite;
int limit;
int fetchlimit;
int batchlimit;
diff --git a/fetchmail.man b/fetchmail.man
index a1e87ad8..762adb3c 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -546,6 +546,8 @@ Legal server options are:
aka
interface
monitor
+ dns
+ no dns
Legal user options are
@@ -561,25 +563,17 @@ Legal user options are
flush
fetchall
rewrite
- nokeep
- noflush
- nofetchall
- norewrite
+ no keep
+ no flush
+ no fetchall
+ no rewrite
limit
fetchlimit
syslog
.PP
All options correspond to the obvious command-line arguments except
-the following: `aka', `is', `to', `password', `preconnect', and
-`localdomains'.
-.PP
-The `aka' option is for use with multidrop mailboxes. It allows you
-to pre-declare a list of DNS aliases for a server. This is an
-optimization hack that allows you to trade space for speed. When
-.IR fetchmail ,
-while processing a multidrop mailbox, grovels through message headers
-looking for names of the mailserver, pre-declaring common ones can
-save it from having to do DNS lookups.
+the following: `aka', `is', `to', `dns'/`no dns', `password',
+`preconnect', and `localdomains'.
.PP
The `is' or `to' keywords associate the following local (client)
name(s) (or server-name to client-name mappings separated by =) with
@@ -589,22 +583,46 @@ its last name, unrecognized names are simply passed through.
A single local name can be used to support redirecting your mail when
your username on the client machine is different from your name on the
mailserver. When there is only a single local name, mail is forwarded
-to that local username regardless of the message's To, Cc, and Bcc headers.
+to that local username regardless of the message's Received, To, Cc,
+and Bcc headers. In this case
+.I fetchmail
+never does DNS lookups.
.PP
When there is more than one local name (or name mapping) the
-\fIfetchmail\fR code does look at the To, Cc, and Bcc headers of
-retrieved mail. When a declared mailserver username is recognized, its
-local mapping is added to the list of local recipients. If
-\fIfetchmail\fR cannot recognize any mailserver usernames, the default
-recipient is the calling user.
+\fIfetchmail\fR code does look at the Received, To, Cc, and Bcc
+headers of retrieved mail (this is `multidrop mode'). It looks for
+addresses with hostname parts that match your `aka' or `localdomains'
+options, and usually also for hostname parts which DNS tells it are
+aliases of the mailserver. See the discussion of `dns',
+`localdomains', and `aka' for details on how matching addresses are
+handled. If \fIfetchmail\fR cannot match any mailserver usernames or
+localdomain addresses, the default recipient is the calling user.
+.PP
+The `dns' option (normally on) controls the way addresses from
+multidrop mailboxes are checked. On, it enables logic to check each
+host address that doesn't match an `aka' or `localdomains' declaration
+by looking it up with DNS. When a mailserver username is recognized
+attached to a matching hostname part, its local mapping is added to
+the list of local recipients.
+.PP
+The `aka' option is for use with multidrop mailboxes. It allows you
+to pre-declare a list of DNS aliases for a server. This is an
+optimization hack that allows you to trade space for speed. When
+.IR fetchmail ,
+while processing a multidrop mailbox, grovels through message headers
+looking for names of the mailserver, pre-declaring common ones can
+save it from having to do DNS lookups.
+.PP
+The `localdomains' option allows you to declare a list of domains
+which fetchmail should consider local. When fetchmail is parsing
+address lines in multidrop modes, and a trailing segment of a host
+name matches a declared local doman, that address is passed through
+to the listener or MDA unaltered (local-name mappings are \fInot\fR
+applied).
.PP
The \fBpassword\fR option requires a string argument, which is the password
to be used with the entry's server.
.PP
-The \fBaka\fR option declares names that are recognized as OK for
-local delivery. Your local name is automatically one of these; the
-aka directive can be used to declare others.
-.PP
The `preconnect' keyword allows you to specify a shell command to be
executed just before each time
.I fetchmail
@@ -612,12 +630,6 @@ establishes a mailserver connection. This may be useful if you are
attempting to set up secure POP connections with the aid of
.IR ssh (1).
.PP
-The `localdomains' option allows you to declare a list of domains
-which fetchmail should consider local. When fetchmail is parsing
-address lines in multidrop modes, and a trailing segment of a host
-name matches a declared local doman, that address is passed through
-to the listener or MDA unaltered.
-.PP
Legal protocol identifiers are
auto (or AUTO)
diff --git a/options.c b/options.c
index f3b76831..54644237 100644
--- a/options.c
+++ b/options.c
@@ -235,7 +235,7 @@ struct query *ctl; /* option record to be initialized */
break;
case 'n':
case LA_NOREWRITE:
- ctl->norewrite = TRUE;
+ ctl->no_rewrite = TRUE;
break;
case 'l':
case LA_LIMIT:
diff --git a/rcfile_l.l b/rcfile_l.l
index b9aca34f..e8d80ec7 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -17,6 +17,8 @@ int prc_lineno = 1;
%o 5000
%a 3000
+WS [ \t]*
+
%%
set { return SET; }
@@ -53,14 +55,24 @@ to { return TO; }
= { return MAP; }
"*" { return WILDCARD; }
-keep { yylval.flag = FLAG_TRUE; return KEEP; }
-flush { yylval.flag = FLAG_TRUE; return FLUSH; }
-fetchall { yylval.flag = FLAG_TRUE; return FETCHALL; }
-rewrite { yylval.flag = FLAG_FALSE; return REWRITE; }
+keep { yylval.flag = FLAG_TRUE; return KEEP; }
+flush { yylval.flag = FLAG_TRUE; return FLUSH; }
+fetchall { yylval.flag = FLAG_TRUE; return FETCHALL; }
+rewrite { yylval.flag = FLAG_TRUE; return REWRITE; }
+dns { yylval.flag = FLAG_TRUE; return DNS; }
+
nokeep { yylval.flag = FLAG_FALSE; return KEEP; }
noflush { yylval.flag = FLAG_FALSE; return FLUSH; }
nofetchall { yylval.flag = FLAG_FALSE; return FETCHALL; }
-norewrite { yylval.flag = FLAG_TRUE; return REWRITE; }
+norewrite { yylval.flag = FLAG_FALSE; return REWRITE; }
+nodns { yylval.flag = FLAG_FALSE; return DNS; }
+
+no{WS}keep { yylval.flag = FLAG_FALSE; return KEEP; }
+no{WS}flush { yylval.flag = FLAG_FALSE; return FLUSH; }
+no{WS}fetchall { yylval.flag = FLAG_FALSE; return FETCHALL; }
+no{WS}rewrite { yylval.flag = FLAG_FALSE; return REWRITE; }
+no{WS}dns { yylval.flag = FLAG_FALSE; return DNS; }
+
limit { return LIMIT; }
with {/* EMPTY */}
diff --git a/rcfile_y.y b/rcfile_y.y
index bd6ec1e9..e02fe37b 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -49,7 +49,7 @@ static void prc_reset();
%token <proto> PROTO
%token <sval> STRING
%token <number> NUMBER
-%token <flag> KEEP FLUSH FETCHALL REWRITE PORT
+%token <flag> KEEP FLUSH FETCHALL REWRITE DNS PORT
/* these are actually used by the lexer */
%token FLAG_TRUE 2
@@ -128,6 +128,7 @@ serv_option : AKA alias_list
fprintf(stderr, "fetchmail: monitor option is only supported under Linux\n");
#endif /* linux */
}
+ | DNS {current.server.no_dns = ($1==FLAG_FALSE);}
;
/*
@@ -190,7 +191,7 @@ user_option : TO localnames HERE
| KEEP {current.keep = ($1==FLAG_TRUE);}
| FLUSH {current.flush = ($1==FLAG_TRUE);}
| FETCHALL {current.fetchall = ($1==FLAG_TRUE);}
- | REWRITE {current.norewrite = ($1==FLAG_TRUE);}
+ | REWRITE {current.no_rewrite =($1==FLAG_FALSE);}
| LIMIT NUMBER {current.limit = $2;}
| FETCHLIMIT NUMBER {current.fetchlimit = $2;}
| BATCHLIMIT NUMBER {current.batchlimit = $2;}
@@ -331,6 +332,12 @@ static void prc_register(void)
FLAG_FORCE(server.timeout);
FLAG_FORCE(server.envelope);
FLAG_FORCE(server.skip);
+ FLAG_FORCE(server.no_dns);
+
+#ifdef HAVE_RES_SEARCH
+ FLAG_FORCE(server.interface);
+ FLAG_FORCE(server.monitor);
+#endif /* HAVE_RES_SEARCH */
FLAG_FORCE(remotename);
FLAG_FORCE(password);
@@ -342,10 +349,11 @@ static void prc_register(void)
FLAG_FORCE(keep);
FLAG_FORCE(flush);
FLAG_FORCE(fetchall);
- FLAG_FORCE(norewrite);
+ FLAG_FORCE(no_rewrite);
FLAG_FORCE(limit);
FLAG_FORCE(fetchlimit);
FLAG_FORCE(batchlimit);
+
#undef FLAG_FORCE
(void) hostalloc(&current);
@@ -364,6 +372,12 @@ void optmerge(struct query *h2, struct query *h1)
FLAG_MERGE(server.timeout);
FLAG_MERGE(server.envelope);
FLAG_MERGE(server.skip);
+ FLAG_MERGE(server.no_dns);
+
+#ifdef HAVE_RES_SEARCH
+ FLAG_MERGE(server.interface);
+ FLAG_MERGE(server.monitor);
+#endif /* HAVE_RES_SEARCH */
FLAG_MERGE(remotename);
FLAG_MERGE(password);
@@ -375,7 +389,7 @@ void optmerge(struct query *h2, struct query *h1)
FLAG_MERGE(keep);
FLAG_MERGE(flush);
FLAG_MERGE(fetchall);
- FLAG_MERGE(norewrite);
+ FLAG_MERGE(no_rewrite);
FLAG_MERGE(limit);
FLAG_MERGE(fetchlimit);
FLAG_MERGE(batchlimit);
diff --git a/sample.rcfile b/sample.rcfile
index f4fe5eb8..13d35c40 100644
--- a/sample.rcfile
+++ b/sample.rcfile
@@ -43,10 +43,12 @@
# flush
# fetchall
# rewrite
-# nokeep
-# noflush
-# nofetchall
-# norewrite
+# dns
+# no keep
+# no flush
+# no fetchall
+# no rewrite
+# no dns
# 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