put the SMTP and queueing code on compilation flags so that sendmail
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 6 Dec 1981 03:54:23 +0000 (19:54 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 6 Dec 1981 03:54:23 +0000 (19:54 -0800)
will fit on non-ID PDP-11's (ugh); put the ugly UUCP hack on a
compilation flag also to emphasize that it sucks eggs; makefile
cleanup.

SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.40
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.59
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.68
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.56
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 3.11
SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 3.6
SCCS-vsn: usr.sbin/sendmail/src/queue.c 3.7

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/queue.c
usr/src/usr.sbin/sendmail/src/srvrsmtp.c
usr/src/usr.sbin/sendmail/src/usersmtp.c
usr/src/usr.sbin/sendmail/src/version.c

index 12a80a4..72f0ed5 100644 (file)
@@ -36,7 +36,7 @@
 
 
 
 
 
 
-static char SccsId[] = "@(#)conf.c     3.39    %G%";
+static char SccsId[] = "@(#)conf.c     3.40    %G%";
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
@@ -90,7 +90,11 @@ char *AliasFile =    "/usr/lib/aliases";     /* alias file */
 char   *ConfFile =     "/usr/lib/sendmail.cf"; /* runtime configuration */
 char   *StatFile =     "/usr/lib/sendmail.st"; /* statistics summary */
 char   *HelpFile =     "/usr/lib/sendmail.hf"; /* help file */
 char   *ConfFile =     "/usr/lib/sendmail.cf"; /* runtime configuration */
 char   *StatFile =     "/usr/lib/sendmail.st"; /* statistics summary */
 char   *HelpFile =     "/usr/lib/sendmail.hf"; /* help file */
+# ifdef QUEUE
 char   *QueueDir =     "/usr/spool/mqueue";    /* queue of saved mail */
 char   *QueueDir =     "/usr/spool/mqueue";    /* queue of saved mail */
+# else QUEUE
+char   *QueueDir =     "/tmp";                 /* location of temp files */
+# endif QUEUE
 char   *XcriptFile =   "/tmp/mailxXXXXXX";     /* template for transcript */
 
 
 char   *XcriptFile =   "/tmp/mailxXXXXXX";     /* template for transcript */
 
 
index 1e04c29..d40c168 100644 (file)
@@ -6,7 +6,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-static char SccsId[] = "@(#)deliver.c  3.58    %G%";
+static char SccsId[] = "@(#)deliver.c  3.59    %G%";
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
@@ -135,15 +135,22 @@ deliver(firstto, editfcn)
        if (*mvp == NULL)
        {
                /* running SMTP */
        if (*mvp == NULL)
        {
                /* running SMTP */
+# ifdef SMTP
                clever = TRUE;
                *pvp = NULL;
                i = smtpinit(m, pv, (ADDRESS *) NULL);
                giveresponse(i, TRUE, m);
                clever = TRUE;
                *pvp = NULL;
                i = smtpinit(m, pv, (ADDRESS *) NULL);
                giveresponse(i, TRUE, m);
+# ifdef QUEUE
                if (i == EX_TEMPFAIL)
                {
                        QueueUp = TRUE;
                        tempfail = TRUE;
                }
                if (i == EX_TEMPFAIL)
                {
                        QueueUp = TRUE;
                        tempfail = TRUE;
                }
+# endif QUEUE
+# else SMTP
+               syserr("SMTP style mailer");
+               return (EX_SOFTWARE);
+# endif SMTP
        }
 
        /*
        }
 
        /*
@@ -277,17 +284,26 @@ deliver(firstto, editfcn)
 
                if (clever)
                {
 
                if (clever)
                {
+# ifdef SMTP
                        i = smtprcpt(to);
                        i = smtprcpt(to);
-                       if (i == EX_TEMPFAIL)
-                       {
-                               QueueUp = TRUE;
-                               to->q_flags |= QQUEUEUP;
-                       }
-                       else if (i != EX_OK)
+                       if (i != EX_OK)
                        {
                        {
-                               to->q_flags |= QBADADDR;
-                               giveresponse(i, TRUE, m);
+# ifdef QUEUE
+                               if (i == EX_TEMPFAIL)
+                               {
+                                       QueueUp = TRUE;
+                                       to->q_flags |= QQUEUEUP;
+                               }
+                               else
+# endif QUEUE
+                               {
+                                       to->q_flags |= QBADADDR;
+                                       giveresponse(i, TRUE, m);
+                               }
                        }
                        }
+# else SMTP
+                       syserr("trying to be clever");
+# endif SMTP
                }
                else
                {
                }
                else
                {
@@ -304,8 +320,10 @@ deliver(firstto, editfcn)
        /* see if any addresses still exist */
        if (tobuf[0] == '\0')
        {
        /* see if any addresses still exist */
        if (tobuf[0] == '\0')
        {
+# ifdef SMTP
                if (clever)
                        smtpquit(pv[0]);
                if (clever)
                        smtpquit(pv[0]);
+# endif SMTP
                return (0);
        }
 
                return (0);
        }
 
@@ -337,12 +355,14 @@ deliver(firstto, editfcn)
                editfcn = putmessage;
        if (ctladdr == NULL)
                ctladdr = &From;
                editfcn = putmessage;
        if (ctladdr == NULL)
                ctladdr = &From;
+# ifdef SMTP
        if (clever)
        {
                i = smtpfinish(m, editfcn);
                smtpquit(pv[0]);
        }
        else
        if (clever)
        {
                i = smtpfinish(m, editfcn);
                smtpquit(pv[0]);
        }
        else
+# endif SMTP
                i = sendoff(m, pv, editfcn, ctladdr);
 
        /*
                i = sendoff(m, pv, editfcn, ctladdr);
 
        /*
@@ -350,12 +370,14 @@ deliver(firstto, editfcn)
        **  addressees.
        */
 
        **  addressees.
        */
 
+# ifdef QUEUE
        if (i == EX_TEMPFAIL)
        {
                QueueUp = TRUE;
                for (to = tochain; to != NULL; to = to->q_tchain)
                        to->q_flags |= QQUEUEUP;
        }
        if (i == EX_TEMPFAIL)
        {
                QueueUp = TRUE;
                for (to = tochain; to != NULL; to = to->q_tchain)
                        to->q_flags |= QQUEUEUP;
        }
+# endif QUEUE
 
        errno = 0;
        return (i);
 
        errno = 0;
        return (i);
@@ -567,6 +589,7 @@ openmailer(m, pvp, ctladdr, clever, pmfile, prfile)
                return (-1);
        }
 
                return (-1);
        }
 
