be sure to open a new transcript on every queue run; when returning
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 9 Jan 1983 05:49:08 +0000 (21:49 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 9 Jan 1983 05:49:08 +0000 (21:49 -0800)
an SMTP transcript, only send the last half (i.e., that part which
describes the sending half).

SCCS-mr: usr.sbin/sendmail/src/version.c 142
SCCS-vsn: usr.sbin/sendmail/src/queue.c 3.68
SCCS-vsn: usr.sbin/sendmail/src/envelope.c 3.6
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 3.43
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.291

usr/src/usr.sbin/sendmail/src/envelope.c
usr/src/usr.sbin/sendmail/src/queue.c
usr/src/usr.sbin/sendmail/src/srvrsmtp.c
usr/src/usr.sbin/sendmail/src/version.c

index 1648354..fa16021 100644 (file)
@@ -3,7 +3,7 @@
 #include "sendmail.h"
 #include <sys/stat.h>
 
 #include "sendmail.h"
 #include <sys/stat.h>
 
-SCCSID(@(#)envelope.c  3.5             %G%);
+SCCSID(@(#)envelope.c  3.6             %G%);
 
 /*
 **  NEWENVELOPE -- allocate a new envelope
 
 /*
 **  NEWENVELOPE -- allocate a new envelope
@@ -138,13 +138,12 @@ dropenvelope(e)
                queueup(e, FALSE, FALSE);
 
        /* now unlock the job */
                queueup(e, FALSE, FALSE);
 
        /* now unlock the job */
-       if (e->e_xfp != NULL)
-               (void) fclose(e->e_xfp);
+       closexscript(e);
        unlockqueue(e);
 
        /* make sure that this envelope is marked unused */
        e->e_id = e->e_df = NULL;
        unlockqueue(e);
 
        /* make sure that this envelope is marked unused */
        e->e_id = e->e_df = NULL;
-       e->e_dfp = e->e_xfp = NULL;
+       e->e_dfp = NULL;
 }
 \f/*
 **  CLEARENVELOPE -- clear an envelope without unlocking
 }
 \f/*
 **  CLEARENVELOPE -- clear an envelope without unlocking
@@ -197,6 +196,10 @@ unlockqueue(e)
 {
        /* remove the transcript */
 #ifdef DEBUG
 {
        /* remove the transcript */
 #ifdef DEBUG
+# ifdef LOG
+       if (LogLevel > 19)
+               syslog(LOG_DEBUG, "%s: unlock", e->e_id);
+# endif LOG
        if (!tTd(51, 4))
 #endif DEBUG
                xunlink(queuename(e, 'x'));
        if (!tTd(51, 4))
 #endif DEBUG
                xunlink(queuename(e, 'x'));
@@ -396,6 +399,10 @@ queuename(e, type)
 # ifdef DEBUG
                if (tTd(7, 1))
                        printf("queuename: assigned id %s, env=%x\n", e->e_id, e);
 # ifdef DEBUG
                if (tTd(7, 1))
                        printf("queuename: assigned id %s, env=%x\n", e->e_id, e);
+# ifdef LOG
+               if (LogLevel > 16)
+                       syslog(LOG_DEBUG, "%s: assigned id", e->e_id);
+# endif LOG
 # endif DEBUG
        }
 
 # endif DEBUG
        }
 
@@ -429,6 +436,10 @@ openxscript(e)
 {
        register char *p;
 
 {
        register char *p;
 
+# ifdef LOG
+       if (LogLevel > 19)
+               syslog(LOG_DEBUG, "%s: openx%s", e->e_id, e->e_xfp == NULL ? "" : " (no)");
+# endif LOG
        if (e->e_xfp != NULL)
                return;
        p = queuename(e, 'x');
        if (e->e_xfp != NULL)
                return;
        p = queuename(e, 'x');
@@ -439,6 +450,27 @@ openxscript(e)
                (void) chmod(p, 0644);
 }
 \f/*
                (void) chmod(p, 0644);
 }
 \f/*
+**  CLOSEXSCRIPT -- close the transcript file.
+**
+**     Parameters:
+**             e -- the envelope containing the transcript to close.
+**
+**     Returns:
+**             none.
+**
+**     Side Effects:
+**             none.
+*/
+
+closexscript(e)
+       register ENVELOPE *e;
+{
+       if (e->e_xfp == NULL)
+               return;
+       (void) fclose(e->e_xfp);
+       e->e_xfp = NULL;
+}
+\f/*
 **  SETSENDER -- set the person who this message is from
 **
 **     Under certain circumstances allow the user to say who
 **  SETSENDER -- set the person who this message is from
 **
 **     Under certain circumstances allow the user to say who
index 9e3ab60..30cef19 100644 (file)
@@ -5,10 +5,10 @@
 # include <errno.h>
 
 # ifndef QUEUE
 # include <errno.h>
 
 # ifndef QUEUE
-SCCSID(@(#)queue.c     3.67            %G%     (no queueing));
+SCCSID(@(#)queue.c     3.68            %G%     (no queueing));
 # else QUEUE
 
 # else QUEUE
 
-SCCSID(@(#)queue.c     3.67            %G%);
+SCCSID(@(#)queue.c     3.68            %G%);
 
 /*
 **  Work queue.
 
 /*
 **  Work queue.
@@ -474,6 +474,7 @@ dowork(w)
 
                /* set basic modes, etc. */
                (void) alarm(0);
 
                /* set basic modes, etc. */
                (void) alarm(0);
+               closexscript(CurEnv);
                CurEnv->e_flags &= ~EF_FATALERRS;
                QueueRun = TRUE;
                ErrorMode = EM_MAIL;
                CurEnv->e_flags &= ~EF_FATALERRS;
                QueueRun = TRUE;
                ErrorMode = EM_MAIL;
index bcdd4b8..9a41227 100644 (file)
@@ -2,10 +2,10 @@
 # include "sendmail.h"
 
 # ifndef SMTP
 # include "sendmail.h"
 
 # ifndef SMTP
-SCCSID(@(#)srvrsmtp.c  3.42            %G%     (no SMTP));
+SCCSID(@(#)srvrsmtp.c  3.43            %G%     (no SMTP));
 # else SMTP
 
 # else SMTP
 
-SCCSID(@(#)srvrsmtp.c  3.42            %G%);
+SCCSID(@(#)srvrsmtp.c  3.43            %G%);
 
 /*
 **  SMTP -- run the SMTP protocol.
 
 /*
 **  SMTP -- run the SMTP protocol.
@@ -227,6 +227,10 @@ smtp()
                        **      In any case, don't mail back errors for
                        **              anything that has happened up to
                        **              now (the other end will do this).
                        **      In any case, don't mail back errors for
                        **              anything that has happened up to
                        **              now (the other end will do this).
+                       **      Truncate our transcript -- the mail has gotten
+                       **              to us successfully, and if we have
+                       **              to mail this back, it will be easier
+                       **              on the reader.
                        **      Then send to everyone.
                        **      Finally give a reply code.  If an error has
                        **              already been given, don't mail a
                        **      Then send to everyone.
                        **      Finally give a reply code.  If an error has
                        **              already been given, don't mail a
@@ -240,6 +244,7 @@ smtp()
                                ErrorMode == EM_MAIL;
                        }
                        CurEnv->e_flags &= ~EF_FATALERRS;
                                ErrorMode == EM_MAIL;
                        }
                        CurEnv->e_flags &= ~EF_FATALERRS;
+                       CurEnv->e_xfp = freopen(queuename(CurEnv, 'x'), "w", CurEnv->e_xfp);
 
                        /* send to all recipients */
                        sendall(CurEnv, SendMode);
 
                        /* send to all recipients */
                        sendall(CurEnv, SendMode);
index 5c43650..223a05d 100644 (file)
@@ -1,5 +1,5 @@
 # ifndef lint
 # ifndef lint
-static char    SccsId[] = "@(#)SendMail version 3.290 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.291 of %G%";
 # endif lint
 
 # endif lint
 
-char   Version[] = "3.290 [%G%]";
+char   Version[] = "3.291 [%G%]";