aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-01-09 08:14:53 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-01-09 08:14:53 +0000
commit7f32cacbd31832e7c2410b24a40aa6e7c8f820bf (patch)
tree0501dab30bd6a176d1439b108a511aee14572daf
parent6feef116d81caa80cc12ebdfc041df358418f2f1 (diff)
downloadfetchmail-7f32cacbd31832e7c2410b24a40aa6e7c8f820bf.tar.gz
fetchmail-7f32cacbd31832e7c2410b24a40aa6e7c8f820bf.tar.bz2
fetchmail-7f32cacbd31832e7c2410b24a40aa6e7c8f820bf.zip
Added localdomains option.
svn path=/trunk/; revision=724
-rw-r--r--NEWS2
-rw-r--r--driver.c31
-rw-r--r--fetchmail.c9
-rw-r--r--fetchmail.h1
-rw-r--r--fetchmail.man22
-rw-r--r--rcfile_l.l1
-rw-r--r--rcfile_y.y12
-rw-r--r--sample.rcfile1
8 files changed, 71 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 76254672..19d3add2 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ features --
* Added preconnect option for initializing ssh connections.
+* Added local-domains feature as requested by Pablo Saratxaga.
+
* More FAQ material on how and when to use --interface.
bugs --
diff --git a/driver.c b/driver.c
index a714d733..1babb15d 100644
--- a/driver.c
+++ b/driver.c
@@ -246,11 +246,34 @@ struct idlist **xmit_names; /* list of recipient names parsed out */
if ((atsign = strchr(cp, '@')))
{
+ struct idlist *idp;
+
+ /*
+ * Does a trailing segment of the hostname match something
+ * on the localdomains list? If so, save the whole name
+ * and keep going.
+ */
+ for (idp = ctl->localdomains; idp; idp = idp->next)
+ {
+ char *rhs;
+
+ rhs = atsign + 1 + (strlen(atsign) - strlen(idp->id));
+ if ((rhs[-1] == '.' || rhs[-1] == '@')
+ && strcmp(rhs, idp->id) == 0)
+ {
+ if (outlevel == O_VERBOSE)
+ error(0, 0, "passed through %s matching %s",
+ cp, idp->id);
+ save_str(xmit_names, -1, cp);
+ continue;
+ }
+ }
+
/*
- * Address has an @. Check to see if the right-hand part
- * is an alias or MX equivalent of the mailserver. If it's
- * not, skip this name. If it is, we'll keep going and try
- * to find a mapping to a client name.
+ * Check to see if the right-hand part is an alias
+ * or MX equivalent of the mailserver. If it's
+ * not, skip this name. If it is, we'll keep
+ * going and try to find a mapping to a client name.
*/
if (!is_host_alias(atsign+1, ctl))
continue;
diff --git a/fetchmail.c b/fetchmail.c
index 7925f38d..21ba5841 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -834,6 +834,15 @@ void dump_params (struct query *ctl)
printf(" (default).\n");
else
printf(".\n");
+ if (ctl->localdomains)
+ {
+ struct idlist *idp;
+
+ printf(" Local domains:");
+ for (idp = ctl->localdomains; idp; idp = idp->next)
+ printf(" %s", idp->id);
+ putchar('\n');
+ }
printf(" %s messages will be retrieved (--all %s).\n",
ctl->fetchall ? "All" : "Only new",
diff --git a/fetchmail.h b/fetchmail.h
index bced71ba..f848ab64 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -64,6 +64,7 @@ struct query
/* per-host data */
struct idlist *servernames; /* servername first, then akas */
struct idlist *localnames; /* including calling user's name */
+ struct idlist *localdomains; /* list of pass-through domains */
int wildcard; /* should unmatched names be passed through */
int protocol;
int port;
diff --git a/fetchmail.man b/fetchmail.man
index e035af83..1c1273aa 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -551,7 +551,8 @@ Legal user options are
syslog
.PP
All options correspond to the obvious command-line arguments except
-the following: `aka', `is', `to', `password', and `preconnect'.
+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
@@ -592,6 +593,12 @@ 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)
@@ -736,6 +743,19 @@ server user names `golux', `hurkle', and `snark'. It further
specifies that `golux' and `snark' have the same name on the
client as on the server, but mail for server user `hurkle' should be
delivered to client user `happy'.
+.PP
+Here's an example of another kind of multidrop connection:
+
+.nf
+ poll pop.provider.net localdomains loonytoons.org:
+ user maildrop with pass secret1 to esr * here
+.fi
+
+This also says that the mailbox of account `maildrop' on the server is
+a multi-drop box. It tells fetchmail that any address in the
+loonytoons.org domain (including subdomain addresses like
+`joe@daffy.loonytoons.org') should be passed through to the local SMTP
+listener without modification. Be careful of mail loops if you do this!
.SH THE USE AND ABUSE OF MULTIDROP MAILBOXES
Use the multiple-local-recipients feature with caution -- it can bite.
The fundamental problem is that by having your server toss several
diff --git a/rcfile_l.l b/rcfile_l.l
index 41f01feb..b9aca34f 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -31,6 +31,7 @@ server { return POLL; }
poll { return POLL; }
skip { return SKIP; }
aka { return AKA; }
+local(domains) { return LOCALDOMAINS; }
proto(col)? { return PROTOCOL; }
port { return PORT; }
auth(enticate)? { return AUTHENTICATE; }
diff --git a/rcfile_y.y b/rcfile_y.y
index d1422856..f96f59a0 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -41,7 +41,8 @@ static void prc_reset();
char *sval;
}
-%token DEFAULTS POLL SKIP AKA PROTOCOL AUTHENTICATE TIMEOUT KPOP KERBEROS
+%token DEFAULTS POLL SKIP AKA LOCALDOMAINS PROTOCOL
+%token AUTHENTICATE TIMEOUT KPOP KERBEROS
%token ENVELOPE USERNAME PASSWORD FOLDER SMTPHOST MDA PRECONNECT LIMIT
%token IS HERE THERE TO MAP WILDCARD
%token SET BATCHLIMIT FETCHLIMIT LOGFILE INTERFACE MONITOR
@@ -94,11 +95,16 @@ serverspecs : /* EMPTY */
| serverspecs serv_option
;
-alias_list : STRING {save_str(&current.servernames, -1, $1);}
- | alias_list STRING {save_str(&current.servernames, -1, $2);}
+alias_list : STRING {save_str(&current.servernames,-1,$1);}
+ | alias_list STRING {save_str(&current.servernames,-1,$2);}
+ ;
+
+domain_list : STRING {save_str(&current.localdomains,-1,$1);}
+ | domain_list STRING {save_str(&current.localdomains,-1,$2);}
;
serv_option : AKA alias_list
+ | LOCALDOMAINS domain_list
| PROTOCOL PROTO {current.protocol = $2;}
| PROTOCOL KPOP {
current.protocol = P_POP3;
diff --git a/sample.rcfile b/sample.rcfile
index b126b2f0..d9822f01 100644
--- a/sample.rcfile
+++ b/sample.rcfile
@@ -27,6 +27,7 @@
# timeout -- must be followed by a numeric timeout value
# envelope -- must be followed by an envelope header name
# aka -- must be followed by one or more server aliases
+# localdomains -- must be followed by one or more domain names
#
# username (or user) -- must be followed by a name
# is -- must be followed by one or more names