summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d727056)
SCCS-vsn: usr.sbin/sendmail/src/collect.c 3.25
SCCS-vsn: usr.sbin/sendmail/src/util.c 3.11
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.52
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.44
SCCS-vsn: usr.sbin/sendmail/src/macro.c 3.6
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 3.3
# include <errno.h>
# include "sendmail.h"
# include <errno.h>
# include "sendmail.h"
-static char SccsId[] = "@(#)collect.c 3.24 %G%";
+static char SccsId[] = "@(#)collect.c 3.25 %G%";
/*
** COLLECT -- read & parse message header & make temp file.
/*
** COLLECT -- read & parse message header & make temp file.
if (fgets(buf, sizeof buf, stdin) == NULL)
return;
if (fgets(buf, sizeof buf, stdin) == NULL)
return;
# ifndef NOTUNIX
if (!SaveFrom && strncmp(buf, "From ", 5) == 0)
{
eatfrom(buf);
(void) fgets(buf, sizeof buf, stdin);
# ifndef NOTUNIX
if (!SaveFrom && strncmp(buf, "From ", 5) == 0)
{
eatfrom(buf);
(void) fgets(buf, sizeof buf, stdin);
register char c;
extern bool isheader();
register char c;
extern bool isheader();
/* see if the header is over */
if (!isheader(buf))
break;
/* see if the header is over */
if (!isheader(buf))
break;
*p++ = c;
if (fgets(p, sizeof buf - (p - buf), stdin) == NULL)
break;
*p++ = c;
if (fgets(p, sizeof buf - (p - buf), stdin) == NULL)
break;
}
if (!feof(stdin))
(void) ungetc(c, stdin);
}
if (!feof(stdin))
(void) ungetc(c, stdin);
/* throw away a blank line */
if (buf[0] == '\n')
/* throw away a blank line */
if (buf[0] == '\n')
(void) fgets(buf, sizeof buf, stdin);
(void) fgets(buf, sizeof buf, stdin);
+ fixcrlf(buf, FALSE);
+ }
/*
** Collect the body of the message.
/*
** Collect the body of the message.
register int i;
register char *bp = buf;
register int i;
register char *bp = buf;
/* check for end-of-message */
if (!IgnrDot && buf[0] == '.' && (buf[1] == '\n' || buf[1] == '\0'))
break;
/* check for end-of-message */
if (!IgnrDot && buf[0] == '.' && (buf[1] == '\n' || buf[1] == '\0'))
break;
{
(void) freopen(InFileName, "w", tf);
fputs("\nMAIL DELETED BECAUSE OF LACK OF DISK SPACE\n\n", tf);
{
(void) freopen(InFileName, "w", tf);
fputs("\nMAIL DELETED BECAUSE OF LACK OF DISK SPACE\n\n", tf);
- syserr("collect: Out of disk space for temp file");
+ usrerr("452 Out of disk space for temp file");
}
else
syserr("collect: Cannot write %s", InFileName);
}
else
syserr("collect: Cannot write %s", InFileName);
# include "useful.h"
# include "conf.h"
# include "useful.h"
# include "conf.h"
-static char SccsId[] = "@(#)macro.c 3.5 %G%";
+static char SccsId[] = "@(#)macro.c 3.6 %G%";
char *Macro[128];
extern int Debug;
char *Macro[128];
extern int Debug;
** $f raw from address
** $g translated from address
** $h to host
** $f raw from address
** $g translated from address
** $h to host
+** $i official SMTP hostname, used in messages+
** $l UNIX-style from line+
** $n name of sendmail ("MAILER-DAEMON" on local
** net typically)+
** $l UNIX-style from line+
** $n name of sendmail ("MAILER-DAEMON" on local
** net typically)+
# include <syslog.h>
# endif LOG
# include <syslog.h>
# endif LOG
-static char SccsId[] = "@(#)main.c 3.43 %G%";
+static char SccsId[] = "@(#)main.c 3.44 %G%";
/*
** SENDMAIL -- Post mail to a set of destinations.
/*
** SENDMAIL -- Post mail to a set of destinations.
char cbuf[5]; /* holds hop count */
char dbuf[30]; /* holds ctime(tbuf) */
char ybuf[10]; /* holds tty id */
char cbuf[5]; /* holds hop count */
char dbuf[30]; /* holds ctime(tbuf) */
char ybuf[10]; /* holds tty id */
+ char ibuf[30]; /* holds HostName */
bool aliasinit = FALSE;
extern char *ttyname();
extern bool safefile();
bool aliasinit = FALSE;
extern char *ttyname();
extern bool safefile();
*/
readcf(ConfFile, safecf);
*/
readcf(ConfFile, safecf);
+ (void) expand("$i", ibuf, &ibuf[sizeof ibuf - 1]);
+ HostName = ibuf;
/*
** Initialize aliases.
/*
** Initialize aliases.
-static char SccsId[] = "@(#)srvrsmtp.c 3.2 %G%";
+static char SccsId[] = "@(#)srvrsmtp.c 3.3 %G%";
/*
** SMTP -- run the SMTP protocol.
/*
** SMTP -- run the SMTP protocol.
bool hasmail; /* mail command received */
bool hasmrcp; /* has a recipient */
bool hasdata; /* has mail data */
bool hasmail; /* mail command received */
bool hasmrcp; /* has a recipient */
bool hasdata; /* has mail data */
- /*%%%*/ HostName = "XYZZY";
hasmail = hasmrcp = hasdata = FALSE;
message("220", "%s Sendmail at your service", HostName);
for (;;)
{
To = NULL;
hasmail = hasmrcp = hasdata = FALSE;
message("220", "%s Sendmail at your service", HostName);
for (;;)
{
To = NULL;
if (fgets(inp, sizeof inp, InChannel) == NULL)
{
/* end of file, just die */
if (fgets(inp, sizeof inp, InChannel) == NULL)
{
/* end of file, just die */
- message("421", "Lost input channel");
+ message("421", "%s Lost input channel", HostName);
finis();
}
/* clean up end of line */
finis();
}
/* clean up end of line */
- p = index(inp, '\n');
- if (p != NULL)
- *p = '\0';
- p = index(inp, '\r');
- if (p != NULL)
- *p = '\0';
/* break off command */
for (p = inp; isspace(*p); p++)
/* break off command */
for (p = inp; isspace(*p); p++)
switch (c->cmdcode)
{
case CMDMAIL: /* mail -- designate sender */
switch (c->cmdcode)
{
case CMDMAIL: /* mail -- designate sender */
+ if (hasmail)
+ {
+ message("503", "Sender already specified");
+ break;
+ }
p = skipword(p, "from");
if (p == NULL)
break;
p = skipword(p, "from");
if (p == NULL)
break;
+ if (Errors == baseerrs)
{
message("250", "Sender ok");
hasmail = TRUE;
{
message("250", "Sender ok");
hasmail = TRUE;
break;
}
sendto(p, 1, NULL);
break;
}
sendto(p, 1, NULL);
+ if (Errors == baseerrs)
{
message("250", "Recipient ok");
hasmrcp = TRUE;
{
message("250", "Recipient ok");
hasmrcp = TRUE;
case CMDDATA: /* data -- text of mail */
message("354", "Enter mail, end with dot");
collect();
case CMDDATA: /* data -- text of mail */
message("354", "Enter mail, end with dot");
collect();
+ if (Errors == baseerrs)
{
message("250", "Message stored");
hasdata = TRUE;
{
message("250", "Message stored");
hasdata = TRUE;
+ if (Errors == baseerrs)
message("250", "Sent");
}
break;
message("250", "Sent");
}
break;
case CMDVRFY: /* vrfy -- verify address */
sendto(p, 1, NULL);
case CMDVRFY: /* vrfy -- verify address */
sendto(p, 1, NULL);
+ if (Errors == baseerrs)
message("250", "user ok");
break;
message("250", "user ok");
break;
# include <ctype.h>
# include "conf.h"
# include <ctype.h>
# include "conf.h"
-static char SccsId[] = "@(#)util.c 3.10 %G%";
+static char SccsId[] = "@(#)util.c 3.11 %G%";
/*
** STRIPQUOTES -- Strip quotes & quote bits from a string.
/*
** STRIPQUOTES -- Strip quotes & quote bits from a string.
+** FIXCRLF -- fix <CR><LF> in line.
+**
+** Looks for the <CR><LF> combination and turns it into the
+** UNIX canonical <NL> character. It only takes one line,
+** i.e., it is assumed that the first <NL> found is the end
+** of the line.
+**
+** Parameters:
+** line -- the line to fix.
+** stripnl -- if true, strip the newline also.
+**
+** Returns:
+** none.
+**
+** Side Effects:
+** line is changed in place.
+*/
+
+fixcrlf(line, stripnl)
+ char *line;
+ bool stripnl;
+{
+ register char *p;
+
+ p = index(line, '\n');
+ if (p == NULL)
+ return;
+ if (*p == '\r')
+ p--;
+ if (!stripnl)
+ *p++ = '\n';
+ *p = '\0';
+}
+\f/*
** SYSLOG -- fake entry to fool lint
*/
** SYSLOG -- fake entry to fool lint
*/
-static char SccsId[] = "@(#)SendMail version 3.51 of %G%";
+static char SccsId[] = "@(#)SendMail version 3.52 of %G%";
-char Version[] = "3.51 [%G%]";
+char Version[] = "3.52 [%G%]";