]> Pileus Git - ~andy/fetchmail/commitdiff
Easy bug fixes for this round.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 8 Nov 2001 16:53:54 +0000 (16:53 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 8 Nov 2001 16:53:54 +0000 (16:53 -0000)
svn path=/trunk/; revision=3543

14 files changed:
Makefile.in
NEWS
checkalias.c
env.c
etrn.c
fetchmail-FAQ.html
fetchmail.h
fetchmailconf
imap.c
kerberos.c
sink.c
socket.c
transact.c
xalloca.c

index d010f562886a27c1ff49af634f3548c85debc0d0..ca352610261261d1520a5dfb0884d23ee962ebf7 100644 (file)
@@ -185,20 +185,20 @@ uninstall:
 .PHONY: clean realclean distclean mostlyclean
 clean: 
        -cd intl; $(MAKE) clean
-       #work around braindamage in GNU gettext
-       -rm -f $(top_builddir)/intl/libintl.h
+       -rm -f $(top_builddir)/intl/libintl.h # work around GNU gettext brain-damage
        -cd po; $(MAKE) clean
        -rm -f fetchmail *.o core fetchmail.dvi \
               rcfile_l.c rcfile_y.h rcfile_y.c \
               fetchmail.tar fetchmail.tar.gz \
               netrc rfc822 unmime fetchmail-man.html
 
+# This target would also normally invoke the following line, but doing so
+# messes up the RPM build, so the line was disabled.
+# -rm -f config.h config.cache config.status config.log stamp-config
 distclean: clean 
        -cd intl; $(MAKE) distclean
        -cd po; $(MAKE) distclean
        -rm -f TAGS tags
-       # Can't do these, it messes up RPM build
-       #-rm -f config.h config.cache config.status config.log stamp-config
 
 realclean: distclean
        -rm -f FAQ FEATURES NOTES MANIFEST 
diff --git a/NEWS b/NEWS
index 542f03271e84fa681a3f807aa9f025c2f8f7012a..be11b9dac11baf84ba1ff56e1b9ade7c4e3efea7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,19 @@
 (The `lines' figures total .c, .h, .l, and .y files under version control.)
 
 * Changed the logging logic along lines suggested by Jan Klaverstijn,
+* fetchmauilconf looks first in the directory it's running from to find
+  fetchmail.
+* Make sure we vet a success status correctly from open_smtp_sink()
+  and open_bsmtp_sink().
+* Matthias Andree's env.c patch to refuse service when QMAILINJECT is defined.
+* Immediately abort if a non-empty QMAILINJECT environment variable is
+  found. If it is set and contains f or i, qmail-inject or qmail's
+  sendmail `compatibility' wrapper will rewrite From: or Message-ID:
+  headers, respectively. En passant, fix the bug that program_name was
+  not filled in before used when the user's ID had no PW entry, leading
+  to (null) or crash when printing the error message. Patch by Matthias
+  Andree.
+* NextStep and OpenStep port patch from Eric Sunshine.
 
 fetchmail-5.9.4 (Wed Oct  3 07:47:45 EDT 2001), 21104 lines:
 
index f8f8058bbfbeab9b02352d11ddd3a60f1fc69b26..cd5caca56bfcdfa811fd28146f9f1bcb1f312b4a 100644 (file)
@@ -48,7 +48,7 @@ static int is_ip_alias(const char *name1,const char *name2)
     struct hostent *hp;
     char **p;
  
-    hp = gethostbyname(name1);
+    hp = gethostbyname((char*)name1);
  
     dummy_addr = (address_e *)NULL;
 
@@ -63,7 +63,7 @@ static int is_ip_alias(const char *name1,const char *name2)
        dummy_addr = host_a_addr;
     }
 
-    hp = gethostbyname(name2);
+    hp = gethostbyname((char*)name2);
 
     dummy_addr = (address_e *)NULL;
     for (i=0,p = hp->h_addr_list; *p != 0; i++,p++)
@@ -161,7 +161,7 @@ int is_host_alias(const char *name, struct query *ctl)
      * delivering the current message or anything else from the
      * current server until it's back up.
      */
-    if ((he = gethostbyname(name)) != (struct hostent *)NULL)
+    if ((he = gethostbyname((char*)name)) != (struct hostent *)NULL)
     {
        if (strcasecmp(ctl->server.truename, he->h_name) == 0)
            goto match;
diff --git a/env.c b/env.c
index f83c0f02e84d39317290d64336f0d1d729d5d727..93651a447d193a34920e74daade3240cb13a158c 100644 (file)
--- a/env.c
+++ b/env.c
@@ -49,6 +49,23 @@ void envquery(int argc, char **argv)
        }
     }
 
