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
# 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.
if (i == EX_TEMPFAIL)
{
QueueUp = TRUE;
if (i == EX_TEMPFAIL)
{
QueueUp = TRUE;
-@(#) sendmail.hf 3.1 %G%
+@(#) sendmail.hf 3.2 %G%
-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
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.
-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.
/* 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,
+ "rcpt", CMDRCPT,
+ "mrcp", CMDRCPT, /* for old MTP compatability */
"rset", CMDRSET,
"vrfy", CMDVRFY,
"help", CMDHELP,
"noop", CMDNOOP,
"quit", CMDQUIT,
"mrsq", CMDMRSQ,
"rset", CMDRSET,
"vrfy", CMDVRFY,
"help", CMDHELP,
"noop", CMDNOOP,
"quit", CMDQUIT,
"mrsq", CMDMRSQ,
/* 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)
{
- 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;
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 */
message("503", "Need MAIL command");
message("503", "Need MAIL command");
- 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 */
# 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.
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.
-** SMTPMRCP -- designate recipient.
+** SMTPRCPT -- designate recipient.
**
** Parameters:
** to -- address of recipient.
**
** Parameters:
** to -- address of recipient.
** Sends the mail via SMTP.
*/
** Sends the mail via SMTP.
*/
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)
** 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.
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);
-