convert to SMTP draft 3
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 22 Nov 1981 01:58:13 +0000 (17:58 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 22 Nov 1981 01:58:13 +0000 (17:58 -0800)
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.54
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 3.8
SCCS-vsn: usr.sbin/sendmail/src/sendmail.hf 3.2
SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 3.5

usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/sendmail.hf
usr/src/usr.sbin/sendmail/src/srvrsmtp.c
usr/src/usr.sbin/sendmail/src/usersmtp.c

index e1930fc..a0043f0 100644 (file)
@@ -6,7 +6,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-static char SccsId[] = "@(#)deliver.c  3.53    %G%";
+static char SccsId[] = "@(#)deliver.c  3.54    %G%";
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
@@ -262,7 +262,7 @@ deliver(firstto, editfcn)
 
                if (clever)
                {
 
                if (clever)
                {
-                       i = smtpmrcp(to);
+                       i = smtprcpt(to);
                        if (i == EX_TEMPFAIL)
                        {
                                QueueUp = TRUE;
                        if (i == EX_TEMPFAIL)
                        {
                                QueueUp = TRUE;
index fd1b0cd..fa5d8ef 100644 (file)
@@ -1,19 +1,20 @@
-@(#)   sendmail.hf     3.1     %G%
+@(#)   sendmail.hf     3.2     %G%
 smtp   Commands:
 smtp   Commands:
-smtp           MAIL    MRCP    DATA    DOIT    RSET
+smtp           HELO    MAIL    RCPT    DATA    RSET
 smtp           NOOP    QUIT    HELP    VRFY
 smtp   For more info use "HELP <topic>".
 help   HELP [ <topic> ]
 help           The HELP command gives help info.
 smtp           NOOP    QUIT    HELP    VRFY
 smtp   For more info use "HELP <topic>".
 help   HELP [ <topic> ]
 help           The HELP command gives help info.
+helo   HELO <hostname>
+helo           Introduce yourself.  I am a boor, so I really don't
+helo           care if you do.
 mail   MAIL FROM: <sender>
 mail           Specifies the sender.
 mail   MAIL FROM: <sender>
 mail           Specifies the sender.
-mrcp   MRCP TO: <recipient>
-mrcp           Specifies the recipient.  Can be used any number of times.
+rcpt   RCPT TO: <recipient>
+rcpt           Specifies the recipient.  Can be used any number of times.
 data   DATA
 data           Following text is collected as the message.
 data           End with a single dot.
 data   DATA
 data           Following text is collected as the message.
 data           End with a single dot.
-doit   DOIT
-doit           Causes the message to be sent.
 rset   RSET
 rset           Resets the system -- same as QUIT in this implementation.
 quit   QUIT
 rset   RSET
 rset           Resets the system -- same as QUIT in this implementation.
 quit   QUIT
@@ -23,3 +24,14 @@ vrfy         Not implemented to protocol.  Gives some sexy
 vrfy           information.
 noop   NOOP
 noop           Do nothing.
 vrfy           information.
 noop   NOOP
 noop           Do nothing.
+send   SEND FROM: <sender>
+send           replaces the MAIL command, and can be used to send
+send           directly to a users terminal.  Not supported in this
+send           implementation.
+soml   SOML FROM: <sender>
+soml           Send or mail.  If the user is logged in, send directly,
+soml           otherwise mail.  Not supported in this implementation.
+saml   SAML FROM: <sender>
+saml           Send and mail.  Send directly to the user's terminal,
+saml           and also mail a letter.  Not supported in this
+saml           implementation.
index d555085..5775778 100644 (file)
@@ -1,6 +1,6 @@
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-static char    SccsId[] =      "@(#)srvrsmtp.c 3.7     %G%";
+static char    SccsId[] =      "@(#)srvrsmtp.c 3.8     %G%";
 
 /*
 **  SMTP -- run the SMTP protocol.
 
 /*
 **  SMTP -- run the SMTP protocol.
@@ -25,28 +25,29 @@ struct cmd
 /* values for cmdcode */
 # define CMDERROR      0       /* bad command */
 # define CMDMAIL       1       /* mail -- designate sender */
 /* values for cmdcode */
 # define CMDERROR      0       /* bad command */
 # define CMDMAIL       1       /* mail -- designate sender */
-# define CMDMRCP       2       /* mrcp -- designate recipient */
+# define CMDRCPT       2       /* rcpt -- designate recipient */
 # define CMDDATA       3       /* data -- send message text */
 # define CMDDATA       3       /* data -- send message text */
-# define CMDDOIT       4       /* doit -- actually do delivery */
 # define CMDRSET       5       /* rset -- reset state */
 # define CMDVRFY       6       /* vrfy -- verify address */
 # define CMDHELP       7       /* help -- give usage info */
 # define CMDNOOP       8       /* noop -- do nothing */
 # define CMDQUIT       9       /* quit -- close connection and die */
 # define CMDMRSQ       10      /* mrsq -- for old mtp compat only */
 # define CMDRSET       5       /* rset -- reset state */
 # define CMDVRFY       6       /* vrfy -- verify address */
 # define CMDHELP       7       /* help -- give usage info */
 # define CMDNOOP       8       /* noop -- do nothing */
 # define CMDQUIT       9       /* quit -- close connection and die */
 # define CMDMRSQ       10      /* mrsq -- for old mtp compat only */
+# define CMDHELO       11      /* helo -- be polite */
 
 static struct cmd      CmdTab[] =
 {
        "mail",         CMDMAIL,
 
 static struct cmd      CmdTab[] =
 {
        "mail",         CMDMAIL,
-       "mrcp",         CMDMRCP,
+       "rcpt",         CMDRCPT,
+       "mrcp",         CMDRCPT,        /* for old MTP compatability */
        "data",         CMDDATA,
        "data",         CMDDATA,
-       "doit",         CMDDOIT,
        "rset",         CMDRSET,
        "vrfy",         CMDVRFY,
        "help",         CMDHELP,
        "noop",         CMDNOOP,
        "quit",         CMDQUIT,
        "mrsq",         CMDMRSQ,
        "rset",         CMDRSET,
        "vrfy",         CMDVRFY,
        "help",         CMDHELP,
        "noop",         CMDNOOP,
        "quit",         CMDQUIT,
        "mrsq",         CMDMRSQ,
+       "helo",         CMDHELO,
        NULL,           CMDERROR,
 };
 
        NULL,           CMDERROR,
 };
 
@@ -101,6 +102,10 @@ smtp()
                /* process command */
                switch (c->cmdcode)
                {
                /* process command */
                switch (c->cmdcode)
                {
+                 case CMDHELO:         /* hello -- introduce yourself */
+                       message("250", "%s Pleased to meet you", HostName);
+                       break;
+
                  case CMDMAIL:         /* mail -- designate sender */
                        if (hasmail)
                        {
                  case CMDMAIL:         /* mail -- designate sender */
                        if (hasmail)
                        {
@@ -124,7 +129,7 @@ smtp()
                        }
                        break;
 
                        }
                        break;
 
-                 case CMDMRCP:         /* mrcp -- designate recipient */
+                 case CMDRCPT:         /* rcpt -- designate recipient */
                        p = skipword(p, "to");
                        if (p == NULL)
                                break;
                        p = skipword(p, "to");
                        if (p == NULL)
                                break;
@@ -143,31 +148,36 @@ smtp()
                        break;
 
                  case CMDDATA:         /* data -- text of mail */
                        break;
 
                  case CMDDATA:         /* data -- text of mail */
-                       collect(TRUE);
-                       if (Errors == 0)
-                       {
-                               message("250", "Message stored");
-                               hasdata = TRUE;
-                       }
-                       break;
-
-                 case CMDDOIT:         /* doit -- actually send everything */
                        if (!hasmail)
                        if (!hasmail)
+                       {
                                message("503", "Need MAIL command");
                                message("503", "Need MAIL command");
+                               break;
+                       }
                        else if (rcps <= 0)
                        else if (rcps <= 0)
-                               message("503", "Need MRCP (recipient)");
-                       else if (!hasdata)
-                               message("503", "No message, use DATA");
-                       else
                        {
                        {
-                               if (rcps != 1)
-                                       HoldErrs = MailBack = TRUE;
-                               sendall(FALSE);
-                               HoldErrs = FALSE;
-                               To = NULL;
-                               if (Errors == 0 || rcps != 1)
-                                       message("250", "Sent");
+                               message("503", "Need RCPT (recipient)");
+                               break;
                        }
                        }
+
+                       /* collect the text of the message */
+                       collect(TRUE);
+                       if (Errors != 0)
+                               break;
+
+                       /* if sending to multiple people, mail back errors */
+                       if (rcps != 1)
+                               HoldErrs = MailBack = TRUE;
+
+                       /* send to all recipients */
+                       sendall(FALSE);
+
+                       /* reset strange modes */
+                       HoldErrs = FALSE;
+                       To = NULL;
+
+                       /* issue success if appropriate */
+                       if (Errors == 0 || rcps != 1)
+                               message("250", "Sent");
                        break;
 
                  case CMDRSET:         /* rset -- reset state */
                        break;
 
                  case CMDRSET:         /* rset -- reset state */
index 2d0522d..8ce7d87 100644 (file)
@@ -3,7 +3,7 @@
 # include <sysexits.h>
 # include "sendmail.h"
 
 # include <sysexits.h>
 # include "sendmail.h"
 
-static char    SccsId[] =      "@(#)usersmtp.c 3.4     %G%";
+static char    SccsId[] =      "@(#)usersmtp.c 3.5     %G%";
 
 /*
 **  SMTPINIT -- initialize SMTP.
 
 /*
 **  SMTPINIT -- initialize SMTP.
@@ -52,6 +52,19 @@ smtpinit(m, pvp, ctladdr)
        if (REPLYTYPE(r) != 2)
                return (EX_TEMPFAIL);
 
        if (REPLYTYPE(r) != 2)
                return (EX_TEMPFAIL);
 
+       /*
+       **  Send the HELO command.
+       **      My mother taught me to always introduce myself, even
+       **      if it is useless.
+       */
+
+       smtpmessage("HELO %s", HostName);
+       r = reply();
+       if (REPLYTYPE(r) == 5)
+               return (EX_UNAVAILABLE);
+       if (REPLYTYPE(r) != 2)
+               return (EX_TEMPFAIL);
+
        /*
        **  Send the MAIL command.
        **      Designates the sender.
        /*
        **  Send the MAIL command.
        **      Designates the sender.
@@ -67,7 +80,7 @@ smtpinit(m, pvp, ctladdr)
        return (EX_OK);
 }
 \f/*
        return (EX_OK);
 }
 \f/*
-**  SMTPMRCP -- designate recipient.
+**  SMTPRCPT -- designate recipient.
 **
 **     Parameters:
 **             to -- address of recipient.
 **
 **     Parameters:
 **             to -- address of recipient.
@@ -79,12 +92,12 @@ smtpinit(m, pvp, ctladdr)
 **             Sends the mail via SMTP.
 */
 
 **             Sends the mail via SMTP.
 */
 
-smtpmrcp(to)
+smtprcpt(to)
        ADDRESS *to;
 {
        register int r;
 
        ADDRESS *to;
 {
        register int r;
 
-       smtpmessage("MRCP To:<%s>", to->q_user);
+       smtpmessage("RCPT To:<%s>", to->q_user);
 
        r = reply();
        if (REPLYTYPE(r) == 4)
 
        r = reply();
        if (REPLYTYPE(r) == 4)
@@ -103,7 +116,7 @@ smtpmrcp(to)
 **                     text of the message with.
 **
 **     Returns:
 **                     text of the message with.
 **
 **     Returns:
-**             exit status corresponding to DOIT command.
+**             exit status corresponding to DATA command.
 **
 **     Side Effects:
 **             none.
 **
 **     Side Effects:
 **             none.
@@ -133,16 +146,6 @@ smtpfinish(m, editfcn)
                return (EX_TEMPFAIL);
        if (r != 250)
                return (EX_SOFTWARE);
                return (EX_TEMPFAIL);
        if (r != 250)
                return (EX_SOFTWARE);
-
-       /*
-       **  Make the actual delivery happen.
-       */
-
-       smtpmessage("DOIT");
-       r = reply();
-       if (r != 250)
-               return (EX_TEMPFAIL);
-
        return (EX_OK);
 }
 \f/*
        return (EX_OK);
 }
 \f/*