]> Pileus Git - ~andy/fetchmail/commitdiff
Added --showdots option by Thomas Jarosch <tomj@gmx.de>
authorEric S. Raymond <esr@thyrsus.com>
Sat, 4 Nov 2000 23:23:04 +0000 (23:23 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 4 Nov 2000 23:23:04 +0000 (23:23 -0000)
svn path=/trunk/; revision=2981

12 files changed:
NEWS
conf.c
driver.c
fetchmail.c
fetchmail.h
fetchmail.man
fetchmailconf
options.c
rcfile_l.l
rcfile_y.y
sample.rcfile
socket.c

diff --git a/NEWS b/NEWS
index 74d3ea5506e1329a13abc43ab0f9e81bea325ef0..81f7cad2735ec78b8b8fc5053437da57da1fe3a6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@
 
 (The `lines' figures total .c, .h, .l, and .y files under version control.)
 
+* Chip Salzenberg's patch to prevent wilcards in Common Names from causing
+  spurious error messages (resolved Debian bug #75011).
+* Added --showdots option by Thomas Jarosch <tomj@gmx.de>.
+
 fetchmail-5.5.5 (Tue Oct 17 17:50:46 EDT 2000), 19523 lines:
 
 * Killed a nasty segfault due to double-freeing of the header block.
diff --git a/conf.c b/conf.c
index 7ac6fb66c21cde94e9105859e107c735b083fc21..19f8346a1993796af98dceb5611bd7691608e148 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -194,6 +194,7 @@ void dump_config(struct runctl *runp, struct query *querylist)
     booldump("bouncemail", runp->bouncemail);
     stringdump("properties", runp->properties);
     booldump("invisible", runp->invisible);
+    booldump("showdots", runp->showdots);
     booldump("syslog", runp->use_syslog);
 
     if (!querylist)
index 2399c8d297820bcd33504b0d5789b7953a7ec2d0..0c52f9b5c2602f8056e4cea3a82b760ebb1577d6 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -544,7 +544,7 @@ static int readheaders(int sock,
            sizeticker += linelen;
            while (sizeticker >= SIZETICKER)
            {
-               if (!run.use_syslog && !isafile(1))
+               if ((!run.use_syslog && !isafile(1)) || run.showdots)
                {
                    fputc('.', stdout);
                    fflush(stdout);
@@ -1217,7 +1217,7 @@ static int readbody(int sock, struct query *ctl, flag forward, int len)
            sizeticker += linelen;
            while (sizeticker >= SIZETICKER)
            {
-               if ((run.poll_interval == 0 || nodetach) && outlevel > O_SILENT && !isafile(1))
+               if (outlevel > O_SILENT && (((run.poll_interval == 0 || nodetach) && !isafile(1)) || run.showdots))
                {
                    fputc('.', stdout);
                    fflush(stdout);
index 28ad2aa2457c095ce0df91431fdbff8de964323c..617d4e80c6f71b4098af46af7b1eec5c98781f66 100644 (file)
@@ -1153,61 +1153,64 @@ static int load_params(int argc, char **argv, int optind)
                ctl->server.truename = xstrdup(leadname);
            }
 #ifdef HAVE_GETHOSTBYNAME
-           else if (!configdump && (ctl->server.preauthenticate==A_KERBEROS_V4 ||
-               ctl->server.preauthenticate==A_KERBEROS_V5 ||
-                     (ctl->server.dns && MULTIDROP(ctl))))
+           else if (!configdump)
            {
-               struct hostent  *namerec;
-
-               /* compute the canonical name of the host */
-               errno = 0;
-               namerec = gethostbyname(ctl->server.queryname);
-               if (namerec == (struct hostent *)NULL)
+               if (ctl->server.preauthenticate==A_KERBEROS_V4 ||
+                     ctl->server.preauthenticate==A_KERBEROS_V5 ||
+                   (ctl->server.dns && MULTIDROP(ctl)))
                {
-                   report(stderr,
-                         _("couldn't find canonical DNS name of %s\n"),
-                         ctl->server.pollname);
-                   ctl->server.truename = xstrdup(ctl->server.queryname);
-                   ctl->server.trueaddr = NULL;
+                   struct hostent      *namerec;
+
+                   /* compute the canonical name of the host */
+                   errno = 0;
+                   namerec = gethostbyname(ctl->server.queryname);
+                   if (namerec == (struct hostent *)NULL)
+                   {
+                       report(stderr,
+                              _("couldn't find canonical DNS name of %s\n"),
+                              ctl->server.pollname);
+                       ctl->server.truename = xstrdup(ctl->server.queryname);
+                       ctl->server.trueaddr = NULL;
+                   }
+                   else
+                       ctl->server.truename=xstrdup((char *)namerec->h_name);
                }
-               else
-                   ctl->server.truename=xstrdup((char *)namerec->h_name);
-           }
 #endif /* HAVE_GETHOSTBYNAME */
-           else {
+               else {
 #ifdef HAVE_GETHOSTBYNAME
-             struct hostent    *namerec;
-
-             /* <fetchmail@mail.julianhaight.com>
-                Get the host's IP, so we can report it like this:
-
-                Received: from hostname [10.0.0.1]
-
-                do we actually need to gethostbyname to find the IP?
-                it seems like it would be faster to do this later, when
-                we are actually resolving the hostname for a connection,
-                but I ain't that smart, so I don't know where to make
-                the change later..
-             */
-             errno = 0;
-             namerec = gethostbyname(ctl->server.queryname);
-             if (namerec == (struct hostent *)NULL)
-               {
-                 report(stderr,
-                        _("couldn't find canonical DNS name of %s\n"),
-                        ctl->server.pollname);
-                 exit(PS_DNS);
-               }
-             else {
-               ctl->server.truename=xstrdup((char *)namerec->h_name);
-               ctl->server.trueaddr=xmalloc(namerec->h_length);
-               memcpy(ctl->server.trueaddr, 
-                      namerec->h_addr_list[0],
-                      namerec->h_length);
-             }
+                   struct hostent      *namerec;
+                   
+                   /* <fetchmail@mail.julianhaight.com>
+                      Get the host's IP, so we can report it like this:
+
+                      Received: from hostname [10.0.0.1]
+
+                      do we actually need to gethostbyname to find the IP?
+                      it seems like it would be faster to do this later, when
+                      we are actually resolving the hostname for a connection,
+                      but I ain't that smart, so I don't know where to make
+                      the change later..
+                   */
+                   errno = 0;
+                   namerec = gethostbyname(ctl->server.queryname);
+                   if (namerec == (struct hostent *)NULL)
+                   {
+                       report(stderr,
+                              _("couldn't find canonical DNS name of %s\n"),
+                              ctl->server.pollname);
+                       exit(PS_DNS);
+                   }
+                   else {
+                       ctl->server.truename=xstrdup((char *)namerec->h_name);
+                       ctl->server.trueaddr=xmalloc(namerec->h_length);
+                       memcpy(ctl->server.trueaddr, 
+                              namerec->h_addr_list[0],
+                              namerec->h_length);
+                   }
 #else
-             ctl->server.truename = xstrdup(ctl->server.queryname);
+                   ctl->server.truename = xstrdup(ctl->server.queryname);
 #endif /* HAVE_GETHOSTBYNAME */
+               }
            }
 
            /* if no folders were specified, set up the null one as default */
@@ -1479,6 +1482,8 @@ static void dump_params (struct runctl *runp,
 #endif
     if (runp->invisible)
        printf(_("Fetchmail will masquerade and will not generate Received\n"));
+    if (runp->showdots)
+       printf(_("Fetchmail will show progress dots even in logfiles\n"));
     if (runp->postmaster)
        printf(_("Fetchmail will forward misaddressed multidrop messages to %s.\n"),
               runp->postmaster);
index c0ffce33d15860ccfcb985cf702c31f18163f281..8907696a0cf64c063e6b846cee01746f3d7ca9af 100644 (file)
@@ -118,6 +118,7 @@ struct runctl
     char       *properties;
     flag       use_syslog;
     flag       invisible;
+    flag       showdots;
 };
 
 struct idlist
index 664f13f3b4b0ffe81c3e890dba1e7ed93db802b7..6f803d43419061fb644f6b3f576fff9d19760f2a 100644 (file)
@@ -242,7 +242,7 @@ to use socks, SSL, ssh, or need some special firewalling setup.  The
 program will be looked up in $PATH and can optionally be passed the
 hostname and port as arguments using "%h" and "%p" respectively (note
 that the interpolation logic is rather promitive, and these token must
-be bounded by whitespace or beginning of string or end of stribg).
+be bounded by whitespace or beginning of string or end of string).
 Fetchmail will write to the plugin's stdin and read from the plugin's
 stdout.
 .TP
@@ -899,6 +899,13 @@ the machine fetchmail itself is running on.  If the invisible option
 is on, the Received header is suppressed and fetchmail tries to spoof
 the MTA it forwards to into thinking it came directly from the
 mailserver host.
+.PP
+The 
+.B --showdots
+option (keyword: set showdots) forces fetchmail to show progress dots
+even if the current tty is not stdout (for example logfiles).
+Starting with fetchmail version 5.3.0, 
+progress dots are only shown on stdout by default.
 
 .SH RETRIEVAL FAILURE MODES
 The protocols \fIfetchmail\fR uses to talk to mailservers are next to
index f3d7004a0c10b0c27e4104a6f7aeaa97c3d72526..05a599edd03d76174c300c6ebd62a1a2331c36a8 100755 (executable)
@@ -4,7 +4,7 @@
 # by Eric S. Raymond, <esr@snark.thyrsus.com>.
 # Requires Python with Tkinter, and the following OS-dependent services:
 #      posix, posixpath, socket
-version = "1.29"
+version = "1.30"
 
 from Tkinter import *
 from Dialog import *
@@ -1747,7 +1747,10 @@ def copy_instance(toclass, fromdict):
 # The `optional' fields are the ones we can ignore for purposes of
 # conformability checking; they'll still get copied if they are
 # present in the dictionary.
-    optional = ('interface', 'monitor', 'netsec', 'ssl', 'sslkey', 'sslcert')
+    optional = ('interface', 'monitor',
+                'netsec',
+                'ssl', 'sslkey', 'sslcert',
+                'showdots')
     class_sig = setdiff(toclass.__dict__.keys(), optional)
     class_sig.sort()
     dict_keys = setdiff(fromdict.keys(), optional)
index 03f99f5e61d088c42e545cbe0898c864b53af8eb..6f9aaceb60a45d7a5156c3569498f626b794d754 100644 (file)
--- a/options.c
+++ b/options.c
@@ -78,6 +78,8 @@
 #define LA_SSLCERT     52
 #endif
 
+#define LA_SHOWDOTS    53
+
 /* options still left: CDgGhHjJoORwWxXYz */
 static const char *shortoptions = 
        "?Vcsvd:NqL:f:i:p:UP:A:t:E:Q:u:akKFnl:r:S:Z:b:B:e:m:T:I:M:yw:";
@@ -94,6 +96,7 @@ static const struct option longoptions[] = {
   {"quit",     no_argument,       (int *) 0, LA_QUIT        },
   {"logfile",  required_argument, (int *) 0, LA_LOGFILE     },
   {"invisible",        no_argument,       (int *) 0, LA_INVISIBLE   },
+  {"showdots", no_argument,       (int *) 0, LA_SHOWDOTS    },
   {"syslog",   no_argument,       (int *) 0, LA_SYSLOG      },
   {"nosyslog", no_argument,       (int *) 0, LA_NOSYSLOG    },
   {"fetchmailrc",required_argument,(int *) 0, LA_RCFILE      },
@@ -299,6 +302,9 @@ struct query *ctl;  /* option record to be initialized */
        case LA_INVISIBLE:
            rctl->invisible = TRUE;
            break;
+       case LA_SHOWDOTS:
+           rctl->showdots = TRUE;
+           break;
        case 'f':
        case LA_RCFILE:
            rcfile = (char *) xstrdup(optarg);
@@ -647,6 +653,7 @@ struct query *ctl;  /* option record to be initialized */
         P(_("      --bsmtp       set output BSMTP file\n"));
         P(_("      --lmtp        use LMTP (RFC2033) for delivery\n"));
        P(_("  -r, --folder      specify remote folder name\n"));
+       P(_("      --showdots    show progress dots even in logfiles\n"));
 #undef P
 
        if (helpflag)
index c329fa4d42059535bd088dc0f03b466133b98b6b..8ce776bf84d44cca9fdcd9ea3984122569b227f8 100644 (file)
@@ -65,6 +65,7 @@ idfile                { return IDFILE; }
 daemon         { return DAEMON; }
 syslog         { return SYSLOG; }
 invisible      { return INVISIBLE; }
+showdots       { return SHOWDOTS; }
 postmaster     { return POSTMASTER; }
 bouncemail     { return BOUNCEMAIL; }
 warnings       { return WARNINGS; }
index 1c504143aaf48f9a2b09d1c76a5232565d4edd7f..f24f71a44b36f399aca7d4e4c70ef19465774a96 100644 (file)
@@ -65,7 +65,7 @@ extern char * yytext;
 %token NETSEC INTERFACE MONITOR PLUGIN PLUGOUT
 %token IS HERE THERE TO MAP WILDCARD
 %token BATCHLIMIT FETCHLIMIT EXPUNGE PROPERTIES
-%token SET LOGFILE DAEMON SYSLOG IDFILE INVISIBLE POSTMASTER BOUNCEMAIL
+%token SET LOGFILE DAEMON SYSLOG IDFILE INVISIBLE POSTMASTER BOUNCEMAIL SHOWDOTS
 %token <proto> PROTO
 %token <sval>  STRING
 %token <number> NUMBER
@@ -96,6 +96,7 @@ statement     : SET LOGFILE optmap STRING     {run.logfile = xstrdup($4);}
                | SET PROPERTIES optmap STRING  {run.properties =xstrdup($4);}
                | SET SYSLOG                    {run.use_syslog = TRUE;}
                | SET INVISIBLE                 {run.invisible = TRUE;}
+               | SET SHOWDOTS                  {run.showdots = TRUE;}
 
 /* 
  * The way the next two productions are written depends on the fact that
index 54308b4ea65a0293199a0adba755571ffba70f7f..299ec8cd4cf3bc03f5f7642bb49b940d51df65e9 100644 (file)
 #   set daemon                 -- must be followed by a number   
 #   set syslog
 #   set invisible
+#   set showdots
 #
 # The noise keywords `and', `with', `has', `wants', and `options' are ignored
 # anywhere in an entry; they can be used to make it resemble English.  The
index 805f867eb7a55cc13354d22cf417d6eb550ac8f4..3777e6d985b7d394078fae7e4ce59c04707529e3 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -650,14 +650,26 @@ int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx )
                                *str_ptr = '\0';
                        }
                        if (outlevel == O_VERBOSE)
-                               report(stdout, _("Server CommonName: %s\n"), cbuf );
-                       /* Should we have some wildcarding here? */
-                       if ( NULL != _ssl_server_cname
-                            && 0 != strcasecmp( cbuf, _ssl_server_cname ) ) {
-                               report(stdout,
-                                      _("Server CommonName mismatch: %s != %s\n"),
-                                      cbuf, _ssl_server_cname );
-                       }
+                               report(stdout, _("Server CommonName: %s\n"), cbuf);
+
+                       if (_ssl_server_cname != NULL) 
+                      {
+                               char *p1 = cbuf;
+                               char *p2 = _ssl_server_cname;
+                               int n;
+
+                               if (*p1 == '*') 
+                              {
+                                       ++p1;
+                                       n = strlen(p2) - strlen(p1);
+                                       if (n >= 0)
+                                               p2 += n;
+                               }
+                               if ( 0 != strcasecmp( p1, p2 ) )
+                                       report(stdout,
+                                              "Server CommonName mismatch: %s != %s\n",
+                                              cbuf, _ssl_server_cname );
+                      }
                } else {
                        if (outlevel == O_VERBOSE)
                                report(stdout, _("Unknown Server CommonName\n"), cbuf );