+    if ((program_name = strrchr(argv[0], '/')) != NULL)
+       ++program_name;
+    else
+       program_name = argv[0];
+
+    if (getenv("QMAILINJECT") && strcmp(getenv("QMAILINJECT"), ""))
+    {
+       fprintf(stderr,
+               GT_("%s: The QMAILINJECT environment variable is set.\n"
+                   "This is dangerous as it can make qmail-inject or qmail's sendmail wrapper\n"  
+                   "tamper with your From: or Message-ID: headers.\n"
+                   "Try \"env QMAILINJECT= %s YOUR ARGUMENTS HERE\"\n"
+                   "%s: Abort.\n"), 
+               program_name, program_name, program_name);
+       exit(PS_UNDEFINED);
+    }
+
     if (!(pwp = getpwuid(getuid())))
     {
        fprintf(stderr,
@@ -85,11 +102,6 @@ void envquery(int argc, char **argv)
     if (!(fmhome = getenv("FETCHMAILHOME")))
        fmhome = home;
 
-    if ((program_name = strrchr(argv[0], '/')) != NULL)
-       ++program_name;
-    else
-       program_name = argv[0];
-
 #define RCFILE_NAME    "fetchmailrc"
     /*
      * The (fmhome==home) leaves an extra character for a . at the
diff --git a/etrn.c b/etrn.c
index 8912513e5135e15de1ff17670d8badcc2d7d9fef..00455fafb62bc8737f888dd056a8f23668ad5ecc 100644 (file)
--- a/etrn.c
+++ b/etrn.c
@@ -71,18 +71,18 @@ static int etrn_getrange(int sock, struct query *ctl, const char *id,
        switch(atoi(buf))
        {
        case 250:       /* OK, queuing for node <x> started */
-           if (outlevel >= O_SILENT)
+           if (outlevel > O_SILENT)
                report(stdout, GT_("Queuing for %s started\n"), qnp->id);
            break;
 
        case 251:       /* OK, no messages waiting for node <x> */
-           if (outlevel >= O_SILENT)
+           if (outlevel > O_SILENT)
                report(stdout, GT_("No messages waiting for %s\n"), qnp->id);
            return(PS_NOMAIL);
 
        case 252:       /* OK, pending messages for node <x> started */
        case 253:       /* OK, <n> pending messages for node <x> started */
-           if (outlevel >= O_SILENT)
+           if (outlevel > O_SILENT)
                report(stdout, GT_("Pending messages for %s started\n"), qnp->id);
            break;
 
index 50b9ffb646dd8ccbdada5de558282837de9ae711..db64b9ffd62047a51489a5dfd7ee4befe79348b8 100644 (file)
@@ -10,7 +10,7 @@
 <table width="100%" cellpadding=0><tr>
 <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a>
 <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a>
-<td width="30%" align=right>$Date: 2001/10/13 04:51:50 $
+<td width="30%" align=right>$Date: 2001/11/08 16:53:52 $
 </table>
 <HR>
 <H1>Frequently Asked Questions About Fetchmail</H1>
@@ -1609,6 +1609,10 @@ Fetchmail normally uses TOP for message retrieval in order to avoid
 marking messages seen, but `<CODE>fetchall</CODE>' forces it to use
 RETR instead.
 
+<p>Also, we're told USA.NET adds a ton of hops to your messages.  You may
+need to raise the MaxHopCount parameter in your sendmail.cf to avoid having
+fetched mail rejected.
+
 <p>(Note: Other failure modes have been reported on usa.net's servers.
 They seem to be chronically flaky.  We recommend finding another
 provider.)
@@ -2921,7 +2925,7 @@ date from the last Received header.<p>
 <table width="100%" cellpadding=0><tr>
 <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a>
 <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a>
-<td width="30%" align=right>$Date: 2001/10/13 04:51:50 $
+<td width="30%" align=right>$Date: 2001/11/08 16:53:52 $
 </table>
 
 <ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com">&lt;esr@thyrsus.com&gt;</A></ADDRESS>
index 1380ee9536a9b505fa65c2fb71ef833fd10fc583..463446275773c0e51f05ffc7b73cddfe51eed598 100644 (file)
@@ -540,7 +540,7 @@ char *xstrdup(const char *);
 #endif
 #define        xalloca(ptr, t, n)      if (!(ptr = (t) alloca(n)))\
        {report(stderr, GT_("alloca failed")); exit(PS_UNDEFINED);}
-#if FALSE
+#if 0
 /*
  * This is a hack to help xgettext which cannot find strings in
  * macro definitions like the one for xalloca above.
index 18c81fd8cb50b6c416e665546ec26a89b16515f5..f049a04c158f01905ae63b1668cc5a9b2a8ab93e 100755 (executable)
@@ -1770,10 +1770,10 @@ class RunWindow(Frame):
 
        self.update()   # Draw widget before executing fetchmail
 
-       # Always look for a runnable command in the current directory first.
-       # This avoids some obscure version-skew errors that can occur if you 
-       # pick up an old fetchmail from the standard system locations.
-       os.environ["PATH"] = ".:" + os.environ["PATH"]
+       # Always look for a runnable command in the directory we're running in
+        # first. This avoids some obscure version-skew errors that can occur
+       # if you pick up an old fetchmail from the standard system locations.
+       os.environ["PATH"] = os.path.dirname(sys.argv[0]) + ":" + os.environ["PATH"]
        child_stdout = os.popen(command + " 2>&1", "r")
        while 1:
            ch = child_stdout.read(1)
diff --git a/imap.c b/imap.c
index 2ee7759ef6053c7d3e26e7fadf458f65c22eb508..9a22a37c5111ff40547176c675a2c68eb374b434 100644 (file)
--- a/imap.c
+++ b/imap.c
@@ -181,7 +181,7 @@ static int do_imap_ntlm(int sock, struct query *ctl)
     if ((gen_recv(sock, msgbuf, sizeof msgbuf)))
        return result;
   
-    len = from64tobits ((unsigned char*)&challenge, msgbuf);
+    len = from64tobits ((unsigned char*)&challenge, msgbuf, sizeof(msgbuf));
     
     if (outlevel >= O_DEBUG)
        dumpSmbNtlmAuthChallenge(stdout, &challenge);
index a6d97758beb49ab22ccb3b265eb0ffaa31b074e9..3254873de853113839cd66db9eba97cd4aa6431f 100644 (file)
@@ -208,7 +208,7 @@ int do_rfc1731(int sock, char *command, char *truename)
      * process is complete.
      */
 
-    len = from64tobits(buf2, buf1, sizeof(buf2x));
+    len = from64tobits(buf2, buf1, sizeof(buf2));
     if (len < 0) {
        report(stderr, GT_("could not decode BASE64 ready response\n"));
        return PS_AUTHFAIL;
diff --git a/sink.c b/sink.c
index a72be53a33b69ae2c999f9306ae70a9cbbc09916..e0b904e63c9673ec713fef948c6a76655eac0468 100644 (file)
--- a/sink.c
+++ b/sink.c
@@ -793,6 +793,8 @@ static int open_smtp_sink(struct query *ctl, struct msgblk *msg,
        SMTP_rset(ctl->smtp_socket);    /* stay on the safe side */
        return(handle_smtp_report(ctl, msg));
     }
+
+    return(PS_SUCCESS);
 }
 
 static int open_mda_sink(struct query *ctl, struct msgblk *msg,
@@ -951,13 +953,15 @@ static int open_mda_sink(struct query *ctl, struct msgblk *msg,
      * error status instead of 0 for successful completion.
      */
 #ifndef HAVE_SIGACTION
-    sigchld = signal(SIGCHLD, SIG_DFL);
+    signal(SIGCHLD, SIG_DFL);
 #else
     memset (&sa_new, 0, sizeof sa_new);
     sigemptyset (&sa_new.sa_mask);
     sa_new.sa_handler = SIG_DFL;
     sigaction (SIGCHLD, &sa_new, NULL);
 #endif /* HAVE_SIGACTION */
+
+    return(PS_SUCCESS);
 }
 
 int open_sink(struct query *ctl, struct msgblk *msg,
index c108b9b28e77efe2661413aaca564681586c673a..93a2be2f837e8482e86e322745db96d02ccc2434 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -340,7 +340,7 @@ int SockOpen(const char *host, int clientPort, const char *options,
 
     /* we'll accept a quad address */
 #ifndef HAVE_INET_ATON
-    inaddr = inet_addr(host);
+    inaddr = inet_addr((char*)host);
     if (inaddr != INADDR_NONE)
     {
         memcpy(&ad.sin_addr, &inaddr, sizeof(inaddr));
@@ -370,7 +370,7 @@ int SockOpen(const char *host, int clientPort, const char *options,
     }
 #endif /* HAVE_INET_ATON */
     else {
-        hp = gethostbyname(host);
+        hp = gethostbyname((char*)host);
 
         if (hp == NULL)
        {
index 73629a63eddd162cb3e58f3975edfc9f0a466c32..638ccd6ec286c03ba01fa9f404cf27d959f19fc2 100644 (file)
@@ -549,7 +549,7 @@ int readheaders(int sock,
            {
                if (ctl->lastid)
                    free(ctl->lastid);
-               ctl->lastid = strdup(line);
+               ctl->lastid = xstrdup(line);
            }
        }
 
index 2bb4e4eddefff5cfd79188afd959818bc6b2daa2..812b551418a59a7fd911702cb2cf605ac34165de 100644 (file)
--- a/xalloca.c
+++ b/xalloca.c
@@ -41,7 +41,7 @@ int n;
     p = (XALLOCATYPE *) alloca(n);
     if (p == (XALLOCATYPE *) 0)
     {
-       report(stderr, "alloca failed\n");
+       report(stderr, GT_("alloca failed\n"));
        exit(PS_UNDEFINED);
     }
     return(p);