+# ifdef SMTP
        /* if this mailer speaks smtp, create a return pipe */
        if (clever && pipe(rpvect) < 0)
        {
        /* if this mailer speaks smtp, create a return pipe */
        if (clever && pipe(rpvect) < 0)
        {
@@ -575,6 +598,7 @@ openmailer(m, pvp, ctladdr, clever, pmfile, prfile)
                (void) close(mpvect[1]);
                return (-1);
        }
                (void) close(mpvect[1]);
                return (-1);
        }
+# endif SMTP
 
        DOFORK(XFORK);
        /* pid is set by DOFORK */
 
        DOFORK(XFORK);
        /* pid is set by DOFORK */
@@ -735,11 +759,13 @@ giveresponse(stat, force, m)
                if (Verbose)
                        message(Arpa_Info, statmsg);
        }
                if (Verbose)
                        message(Arpa_Info, statmsg);
        }
+# ifdef QUEUE
        else if (stat == EX_TEMPFAIL)
        {
                if (Verbose)
                        message(Arpa_Info, "transmission deferred");
        }
        else if (stat == EX_TEMPFAIL)
        {
                if (Verbose)
                        message(Arpa_Info, "transmission deferred");
        }
+# endif QUEUE
        else
        {
                Errors++;
        else
        {
                Errors++;
@@ -776,7 +802,9 @@ giveresponse(stat, force, m)
 # ifdef LOG
        syslog(LOG_INFO, "%s->%s: %ld: %s", From.q_paddr, To, MsgSize, statmsg);
 # endif LOG
 # ifdef LOG
        syslog(LOG_INFO, "%s->%s: %ld: %s", From.q_paddr, To, MsgSize, statmsg);
 # endif LOG
+# ifdef QUEUE
        if (stat != EX_TEMPFAIL)
        if (stat != EX_TEMPFAIL)
+# endif QUEUE
                setstat(stat);
 }
 \f/*
                setstat(stat);
 }
 \f/*
@@ -825,13 +853,15 @@ putmessage(fp, m, xdot)
 
        if (!bitset(M_NHDR, m->m_flags))
        {
 
        if (!bitset(M_NHDR, m->m_flags))
        {
-               register char *p = rindex(m->m_mailer, '/');
+# ifdef UGLYUUCP
+               char *p = rindex(m->m_mailer, '/');
 
                if (p != NULL && strcmp(p, "/uux") == 0 &&
                    strcmp(m->m_name, "uucp") == 0)
                        (void) expand("From $f  $d remote from $h", buf,
                                        &buf[sizeof buf - 1]);
                else
 
                if (p != NULL && strcmp(p, "/uux") == 0 &&
                    strcmp(m->m_name, "uucp") == 0)
                        (void) expand("From $f  $d remote from $h", buf,
                                        &buf[sizeof buf - 1]);
                else
+# endif UGLYUUCP
                        (void) expand("$l", buf, &buf[sizeof buf - 1]);
                fprintf(fp, "%s\n", buf);
        }
                        (void) expand("$l", buf, &buf[sizeof buf - 1]);
                fprintf(fp, "%s\n", buf);
        }
index 981161e..e0d96eb 100644 (file)
@@ -7,7 +7,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-static char    SccsId[] = "@(#)main.c  3.55    %G%";
+static char    SccsId[] = "@(#)main.c  3.56    %G%";
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
@@ -318,7 +318,11 @@ main(argc, argv)
                        if (p[2] == 's')
                        {
                                /* running smtp */
                        if (p[2] == 's')
                        {
                                /* running smtp */
+# ifdef SMTP
                                Smtp = TRUE;
                                Smtp = TRUE;
+# else SMTP
+                               syserr("I don't speak SMTP");
+# endif SMTP
                        }
                        break;
                
                        }
                        break;
                
