]> Pileus Git - ~andy/fetchmail/commitdiff
Various cleanup patches.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 9 Apr 2002 00:04:05 +0000 (00:04 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 9 Apr 2002 00:04:05 +0000 (00:04 -0000)
svn path=/trunk/; revision=3612

Makefile.in
NEWS
acconfig.h
configure.in
driver.c
fetchmail.h
odmr.c
smtp.c

index 05b083ac73674ec2f85dd255bad86a3cb700f07b..e479b9aedbe296a99fa29d5ef846a64c8701e145 100644 (file)
@@ -4,7 +4,7 @@
 # So just uncomment all the lines marked QNX.
 
 PACKAGE = fetchmail
-VERSION = 5.9.11
+VERSION = 6.0.0
 
 # Ultrix 2.2 make doesn't expand the value of VPATH.
 srcdir = @srcdir@
@@ -44,9 +44,6 @@ defines = $(DEFS)
 LOADLIBS = @LIBS@ @INTLLIBS@ @LEXLIB@
 # LOADLIBS = -lsocket3r -lunix3r       # QNX
 
-# Any extra object files your system needs.
-extras = @LIBOBJS@
-
 # Extra sources/objects for library functions not provided on the host system.
 EXTRASRC = @EXTRASRC@
 # EXTRASRC = $(srcdir)/strcasecmp.c $(srcdir)/alloca.c # QNX
@@ -98,7 +95,7 @@ protobjs = rcfile_y.o rcfile_l.o socket.o getpass.o pop2.o pop3.o imap.o \
        report.o unmime.o conf.o checkalias.o smbdes.o smbencrypt.o smbmd4.o \
        smbutil.o ipv6-connect.o lock.o
 
-objs = $(protobjs) $(extras) $(EXTRAOBJ)
+objs = $(protobjs) $(EXTRAOBJ)
 
 srcs = $(srcdir)/socket.c $(srcdir)/getpass.c $(srcdir)/pop2.c                 \
        $(srcdir)/pop3.c $(srcdir)/imap.c $(srcdir)/etrn.c              \
diff --git a/NEWS b/NEWS
index b0ad61a03cef69dd0d7992ad522a3f17f1a68662..92fa20626b8c9bddf5e5a4ab8ed48c18ca434cb4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@
 
 (The `lines' figures total .c, .h, .l, and .y files under version control.)
 
+* Brian Grayson's patch enabling compilation under AIX 4.1.
+* Federico G. Schwindt's patch to support BSD ELF systems.
+* Fix to Sunil Shetye's attributes patch.
+* Scott Bronson's patch to reap zombies after an MDA core dump.
+* New Japanese translation file.
+
 fetchmail-5.9.11 (Mon Apr  1 17:09:13 EST 2002), 21597 lines:
 
 * Updated Turkish and Japanese translations.
index 1c0a046d8ff51ef95540add240e1656abf510fce..7fd0753ee439613fadf1b63ee2c701a0e03be09f 100644 (file)
@@ -18,9 +18,6 @@
 /* Define as 1 if you have catgets and don't want to use GNU gettext.  */
 #undef HAVE_CATGETS
 
-/* Define if you have GNU's getopt family of functions.  */
-#undef HAVE_GETOPT_LONG
-
 /* Define as 1 if you have gettext and don't want to use GNU gettext.  */
 #undef HAVE_GETTEXT
 
index 3b4d11dc9347a628ad5d9bfd28e9eec32d6d893d..63aa3931044d08f9f67660b3602a09ad97afcc9a 100644 (file)
@@ -40,7 +40,6 @@ AC_PROG_YACC
 AC_SUBST(CPFLAGS)
 AC_SUBST(CEFLAGS)
 AC_SUBST(LDEFLAGS)
-AC_SUBST(LIBOBJS)
 
 # Check for LynxOS special case: -lbsd needed (at least on 2.3.0) and -s
 # not working.
@@ -411,7 +410,7 @@ then
   AC_DEFINE(HEIMDAL)
   AC_DEFINE(KERBEROS_V5)
   CEFLAGS="$CEFLAGS -I/usr/include/kerberosV"
-  LIBS="$LIBS -lasn1 -lkrb5 -lcom_err"
+  LIBS="$LIBS -lasn1 -lkrb5 -lcom_err -lkafs"
 else
   if test "$with_kerberos5" != "yes" 
   then
index b11d75365df226d9e547de211fed978d1c35cb01..2eda23ef0dd639857297990161506882ca7a1f9d 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -25,6 +25,9 @@
 #endif
 #include  <sys/time.h>
 #include  <signal.h>
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
 
 #ifdef HAVE_NET_SOCKET_H
 #include <net/socket.h>
@@ -753,6 +756,7 @@ const int maxfetch;         /* maximum number of messages to fetch */
            signal(SIGPIPE, SIG_IGN);
            report(stdout,
                   GT_("SIGPIPE thrown from an MDA or a stream socket error\n"));
+           wait(0);
            err = PS_SOCKET;
            goto cleanUp;
        }
index a3bf49132da78acdc3aab787948684c9abfd29e9..a2e7b10a43799317b464bdef6f7a4e3a1b519278 100644 (file)
@@ -393,7 +393,7 @@ extern char *sdps_envto;
 
 /* from /usr/include/sys/cdefs.h */
 #if !defined __GNUC__ || __GNUC__ < 2
-# define __attribute__(xyz)ยป    /* Ignore. */
+# define __attribute__(xyz)    /* Ignore. */
 #endif
 
 /* error.c: Error reporting */
diff --git a/odmr.c b/odmr.c
index 3dcb3e627d2a99a2d2c8e2413a6189d201207a8e..76891681a95943baccef2d0578a004c8ea242959 100644 (file)
--- a/odmr.c
+++ b/odmr.c
@@ -20,6 +20,9 @@
 #ifdef HAVE_NET_SELECT_H /* AIX needs this */
 #include <net/select.h>
 #endif
+#ifdef HAVE_SYS_SELECT_H /* AIX 4.1, at least, needs this */
+#include  <sys/select.h>
+#endif
 #include  <netdb.h>
 #include  <errno.h>
 #include  <unistd.h>
diff --git a/smtp.c b/smtp.c
index 618b294d0f9fc1ee75a88c90737316dff6153457..021c868c66a7566d0d17885c199f8c06bfc34258 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -57,21 +57,29 @@ int SMTP_helo(int sock,const char *host)
   return ok;
 }
 
+static void SMTP_auth_error(int sock, char *msg)
+{
+    SockPrintf(sock, "*\r\n");
+    SockRead(sock, smtp_response, sizeof(smtp_response) - 1);
+    if (outlevel >= O_MONITOR) report(stdout, msg);
+}
+
 static void SMTP_auth(int sock, char *username, char *password, char *buf)
 /* ESMTP Authentication support for fetchmail by Wojciech Polak */
-{
+{      
        int c;
        char *p = 0;
        char b64buf[512];
        char tmp[512];
 
+       if (!username || !password) return;
+
        memset(b64buf, 0, sizeof(b64buf));
        memset(tmp, 0, sizeof(tmp));
 
        if (strstr(buf, "CRAM-MD5")) {
                unsigned char digest[16];
-               static char ascii_digest[33];
-               memset(digest, 0, 16);
+               memset(digest, 0, sizeof(digest));
 
                if (outlevel >= O_MONITOR)
                        report(stdout, GT_("ESMTP CRAM-MD5 Authentication...\n"));
@@ -80,28 +88,31 @@ static void SMTP_auth(int sock, char *username, char *password, char *buf)
                strncpy(tmp, smtp_response, sizeof(tmp));
 
                if (strncmp(tmp, "334 ", 4)) { /* Server rejects AUTH */
-                       SockPrintf(sock, "*\r\n");
-                       SockRead(sock, smtp_response, sizeof(smtp_response) - 1);
-                       if (outlevel >= O_MONITOR)
-                               report(stdout, GT_("Server rejected the AUTH command.\n"));
+                       SMTP_auth_error(sock, GT_("Server rejected the AUTH command.\n"));
                        return;
                }
 
                p = strchr(tmp, ' ');
                p++;
-               from64tobits(b64buf, p, sizeof(b64buf));
+               /* (hmh) from64tobits will not NULL-terminate strings! */
+               if (from64tobits(b64buf, p, sizeof(b64buf) - 1) <= 0) {
+                       SMTP_auth_error(sock, GT_("Bad base64 reply from server.\n"));
+                       return;
+               }
                if (outlevel >= O_DEBUG)
                        report(stdout, GT_("Challenge decoded: %s\n"), b64buf);
                hmac_md5(password, strlen(password),
-                                b64buf, strlen(b64buf), digest, sizeof(digest));
-               for (c = 0; c < 16; c++)
-                       sprintf(ascii_digest + 2 * c, "%02x", digest[c]);
+                        b64buf, strlen(b64buf), digest, sizeof(digest));
 #ifdef HAVE_SNPRINTF
                snprintf(tmp, sizeof(tmp),
 #else
                sprintf(tmp,
 #endif /* HAVE_SNPRINTF */
-               "%s %s", username, ascii_digest);
+               "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+               username,  digest[0], digest[1], digest[2], digest[3],
+               digest[4], digest[5], digest[6], digest[7], digest[8],
+               digest[9], digest[10], digest[11], digest[12], digest[13],
+               digest[14], digest[15]);
 
                to64frombits(b64buf, tmp, strlen(tmp));
                SockPrintf(sock, "%s\r\n", b64buf);
@@ -136,23 +147,31 @@ static void SMTP_auth(int sock, char *username, char *password, char *buf)
                strncpy(tmp, smtp_response, sizeof(tmp));
 
                if (strncmp(tmp, "334 ", 4)) { /* Server rejects AUTH */
-                       SockPrintf(sock, "*\r\n");
-                       SockRead(sock, smtp_response, sizeof(smtp_response) - 1);
-                       if (outlevel >= O_MONITOR)
-                               report(stdout, GT_("Server rejected the AUTH command.\n"));
+                       SMTP_auth_error(sock, GT_("Server rejected the AUTH command.\n"));
                        return;
                }
 
                p = strchr(tmp, ' ');
                p++;
-               from64tobits(b64buf, p, sizeof(b64buf));
+               if (from64tobits(b64buf, p, sizeof(b64buf) - 1) <= 0) {
+                       SMTP_auth_error(sock, GT_("Bad base64 reply from server.\n"));
+                       return;
+               }
                to64frombits(b64buf, username, strlen(username));
                SockPrintf(sock, "%s\r\n", b64buf);
                SockRead(sock, smtp_response, sizeof(smtp_response) - 1);
                strncpy(tmp, smtp_response, sizeof(tmp));
                p = strchr(tmp, ' ');
+               if (!p) {
+                       SMTP_auth_error(sock, GT_("Bad base64 reply from server.\n"));
+                       return;
+               }
                p++;
-               from64tobits(b64buf, p, sizeof(b64buf));
+               memset(b64buf, 0, sizeof(b64buf));
+               if (from64tobits(b64buf, p, sizeof(b64buf) - 1) <= 0) {
+                       SMTP_auth_error(sock, GT_("Bad base64 reply from server.\n"));
+                       return;
+               }
                to64frombits(b64buf, password, strlen(password));
                SockPrintf(sock, "%s\r\n", b64buf);
                SMTP_ok(sock);
@@ -164,7 +183,7 @@ int SMTP_ehlo(int sock, const char *host, char *name, char *password, int *opt)
 /* send a "EHLO" message to the SMTP listener, return extension status bits */
 {
   struct opt *hp;
-  char auth_response[256];
+  char auth_response[511];
 
   SockPrintf(sock,"%cHLO %s\r\n", (smtp_mode == 'S') ? 'E' : smtp_mode, host);
   if (outlevel >= O_MONITOR)