summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src/usersmtp.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/sendmail/src/usersmtp.c')
-rw-r--r--contrib/sendmail/src/usersmtp.c63
1 files changed, 36 insertions, 27 deletions
diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c
index e760361..5c2b8f8 100644
--- a/contrib/sendmail/src/usersmtp.c
+++ b/contrib/sendmail/src/usersmtp.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: usersmtp.c,v 8.437.2.10 2003/05/05 23:51:47 ca Exp $")
+SM_RCSID("@(#)$Id: usersmtp.c,v 8.451 2004/03/01 21:50:36 ca Exp $")
#include <sysexits.h>
@@ -82,7 +82,7 @@ smtpinit(m, mci, e, onlyhelo)
if (tTd(18, 1))
{
sm_dprintf("smtpinit ");
- mci_dump(mci, false);
+ mci_dump(sm_debug_file(), mci, false);
}
/*
@@ -138,7 +138,8 @@ smtpinit(m, mci, e, onlyhelo)
SmtpPhase = mci->mci_phase = "client greeting";
sm_setproctitle(true, e, "%s %s: %s",
qid_printname(e), CurHostName, mci->mci_phase);
- r = reply(m, mci, e, TimeOuts.to_initial, esmtp_check, NULL);
+ r = reply(m, mci, e, TimeOuts.to_initial, esmtp_check, NULL,
+ XS_DEFAULT);
if (r < 0)
goto tempfail1;
if (REPLYTYPE(r) == 4)
@@ -184,7 +185,7 @@ tryhelo:
r = reply(m, mci, e,
bitnset(M_LMTP, m->m_flags) ? TimeOuts.to_lhlo
: TimeOuts.to_helo,
- helo_options, NULL);
+ helo_options, NULL, XS_DEFAULT);
if (r < 0)
goto tempfail1;
else if (REPLYTYPE(r) == 5)
@@ -226,21 +227,19 @@ tryhelo:
/*
** If this is expected to be another sendmail, send some internal
** commands.
+ ** If we're running as MSP, "propagate" -v flag if possible.
*/
- if (false
+ if ((UseMSP && Verbose && bitset(MCIF_VERB, mci->mci_flags))
# if !_FFR_DEPRECATE_MAILER_FLAG_I
|| bitnset(M_INTERNAL, m->m_flags)
# endif /* !_FFR_DEPRECATE_MAILER_FLAG_I */
-# if _FFR_MSP_VERBOSE
- /* If we're running as MSP, "propagate" -v flag if possible. */
- || (UseMSP && Verbose && bitset(MCIF_VERB, mci->mci_flags))
-# endif /* _FFR_MSP_VERBOSE */
)
{
/* tell it to be verbose */
smtpmessage("VERB", m, mci);
- r = reply(m, mci, e, TimeOuts.to_miscshort, NULL, &enhsc);
+ r = reply(m, mci, e, TimeOuts.to_miscshort, NULL, &enhsc,
+ XS_DEFAULT);
if (r < 0)
goto tempfail1;
}
@@ -1744,12 +1743,10 @@ attemptauth(m, mci, e, sai)
/* send the info across the wire */
if (out == NULL
-#if _FFR_SASL_INITIAL_WORKAROUND
/* login and digest-md5 up to 1.5.28 set out="" */
|| (outlen == 0 &&
(sm_strcasecmp(mechusing, "LOGIN") == 0 ||
sm_strcasecmp(mechusing, "DIGEST-MD5") == 0))
-#endif /* _FFR_SASL_INITIAL_WORKAROUND */
)
{
/* no initial response */
@@ -1782,7 +1779,8 @@ attemptauth(m, mci, e, sai)
# endif /* SASL < 20000 */
/* get the reply */
- smtpresult = reply(m, mci, e, TimeOuts.to_auth, getsasldata, NULL);
+ smtpresult = reply(m, mci, e, TimeOuts.to_auth, getsasldata, NULL,
+ XS_AUTH);
for (;;)
{
@@ -1826,7 +1824,7 @@ attemptauth(m, mci, e, sai)
*/
smtpresult = reply(m, mci, e, TimeOuts.to_auth,
- getsasldata, NULL);
+ getsasldata, NULL, XS_AUTH);
return EX_NOPERM;
}
@@ -1848,7 +1846,7 @@ attemptauth(m, mci, e, sai)
# endif /* SASL < 20000 */
smtpmessage("%s", m, mci, in64);
smtpresult = reply(m, mci, e, TimeOuts.to_auth,
- getsasldata, NULL);
+ getsasldata, NULL, XS_AUTH);
}
/* NOTREACHED */
}
@@ -2168,7 +2166,7 @@ smtpmailfrom(m, mci, e)
SmtpPhase = mci->mci_phase = "client MAIL";
sm_setproctitle(true, e, "%s %s: %s", qid_printname(e),
CurHostName, mci->mci_phase);
- r = reply(m, mci, e, TimeOuts.to_mail, NULL, &enhsc);
+ r = reply(m, mci, e, TimeOuts.to_mail, NULL, &enhsc, XS_DEFAULT);
if (r < 0)
{
/* communications failure */
@@ -2420,7 +2418,7 @@ smtprcptstat(to, m, mci, e)
}
enhsc = NULL;
- r = reply(m, mci, e, TimeOuts.to_rcpt, NULL, &enhsc);
+ r = reply(m, mci, e, TimeOuts.to_rcpt, NULL, &enhsc, XS_DEFAULT);
save_errno = errno;
to->q_rstatus = sm_rpool_strdup_x(e->e_rpool, SmtpReplyBuffer);
to->q_status = ENHSCN_RPOOL(enhsc, smtptodsn(r), e->e_rpool);
@@ -2570,7 +2568,7 @@ smtpdata(m, mci, e, ctladdr, xstart)
mci->mci_state = MCIS_DATA;
sm_setproctitle(true, e, "%s %s: %s",
qid_printname(e), CurHostName, mci->mci_phase);
- r = reply(m, mci, e, TimeOuts.to_datainit, NULL, &enhsc);
+ r = reply(m, mci, e, TimeOuts.to_datainit, NULL, &enhsc, XS_DEFAULT);
if (r < 0 || REPLYTYPE(r) == 4)
{
if (r >= 0)
@@ -2723,7 +2721,7 @@ smtpdata(m, mci, e, ctladdr, xstart)
CurHostName, mci->mci_phase);
if (bitnset(M_LMTP, m->m_flags))
return EX_OK;
- r = reply(m, mci, e, TimeOuts.to_datafinal, NULL, &enhsc);
+ r = reply(m, mci, e, TimeOuts.to_datafinal, NULL, &enhsc, XS_DEFAULT);
if (r < 0)
return EX_TEMPFAIL;
mci->mci_state = MCIS_OPEN;
@@ -2830,7 +2828,7 @@ smtpgetstat(m, mci, e)
enhsc = NULL;
/* check for the results of the transaction */
- r = reply(m, mci, e, TimeOuts.to_datafinal, NULL, &enhsc);
+ r = reply(m, mci, e, TimeOuts.to_datafinal, NULL, &enhsc, XS_DEFAULT);
if (r < 0)
return EX_TEMPFAIL;
xstat = EX_NOTSTICKY;
@@ -2913,7 +2911,8 @@ smtpquit(m, mci, e)
SmtpPhase = "client QUIT";
mci->mci_state = MCIS_QUITING;
smtpmessage("QUIT", m, mci);
- (void) reply(m, mci, e, TimeOuts.to_quit, NULL, NULL);
+ (void) reply(m, mci, e, TimeOuts.to_quit, NULL, NULL,
+ XS_DEFAULT);
SuprErrs = oldSuprErrs;
if (mci->mci_state == MCIS_CLOSED)
goto end;
@@ -2988,7 +2987,7 @@ smtprset(m, mci, e)
SmtpPhase = "client RSET";
smtpmessage("RSET", m, mci);
- r = reply(m, mci, e, TimeOuts.to_rset, NULL, NULL);
+ r = reply(m, mci, e, TimeOuts.to_rset, NULL, NULL, XS_DEFAULT);
if (r < 0)
return;
@@ -3033,7 +3032,7 @@ smtpprobe(mci)
e = &BlankEnvelope;
SmtpPhase = "client probe";
smtpmessage("RSET", m, mci);
- r = reply(m, mci, e, TimeOuts.to_miscshort, NULL, NULL);
+ r = reply(m, mci, e, TimeOuts.to_miscshort, NULL, NULL, XS_DEFAULT);
if (REPLYTYPE(r) != 2)
smtpquit(m, mci, e);
return r;
@@ -3049,6 +3048,7 @@ smtpprobe(mci)
** pfunc -- processing function called on each line of response.
** If null, no special processing is done.
** enhstat -- optional, returns enhanced error code string (if set)
+** rtype -- type of SmtpMsgBuffer: does it contains secret data?
**
** Returns:
** reply code it reads.
@@ -3058,13 +3058,14 @@ smtpprobe(mci)
*/
int
-reply(m, mci, e, timeout, pfunc, enhstat)
+reply(m, mci, e, timeout, pfunc, enhstat, rtype)
MAILER *m;
MCI *mci;
ENVELOPE *e;
time_t timeout;
void (*pfunc)();
char **enhstat;
+ int rtype;
{
register char *bufp;
register int r;
@@ -3207,9 +3208,17 @@ reply(m, mci, e, timeout, pfunc, enhstat)
SmtpNeedIntro = false;
}
if (SmtpMsgBuffer[0] != '\0')
- (void) sm_io_fprintf(e->e_xfp, SM_TIME_DEFAULT,
- ">>> %s\n", SmtpMsgBuffer);
- SmtpMsgBuffer[0] = '\0';
+ {
+ (void) sm_io_fprintf(e->e_xfp,
+ SM_TIME_DEFAULT,
+ ">>> %s\n",
+ (rtype == XS_STARTTLS)
+ ? "STARTTLS dialogue"
+ : ((rtype == XS_AUTH)
+ ? "AUTH dialogue"
+ : SmtpMsgBuffer));
+ SmtpMsgBuffer[0] = '\0';
+ }
/* now log the message as from the other side */
(void) sm_io_fprintf(e->e_xfp, SM_TIME_DEFAULT,
OpenPOWER on IntegriCloud