aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-06-29 21:32:04 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-06-29 21:32:04 +0000
commit39dad9fd52a64da0efefce1d0909426de888260b (patch)
tree95bc1ad85730772c104416392978b3f2fcace837
parentd6afd2b946236ebc02d65f14829c6b715dd7c265 (diff)
downloadfetchmail-39dad9fd52a64da0efefce1d0909426de888260b.tar.gz
fetchmail-39dad9fd52a64da0efefce1d0909426de888260b.tar.bz2
fetchmail-39dad9fd52a64da0efefce1d0909426de888260b.zip
Enrico Musio's IP-checkalias patch.
svn path=/trunk/; revision=1944
-rw-r--r--Makefile.in5
-rw-r--r--NEWS3
-rw-r--r--driver.c17
-rw-r--r--fetchmail.c11
-rw-r--r--fetchmail.h2
-rw-r--r--fetchmail.man27
-rw-r--r--rcfile_l.l3
-rw-r--r--rcfile_y.y4
8 files changed, 65 insertions, 7 deletions
diff --git a/Makefile.in b/Makefile.in
index 1173a8bc..bd238c44 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -81,7 +81,7 @@ CTAGS = ctags
protobjs = rcfile_y.o rcfile_l.o socket.o getpass.o pop2.o pop3.o imap.o \
etrn.o fetchmail.o env.o options.o daemon.o driver.o rfc822.o smtp.o \
xmalloc.o uid.o mxget.o md5c.o md5ify.o rpa.o interface.o netrc.o \
- base64.o error.o unmime.o conf.o
+ base64.o error.o unmime.o conf.o is_ip_alias.o
objs = $(protobjs) $(extras) $(EXTRAOBJ)
@@ -93,7 +93,8 @@ srcs = $(srcdir)/socket.c $(srcdir)/getpass.c $(srcdir)/pop2.c \
$(srcdir)/xmalloc.c $(srcdir)/uid.c $(srcdir)/mxget.c \
$(srcdir)/md5c.c $(srcdir)/md5ify.c $(srcdir)/rpa.c \
$(srcdir)/interface.c $(srcdir)/netrc.c $(srcdir)/base64.c \
- $(srcdir)/error.c $(srcdir)/unmime.c $(srcdir)/conf.c
+ $(srcdir)/error.c $(srcdir)/unmime.c $(srcdir)/conf.c \
+ $(srcdir)/is_ip_alias.c
.SUFFIXES:
.SUFFIXES: .o .c .h .y .l .ps .dvi .info .texi
diff --git a/NEWS b/NEWS
index 7f5ef234..788c95e0 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@
Release Notes:
------------------------------------------------------------------------------
+fetchmail-4.5.1 ():
+* Checkalias option from Enrico Musio <enrico.musio@spaziozerouno.it>.
+
fetchmail-4.5.0bis (Sat Jun 20 10:55:52 EDT 1998):
One-line fix for an embarrassing bug in the `gold' version; command-line
diff --git a/driver.c b/driver.c
index 50e1e833..8bec7414 100644
--- a/driver.c
+++ b/driver.c
@@ -140,10 +140,12 @@ static int accept_count, reject_count;
#define MX_RETRIES 3
+extern int is_ip_alias();
+
static int is_host_alias(const char *name, struct query *ctl)
/* determine whether name is a DNS alias of the hostname */
{
- struct hostent *he;
+ struct hostent *he,*he_st;
struct mxentry *mxp, *mxrecords;
struct hostdata *lead_server =
@@ -189,6 +191,19 @@ static int is_host_alias(const char *name, struct query *ctl)
{
if (strcasecmp(ctl->server.truename, he->h_name) == 0)
goto match;
+ else if (((he_st = gethostbyname(ctl->server.truename)) != (struct hostent *)NULL) && ctl->server.checkalias)
+ {
+ if (outlevel == O_VERBOSE)
+ error(0, 0, "Checking if %s is really the same node as %s",ctl->server.truename,name);
+ if (is_ip_alias(ctl->server.truename,name) == TRUE)
+ {
+ if (outlevel == O_VERBOSE)
+ error(0, 0, "Yes, their IP addresses match");
+ goto match;
+ }
+ if (outlevel == O_VERBOSE)
+ error(0, 0, "No, their IP addresses don't match");
+ }
else
return(FALSE);
}
diff --git a/fetchmail.c b/fetchmail.c
index a90c833b..a15a5328 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -733,6 +733,7 @@ static void optmerge(struct query *h2, struct query *h1, int force)
FLAG_MERGE(server.qvirtual);
FLAG_MERGE(server.skip);
FLAG_MERGE(server.dns);
+ FLAG_MERGE(server.checkalias);
FLAG_MERGE(server.uidl);
#ifdef linux
@@ -893,6 +894,7 @@ static int load_params(int argc, char **argv, int optind)
DEFAULT(ctl->mimedecode, FALSE);
DEFAULT(ctl->server.dns, TRUE);
DEFAULT(ctl->server.uidl, FALSE);
+ DEFAULT(ctl->server.checkalias, FALSE);
#undef DEFAULT
#if !defined(HAVE_GETHOSTBYNAME) || !defined(HAVE_RES_SEARCH)
@@ -1335,7 +1337,14 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit)
{
printf(" DNS lookup for multidrop addresses is %sabled.\n",
ctl->server.dns ? "en" : "dis");
-
+ if (ctl->server.dns)
+ {
+ printf(" Server aliases will be compared with multidrop addresses by ");
+ if (ctl->server.checkalias)
+ printf("IP address.");
+ else
+ printf("name.");
+ }
if (ctl->server.envelope == STRING_DISABLED)
printf(" Envelope-address routing is disabled\n");
else
diff --git a/fetchmail.h b/fetchmail.h
index e57f4c32..5f9eef5a 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -141,6 +141,8 @@ struct hostdata /* shared among all user connections to given server */
flag skip; /* suppress poll in implicit mode? */
flag dns; /* do DNS lookup on multidrop? */
flag uidl; /* use RFC1725 UIDLs? */
+ flag checkalias; /* try to resolve aliases by comparing IPs ?*/
+
#ifdef linux
char *interface;
diff --git a/fetchmail.man b/fetchmail.man
index 11c01026..d7a174c0 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -867,6 +867,12 @@ T}
no dns \& T{
Disable DNS lookup for multidrop
T}
+checkalias \& T{
+Do comparison by IP address for multidrop
+T}
+no checkalias \& T{
+Do comparison by name for multidrop (default)
+T}
uidl -U T{
Force POP3 to use client-side UIDLs
T}
@@ -1002,6 +1008,7 @@ following them.
.PP
All options correspond to the obvious command-line arguments, except
the following: `via', `interval', `aka', `is', `to', `dns'/`no dns',
+`checkalias'/`no checkalias',
\&`password', \&`preconnect', \&`postconnect', `localdomains',
\&`stripcr'/`no stripcr', \&`forcecr'/`no forcecr', `pass8bits'/`no
pass8bits' `dropstatus/no dropstatus', `mimedecode/no mimedecode',
@@ -1042,7 +1049,7 @@ headers of retrieved mail (this is `multidrop mode'). It looks for
addresses with hostname parts that match your poll name or your `via',
`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
+of `dns', `checkalias', `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 (as set by the USER or LOGNAME variable in the
@@ -1055,6 +1062,24 @@ 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 `checkalias' option (normally off) extends the lookups performed
+by the `dns' keyword in multidrop mode, providing a way to cope with
+remote MTAs that identify themselves using their canonical name, while
+they're polled using an alias.
+When such a server is polled, checks to extract the envelope address
+fail, and
+.IR fetchmail
+reverts to delivery using the To/Cc/Bcc headers (See below
+`Header vs. Envelope addresses').
+Specifying this option instructs
+.IR fetchmail
+to retrieve all the IP addresses associated with both the poll name
+and the name used by the remote MTA and to do a comparison of the IP
+addresses. This comes in handy in situations where the remote server
+undergoes frequent canonical name changes, that would otherwise
+require modifications to the rcfile. `checkalias' has no effect if
+`no dns' is specified in the rcfile.
+.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
diff --git a/rcfile_l.l b/rcfile_l.l
index 58fe10a0..6bdff96d 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -70,7 +70,7 @@ to { return TO; }
= { return MAP; }
"*" { return WILDCARD; }
-no/[kfrsdu \t].* { return NO;}
+no/[kfrsduc \t].* { return NO;}
keep { return KEEP; }
flush { return FLUSH; }
@@ -83,6 +83,7 @@ dropstatus? { return DROPSTATUS; }
mimedec(ode)? { return MIMEDECODE; }
dns { return DNS; }
uidl { return UIDL; }
+checkalias { return CHECKALIAS; }
limit { return LIMIT; }
diff --git a/rcfile_y.y b/rcfile_y.y
index 5c4f43b7..d08ef863 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -72,7 +72,7 @@ extern char * yytext;
%token <sval> STRING
%token <number> NUMBER
%token NO KEEP FLUSH FETCHALL REWRITE FORCECR STRIPCR PASS8BITS DROPSTATUS
-%token DNS SERVICE PORT UIDL INTERVAL MIMEDECODE
+%token DNS SERVICE PORT UIDL INTERVAL MIMEDECODE CHECKALIAS
%%
@@ -143,6 +143,8 @@ serv_option : AKA alias_list
}
| UIDL {current.server.uidl = FLAG_TRUE;}
| NO UIDL {current.server.uidl = FLAG_FALSE;}
+ | CHECKALIAS {current.server.checkalias = FLAG_TRUE;}
+ | NO CHECKALIAS {current.server.checkalias = FLAG_FALSE;}
| SERVICE STRING {
#if INET6
current.server.service = $2;