]> Pileus Git - ~andy/fetchmail/commitdiff
Added dns/nodns.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 18 Jan 1997 06:40:25 +0000 (06:40 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 18 Jan 1997 06:40:25 +0000 (06:40 -0000)
svn path=/trunk/; revision=785

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

diff --git a/NEWS b/NEWS
index e6f8963c3e0490fc91ab9dcb922f80ab6941ca35..bdbd690641185f87fb26258135a359e849946f1d 100644 (file)
--- 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
index 4f934c382b48d1e960a25183f8883fd5ec47ef1b..910bf9fe133ce03a0f3a6cd0699f720c9d07661f 100644 (file)
--- 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)
index b621c0560290313571f133c297f6a28f35def827..c60c77ae1191840d27c2cfd583e4185402acc94a 100644 (file)
@@ -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)
index bd046783002490e6aa5c87d46cb91de1818d3f2e..2c2fdb1b2cba20da5a663d45e99f3dd40e123d91 100644 (file)
@@ -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;
index a1e87ad820c2d46704bb711cc0af9a66f5e746e7..762adb3ccc948886b1ebcc4c4b3442f01b80d318 100644 (file)
@@ -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)
index f3b76831d328ea00c58c6494836db2d8cd5797e3..546442370acc725c46860ff0714953271fd91642 100644 (file)
--- 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:
index b9aca34fe5f061ff8965c2a3bc006854c9d82d44..e8d80ec7bcd0d1e4110b5c7823d6c551dddfd73d 100644 (file)
@@ -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 */}
index bd6ec1e979c425c5c0003848ad89f6414773eeb2..e02fe37b6fd37991f7f55ba637e13f2a05c74eea 100644 (file)
@@ -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);
index f4fe5eb8c8b9a529d9887ddc22617c492f6f107b..13d35c40bb36246047d1c68a5363cbe11aac5fe0 100644 (file)
 #   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