SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 6.33
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 6.59
SCCS-vsn: usr.sbin/sendmail/src/collect.c 6.20
SCCS-vsn: usr.sbin/sendmail/src/util.c 6.20
-static char sccsid[] = "@(#)collect.c 6.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)collect.c 6.20 (Berkeley) %G%";
#endif /* not lint */
# include <errno.h>
#endif /* not lint */
# include <errno.h>
** Try to read a UNIX-style From line
*/
** Try to read a UNIX-style From line
*/
- if (sfgets(buf, MAXLINE, InChannel, TimeOuts.to_datablock) == NULL)
+ if (sfgets(buf, MAXLINE, InChannel, TimeOuts.to_datablock,
+ "initial message read") == NULL)
goto readerr;
fixcrlf(buf, FALSE);
# ifndef NOTUNIX
goto readerr;
fixcrlf(buf, FALSE);
# ifndef NOTUNIX
if (!flusheol(buf, InChannel))
goto readerr;
eatfrom(buf, e);
if (!flusheol(buf, InChannel))
goto readerr;
eatfrom(buf, e);
- if (sfgets(buf, MAXLINE, InChannel, TimeOuts.to_datablock) == NULL)
+ if (sfgets(buf, MAXLINE, InChannel, TimeOuts.to_datablock,
+ "message header read") == NULL)
goto readerr;
fixcrlf(buf, FALSE);
}
goto readerr;
fixcrlf(buf, FALSE);
}
- if (sfgets(freebuf, MAXLINE, InChannel, TimeOuts.to_datablock) == NULL)
+ if (sfgets(freebuf, MAXLINE, InChannel,
+ TimeOuts.to_datablock,
+ "message header read") == NULL)
goto readerr;
/* is this a continuation line? */
goto readerr;
/* is this a continuation line? */
if (*workbuf == '\0')
{
/* throw away a blank line */
if (*workbuf == '\0')
{
/* throw away a blank line */
- if (sfgets(buf, MAXLINE, InChannel, TimeOuts.to_datablock) == NULL)
+ if (sfgets(buf, MAXLINE, InChannel, TimeOuts.to_datablock,
+ "message separator read") == NULL)
goto readerr;
}
else if (workbuf == buf2) /* guarantee `buf' contains data */
goto readerr;
}
else if (workbuf == buf2) /* guarantee `buf' contains data */
fputs("\n", tf);
if (ferror(tf))
tferror(tf, e);
fputs("\n", tf);
if (ferror(tf))
tferror(tf, e);
- } while (sfgets(buf, MAXLINE, InChannel, TimeOuts.to_datablock) != NULL);
+ } while (sfgets(buf, MAXLINE, InChannel, TimeOuts.to_datablock,
+ "message body read") != NULL);
readerr:
if (fflush(tf) != 0)
readerr:
if (fflush(tf) != 0)
if (printmsg)
usrerr("553 header line too long");
printmsg = FALSE;
if (printmsg)
usrerr("553 header line too long");
printmsg = FALSE;
- if (sfgets(junkbuf, MAXLINE, fp, TimeOuts.to_datablock) == NULL)
+ if (sfgets(junkbuf, MAXLINE, fp, TimeOuts.to_datablock,
+ "long line flush") == NULL)
return (FALSE);
p = junkbuf;
}
return (FALSE);
p = junkbuf;
}
-static char sccsid[] = "@(#)srvrsmtp.c 6.58 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 6.59 (Berkeley) %G% (with SMTP)";
-static char sccsid[] = "@(#)srvrsmtp.c 6.58 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 6.59 (Berkeley) %G% (without SMTP)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
}
settime(e);
CurHostName = RealHostName;
}
settime(e);
CurHostName = RealHostName;
- setproctitle("srvrsmtp %s startup", CurHostName);
+ setproctitle("server %s startup", CurHostName);
expand("\201e", inp, &inp[sizeof inp], e);
message("220-%s", inp);
message("220 ESMTP spoken here");
expand("\201e", inp, &inp[sizeof inp], e);
message("220-%s", inp);
message("220 ESMTP spoken here");
(void) fflush(stdout);
/* read the input line */
(void) fflush(stdout);
/* read the input line */
- SmtpPhase = "srvrsmtp cmd read";
- setproctitle("srvrsmtp %s cmd read", CurHostName);
- p = sfgets(inp, sizeof inp, InChannel, TimeOuts.to_nextcommand);
+ SmtpPhase = "server cmd read";
+ setproctitle("server %s cmd read", CurHostName);
+ p = sfgets(inp, sizeof inp, InChannel, TimeOuts.to_nextcommand,
+ SmtpPhase);
/* handle errors */
if (p == NULL)
/* handle errors */
if (p == NULL)
if (c->cmdcode == CMDEHLO)
{
protocol = "ESMTP";
if (c->cmdcode == CMDEHLO)
{
protocol = "ESMTP";
+ SmtpPhase = "server EHLO";
}
else
{
protocol = "SMTP";
}
else
{
protocol = "SMTP";
+ SmtpPhase = "server HELO";
}
sendinghost = newstr(p);
if (strcasecmp(p, RealHostName) != 0)
}
sendinghost = newstr(p);
if (strcasecmp(p, RealHostName) != 0)
break;
case CMDMAIL: /* mail -- designate sender */
break;
case CMDMAIL: /* mail -- designate sender */
+ SmtpPhase = "server MAIL";
/* check for validity of this command */
if (!gothello)
/* check for validity of this command */
if (!gothello)
usrerr("503 Need MAIL before RCPT");
break;
}
usrerr("503 Need MAIL before RCPT");
break;
}
+ SmtpPhase = "server RCPT";
if (setjmp(TopFrame) > 0)
{
e->e_flags &= ~EF_FATALERRS;
if (setjmp(TopFrame) > 0)
{
e->e_flags &= ~EF_FATALERRS;
break;
case CMDDATA: /* data -- text of mail */
break;
case CMDDATA: /* data -- text of mail */
+ SmtpPhase = "server DATA";
if (!gotmail)
{
message("503 Need MAIL command");
if (!gotmail)
{
message("503 Need MAIL command");
auto int st;
/* parent -- wait for child to complete */
auto int st;
/* parent -- wait for child to complete */
- setproctitle("srvrsmtp %s child wait", CurHostName);
+ setproctitle("server %s child wait", CurHostName);
st = waitfor(childpid);
if (st == -1)
syserr("%s: lost child", label);
st = waitfor(childpid);
if (st == -1)
syserr("%s: lost child", label);
-static char sccsid[] = "@(#)usersmtp.c 6.32 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 6.33 (Berkeley) %G% (with SMTP)";
-static char sccsid[] = "@(#)usersmtp.c 6.32 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 6.33 (Berkeley) %G% (without SMTP)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
- SmtpPhase = mci->mci_phase = "greeting wait";
+ SmtpPhase = mci->mci_phase = "client greeting";
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_initial, esmtp_check);
if (r < 0 || REPLYTYPE(r) != 2)
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_initial, esmtp_check);
if (r < 0 || REPLYTYPE(r) != 2)
if (bitset(MCIF_ESMTP, mci->mci_flags))
{
smtpmessage("EHLO %s", m, mci, MyHostName);
if (bitset(MCIF_ESMTP, mci->mci_flags))
{
smtpmessage("EHLO %s", m, mci, MyHostName);
- SmtpPhase = mci->mci_phase = "EHLO wait";
+ SmtpPhase = mci->mci_phase = "client EHLO";
}
else
{
smtpmessage("HELO %s", m, mci, MyHostName);
}
else
{
smtpmessage("HELO %s", m, mci, MyHostName);
- SmtpPhase = mci->mci_phase = "HELO wait";
+ SmtpPhase = mci->mci_phase = "client HELO";
}
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_helo, helo_options);
}
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_helo, helo_options);
smtpmessage("MAIL From:<@%s%c%s>%s", m, mci, MyHostName,
buf[0] == '@' ? ',' : ':', buf, optbuf);
}
smtpmessage("MAIL From:<@%s%c%s>%s", m, mci, MyHostName,
buf[0] == '@' ? ',' : ':', buf, optbuf);
}
- SmtpPhase = mci->mci_phase = "MAIL wait";
+ SmtpPhase = mci->mci_phase = "client MAIL";
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_mail, NULL);
if (r < 0 || REPLYTYPE(r) == 4)
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_mail, NULL);
if (r < 0 || REPLYTYPE(r) == 4)
smtpmessage("RCPT To:<%s>", m, mci, to->q_user);
smtpmessage("RCPT To:<%s>", m, mci, to->q_user);
- SmtpPhase = mci->mci_phase = "RCPT wait";
+ SmtpPhase = mci->mci_phase = "client RCPT";
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_rcpt, NULL);
if (r < 0 || REPLYTYPE(r) == 4)
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_rcpt, NULL);
if (r < 0 || REPLYTYPE(r) == 4)
/* send the command and check ok to proceed */
smtpmessage("DATA", m, mci);
/* send the command and check ok to proceed */
smtpmessage("DATA", m, mci);
- SmtpPhase = mci->mci_phase = "DATA wait";
+ SmtpPhase = mci->mci_phase = "client DATA 354";
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_datainit, NULL);
if (r < 0 || REPLYTYPE(r) == 4)
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_datainit, NULL);
if (r < 0 || REPLYTYPE(r) == 4)
nmessage(">>> .");
/* check for the results of the transaction */
nmessage(">>> .");
/* check for the results of the transaction */
- SmtpPhase = mci->mci_phase = "result wait";
+ SmtpPhase = mci->mci_phase = "client DATA 250";
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_datafinal, NULL);
if (r < 0)
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
r = reply(m, mci, e, TimeOuts.to_datafinal, NULL);
if (r < 0)
/* send the quit message if we haven't gotten I/O error */
if (mci->mci_state != MCIS_ERROR)
{
/* send the quit message if we haven't gotten I/O error */
if (mci->mci_state != MCIS_ERROR)
{
+ SmtpPhase = "client QUIT";
smtpmessage("QUIT", m, mci);
(void) reply(m, mci, e, TimeOuts.to_quit, NULL);
if (mci->mci_state == MCIS_CLOSED)
smtpmessage("QUIT", m, mci);
(void) reply(m, mci, e, TimeOuts.to_quit, NULL);
if (mci->mci_state == MCIS_CLOSED)
+ SmtpPhase = "client RSET";
smtpmessage("RSET", m, mci);
r = reply(m, mci, e, TimeOuts.to_rset, NULL);
if (r < 0)
smtpmessage("RSET", m, mci);
r = reply(m, mci, e, TimeOuts.to_rset, NULL);
if (r < 0)
extern ENVELOPE BlankEnvelope;
ENVELOPE *e = &BlankEnvelope;
extern ENVELOPE BlankEnvelope;
ENVELOPE *e = &BlankEnvelope;
+ SmtpPhase = "client probe";
smtpmessage("RSET", m, mci);
r = reply(m, mci, e, TimeOuts.to_miscshort, NULL);
if (r < 0 || REPLYTYPE(r) != 2)
smtpmessage("RSET", m, mci);
r = reply(m, mci, e, TimeOuts.to_miscshort, NULL);
if (r < 0 || REPLYTYPE(r) != 2)
fflush(mci->mci_out);
/* get the line from the other side */
fflush(mci->mci_out);
/* get the line from the other side */
- p = sfgets(bufp, MAXLINE, mci->mci_in, timeout);
+ p = sfgets(bufp, MAXLINE, mci->mci_in, timeout, SmtpPhase);
mci->mci_lastuse = curtime();
if (p == NULL)
mci->mci_lastuse = curtime();
if (p == NULL)
-static char sccsid[] = "@(#)util.c 6.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c 6.20 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
** siz -- size of buf.
** fp -- file to read from.
** timeout -- the timeout before error occurs.
** siz -- size of buf.
** fp -- file to read from.
** timeout -- the timeout before error occurs.
+** during -- what we are trying to read (for error messages).
**
** Returns:
** NULL on error (including timeout). This will also leave
**
** Returns:
** NULL on error (including timeout). This will also leave
static jmp_buf CtxReadTimeout;
char *
static jmp_buf CtxReadTimeout;
char *
-sfgets(buf, siz, fp, timeout)
+sfgets(buf, siz, fp, timeout, during)
char *buf;
int siz;
FILE *fp;
time_t timeout;
char *buf;
int siz;
FILE *fp;
time_t timeout;
{
register EVENT *ev = NULL;
register char *p;
{
register EVENT *ev = NULL;
register char *p;
{
# ifdef LOG
syslog(LOG_NOTICE,
{
# ifdef LOG
syslog(LOG_NOTICE,
- "timeout waiting for input from %s\n",
- CurHostName? CurHostName: "local");
+ "timeout waiting for input from %s during %s\n",
+ CurHostName? CurHostName: "local", during);
- usrerr("451 timeout waiting for input");
+ usrerr("451 timeout waiting for input during %s",
+ during);
buf[0] = '\0';
return (NULL);
}
buf[0] = '\0';
return (NULL);
}