Index: ChangeLog
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/ChangeLog,v
retrieving revision 1.289
retrieving revision 1.291
diff -u -r1.289 -r1.291
--- ChangeLog   1999/12/30 21:21:10     1.289
+++ ChangeLog   1999/12/31 00:37:57     1.291
@@ -1,3 +1,21 @@
+1999-12-31  Matti Aarnio  <[email protected]>
+
+       * Makefile.in:
+           Version 2.99.52-patch1
+
+       * transports/mailbox/mailbox.c:
+           Spotted lurking SFIO usage bug which caused
+           missing safe buffer zone newlines at the ends
+           of the mailbox stored messages.  At least
+           my MUTT seem to be a happy camper even with
+           this problem present, but perhaps not all
+           are so good..
+
+       * transports/libta/swriteheaders.c:
+           Missed reserving space for TAB-expansions in CHUNKING
+           mode operation of SMTP.  Only against other ZMailers,
+           and a few other rare systems..
+
1999-12-30  Matti Aarnio  <[email protected]>

       * Makefile.in:
Index: Makefile.in
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/Makefile.in,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- Makefile.in 1999/12/30 21:21:10     1.43
+++ Makefile.in 1999/12/31 00:37:57     1.44
@@ -2,7 +2,7 @@

MAJORVERSION = 2
MINORVERSION = 99
-PATCHLEVEL =   52
+PATCHLEVEL =   52-patch1

srcdir = @srcdir@
VPATH = @srcdir@
Index: transports/libta/swriteheaders.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/transports/libta/swriteheaders.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- transports/libta/swriteheaders.c    1999/12/30 20:03:57     1.4
+++ transports/libta/swriteheaders.c    1999/12/31 00:33:12     1.5
@@ -61,9 +61,9 @@

           if (*chunkbufp == NULL)
             /* Actually the SMTP has already malloced a block */
-             *chunkbufp = malloc(hsize+linelen+newlinelen);
+             *chunkbufp = malloc(hsize+linelen+tabsiz+newlinelen);
           else
-             *chunkbufp = realloc(*chunkbufp, hsize+linelen+newlinelen);
+             *chunkbufp = realloc(*chunkbufp, hsize+linelen+tabsiz+newlinelen);
           if (*chunkbufp == NULL) return -1;

           if (tabsiz) {
Index: transports/mailbox/mailbox.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/transports/mailbox/mailbox.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- transports/mailbox/mailbox.c        1999/12/30 20:44:06     1.72
+++ transports/mailbox/mailbox.c        1999/12/31 00:33:17     1.73
@@ -1836,7 +1836,7 @@

       fstat(fdmail, &st);

-       fp = sfnew(NULL, NULL, 16*1024, fdmail, SF_WRITE|SF_APPEND);
+       fp = sfnew(NULL, NULL, 64*1024, fdmail, SF_READ|SF_WRITE|SF_APPEND);
       if (fp == NULL) {
         notaryreport(NULL,NULL,NULL,NULL);
         DIAGNOSTIC3(rp, file, EX_TEMPFAIL, "cannot fdopen(%d,\"%s\")",
@@ -2023,6 +2023,9 @@
           goto time_reset;
         }

+if (verboselog)
+  fprintf(verboselog," end of putmail(file='%s'), topipe=%d\n",file,topipe);
+
       if (!topipe) {
         /*
          * Ok, we are NOT writing to a pipe, and thus we can do
@@ -2039,9 +2042,13 @@
          * login etc. can distinguish new mail from old.
          * The mtime will be set to now by the following write() calls.
          */
-         sfseek(fp, (off_t)-2, SEEK_END);
+         sfseek(fp, (Sfoff_t)-2LL, SEEK_END);
         len = sfread(fp, buf, 2);
-         sfseek(fp, (off_t)0, SEEK_END);       /* to end of file, again */
+         sfseek(fp, (Sfoff_t)0,    SEEK_END);
+         /* to end of file, again */
+
+if (verboselog)
+  fprintf(verboselog," .. EOF read did yield %d bytes\n", len);

         if (len == 1 || len == 2) {
           int err;
@@ -2049,6 +2056,9 @@
           len = (buf[len]!='\n') + (len == 1 ? buf[0]!='\n' : 1);
           err = (len > 0 && (sfwrite(fp, "\n\n", len) != len));
           sfsync(fp);
+
+if (verboselog)
+  fprintf(verboselog," .. wrote %d newlines to the end\n", len);

           if (!err) err = sferror(fp);
           if (err) {
Index: transports/smtp/smtp.c
===================================================================
RCS file: /home/mea/src/CVSROOT/zmailer/transports/smtp/smtp.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- transports/smtp/smtp.c      1999/12/30 15:36:50     1.116
+++ transports/smtp/smtp.c      1999/12/31 05:37:11     1.117
@@ -2161,6 +2161,7 @@
         if (! isreconnect) {

           /* For possible reconnect */
+           if (SS->ai.ai_canonname) free(SS->ai.ai_canonname);
           memcpy(&SS->ai, ai, sizeof(*ai));
           memset(&SS->ai_addr, 0, sizeof(SS->ai_addr));
           if (ai->ai_family == AF_INET)
@@ -2170,7 +2171,6 @@
             memcpy(&SS->ai_addr.v6, ai->ai_addr, sizeof(SS->ai_addr.v6));
#endif
           SS->ai.ai_addr = (struct sockaddr *) & SS->ai_addr;
-           if (SS->ai.ai_canonname) free(SS->ai.ai_canonname);
           SS->ai.ai_canonname = NULL;
           if (ai->ai_canonname)
             SS->ai.ai_canonname = strdup(ai->ai_canonname);