]> Pileus Git - ~andy/fetchmail/commitdiff
Added localdomains option.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 9 Jan 1997 08:14:53 +0000 (08:14 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 9 Jan 1997 08:14:53 +0000 (08:14 -0000)
svn path=/trunk/; revision=724

NEWS
driver.c
fetchmail.c
fetchmail.h
fetchmail.man
rcfile_l.l
rcfile_y.y
sample.rcfile

diff --git a/NEWS b/NEWS
index 76254672a17616b64b2a38f6565e970486c40a07..19d3add20d1cf77c4a1759baf77a2f02c3f54fdf 100644 (file)
--- 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 --
index a714d73350b837291120fba064b706252630c4a6..1babb15df23a987b9bb5314de6fcc87ce6ccbf8e 100644 (file)
--- 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;
index 7925f38d94115d0276a4a2de27f45875bcfb3db7..21ba58411071ec3f934550b1a84de7b5fe85bb1c 100644 (file)
@@ -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",
index bced71baf50e222a9c8e39929dafee9d6aeefd0c..f848ab649795515f16bffbdce725ab917fdc4bc2 100644 (file)
@@ -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;
index e035af83e45d7609b5010de9f2c02a9e22a7c2d9..1c1273aa248054df3362a27b0d4b1dae52834718 100644 (file)
@@ -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
index 41f01feb0d9f8747394ed37146b860aeaedc5ba0..b9aca34fe5f061ff8965c2a3bc006854c9d82d44 100644 (file)
@@ -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; }
index d142285665b70ba3c13b1c6bfac18733b68554a0..f96f59a0674b1961a02fc19da30b145a39992940 100644 (file)
@@ -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;
index b126b2f059d37c4e838e56b4b8a6a540e6c5cd78..d9822f014664d5a6b9b1d3e8049d15aaed77f3b9 100644 (file)
@@ -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