@@ -339,8 +343,12 @@ main(argc, argv)
                        /* explicit fall-through */
 
                  case 'q':     /* run queue files at intervals */
                        /* explicit fall-through */
 
                  case 'q':     /* run queue files at intervals */
+# ifdef QUEUE
                        queuemode = TRUE;
                        QueueIntvl = atoi(&p[1]);
                        queuemode = TRUE;
                        QueueIntvl = atoi(&p[1]);
+# else QUEUE
+                       syserr("I don't know about queues");
+# endif QUEUE
                        break;
 
                  default:
                        break;
 
                  default:
@@ -410,14 +418,19 @@ main(argc, argv)
        if (Daemon)
                getrequests();
        
        if (Daemon)
                getrequests();
        
+# ifdef SMTP
        /*
        if (Smtp)
        {
        /*
        if (Smtp)
        {
+# ifdef QUEUE
                if (queuemode)
                        runqueue(TRUE);
                if (queuemode)
                        runqueue(TRUE);
+# endif QUEUE
                smtp();
        }
                smtp();
        }
+# endif SMTP
 
 
+# ifdef QUEUE
        /*
        **  If collecting stuff from the queue, go start doing that.
        */
        /*
        **  If collecting stuff from the queue, go start doing that.
        */
@@ -427,6 +440,7 @@ main(argc, argv)
                runqueue(FALSE);
                finis();
        }
                runqueue(FALSE);
                finis();
        }
+# endif QUEUE
 
        /*
        **  Set the sender
 
        /*
        **  Set the sender
@@ -632,7 +646,13 @@ finis()
        if (Transcript != NULL)
                (void) unlink(Transcript);
        if (QueueUp)
        if (Transcript != NULL)
                (void) unlink(Transcript);
        if (QueueUp)
+       {
+# ifdef QUEUE
                queueup(InFileName);
                queueup(InFileName);
+# else QUEUE
+               syserr("finis: trying to queue %s", InFileName);
+# endif QUEUE
+       }
        else
                (void) unlink(InFileName);
        exit(ExitStat);
        else
                (void) unlink(InFileName);
        exit(ExitStat);
index a7ea602..4194d6d 100644 (file)
@@ -4,7 +4,11 @@
 # include <signal.h>
 # include <errno.h>
 
 # include <signal.h>
 # include <errno.h>
 
-static char    SccsId[] =      "@(#)queue.c    3.6     %G%";
+# ifndef QUEUE
+static char    SccsId[] =      "@(#)queue.c    3.7     %G%     (no queueing)";
+# else QUEUE
+
+static char    SccsId[] =      "@(#)queue.c    3.7     %G%";
 
 /*
 **  QUEUEUP -- queue a message up for future transmission.
 
 /*
 **  QUEUEUP -- queue a message up for future transmission.
@@ -570,3 +574,5 @@ timeout(w)
        /* arrange to remove files from queue */
        QueueUp = FALSE;
 }
        /* arrange to remove files from queue */
        QueueUp = FALSE;
 }
+
+# endif QUEUE
index dcd130d..a78e0f9 100644 (file)
@@ -1,6 +1,10 @@
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-static char    SccsId[] =      "@(#)srvrsmtp.c 3.10    %G%";
+# ifndef SMTP
+static char    SccsId[] =      "@(#)srvrsmtp.c 3.11    %G%     (no SMTP)";
+# else SMTP
+
+static char    SccsId[] =      "@(#)srvrsmtp.c 3.11    %G%";
 
 /*
 **  SMTP -- run the SMTP protocol.
 
 /*
 **  SMTP -- run the SMTP protocol.
@@ -411,3 +415,5 @@ paddrtree(a)
                        message("550", "User unknown");
        }
 }
                        message("550", "User unknown");
        }
 }
+
+# endif SMTP
index 8ce7d87..8c5dce8 100644 (file)
@@ -3,7 +3,11 @@
 # include <sysexits.h>
 # include "sendmail.h"
 
 # include <sysexits.h>
 # include "sendmail.h"
 
-static char    SccsId[] =      "@(#)usersmtp.c 3.5     %G%";
+# ifndef SMTP
+static char    SccsId[] =      "@(#)usersmtp.c 3.6     %G%     (no SMTP)";
+# else SMTP
+
+static char    SccsId[] =      "@(#)usersmtp.c 3.6     %G%";
 
 /*
 **  SMTPINIT -- initialize SMTP.
 
 /*
 **  SMTPINIT -- initialize SMTP.
@@ -237,3 +241,5 @@ smtpmessage(f, a, b, c)
                fputs(buf, stdout);
        fputs(buf, SmtpOut);
 }
                fputs(buf, stdout);
        fputs(buf, SmtpOut);
 }
+
+# endif SMTP
index c0ed8f4..392bf4a 100644 (file)
@@ -1,3 +1,3 @@
-static char    SccsId[] = "@(#)SendMail version 3.67 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.68 of %G%";
 
 
-char   Version[] = "3.67 [%G%]";
+char   Version[] = "3.68 [%G%]";