From 1024e3943e17bd4407f0cf3a799cfa05d59f1059 Mon Sep 17 00:00:00 2001 From: gshapiro Date: Wed, 14 Jun 2006 16:23:02 +0000 Subject: Import sendmail 8.13.7 Security: FreeBSD-SA-06:17.sendmail --- contrib/sendmail/src/srvrsmtp.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'contrib/sendmail/src/srvrsmtp.c') diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c index e5cfdcf..c75214f 100644 --- a/contrib/sendmail/src/srvrsmtp.c +++ b/contrib/sendmail/src/srvrsmtp.c @@ -17,7 +17,7 @@ # include #endif /* MILTER */ -SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.922 2006/02/28 00:42:13 ca Exp $") +SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.924.2.2 2006/05/31 20:56:37 ca Exp $") #include #include @@ -70,9 +70,10 @@ static unsigned int srvfeatures __P((ENVELOPE *, char *, unsigned int)); #define STOP_ATTACK ((time_t) -1) static time_t checksmtpattack __P((volatile unsigned int *, unsigned int, bool, char *, ENVELOPE *)); -static void mail_esmtp_args __P((char *, char *, ENVELOPE *)); +static void mail_esmtp_args __P((char *, char *, ENVELOPE *, unsigned int)); static void printvrfyaddr __P((ADDRESS *, bool, bool)); -static void rcpt_esmtp_args __P((ADDRESS *, char *, char *, ENVELOPE *)); +static void rcpt_esmtp_args __P((ADDRESS *, char *, char *, ENVELOPE *, + unsigned int)); static char *skipword __P((char *volatile, char *)); static void setup_smtpd_io __P((void)); @@ -588,8 +589,8 @@ smtp(nullserver, d_flags, e) : (SRV_OFFER_EXPN | (bitset(PRIV_NOVERB, PrivacyFlags) ? SRV_NONE : SRV_OFFER_VERB))) - | (bitset(PRIV_NORECEIPTS, PrivacyFlags) ? SRV_NONE - : SRV_OFFER_DSN) + | ((bitset(PRIV_NORECEIPTS, PrivacyFlags) || !SendMIMEErrors) + ? SRV_NONE : SRV_OFFER_DSN) #if SASL | (bitnset(D_NOAUTH, d_flags) ? SRV_NONE : SRV_OFFER_AUTH) | (bitset(SASL_SEC_NOPLAINTEXT, SASLOpts) ? SRV_REQ_SEC @@ -1285,14 +1286,17 @@ smtp(nullserver, d_flags, e) if (ssf != NULL && *ssf > 0) { + int tmo; + /* ** Convert I/O layer to use SASL. ** If the call fails, the connection ** is aborted. */ + tmo = TimeOuts.to_datablock * 1000; if (sfdcsasl(&InChannel, &OutChannel, - conn) == 0) + conn, tmo) == 0) { /* restart dialogue */ n_helo = 0; @@ -2017,7 +2021,7 @@ smtp(nullserver, d_flags, e) case SMFIR_SHUTDOWN: if (MilterLogLevel > 3) sm_syslog(LOG_INFO, e->e_id, - "Milter: Milter: helo=%s, reject=421 4.7.0 %s closing connection", + "Milter: helo=%s, reject=421 4.7.0 %s closing connection", p, MyHostName); tempfail = true; smtp.sm_milterize = false; @@ -2296,7 +2300,7 @@ smtp(nullserver, d_flags, e) sm_dprintf("MAIL: got arg %s=\"%s\"\n", kp, vp == NULL ? "" : vp); - mail_esmtp_args(kp, vp, e); + mail_esmtp_args(kp, vp, e, features); if (equal != NULL) *equal = '='; args[argno++] = kp; @@ -2566,7 +2570,7 @@ smtp(nullserver, d_flags, e) sm_dprintf("RCPT: got arg %s=\"%s\"\n", kp, vp == NULL ? "" : vp); - rcpt_esmtp_args(a, kp, vp, e); + rcpt_esmtp_args(a, kp, vp, e, features); if (equal != NULL) *equal = '='; args[argno++] = kp; @@ -3848,6 +3852,7 @@ skipword(p, w) return p; } + /* ** MAIL_ESMTP_ARGS -- process ESMTP arguments from MAIL line ** @@ -3855,16 +3860,18 @@ skipword(p, w) ** kp -- the parameter key. ** vp -- the value of that parameter. ** e -- the envelope. +** features -- current server features ** ** Returns: ** none. */ static void -mail_esmtp_args(kp, vp, e) +mail_esmtp_args(kp, vp, e, features) char *kp; char *vp; ENVELOPE *e; + unsigned int features; { if (sm_strcasecmp(kp, "size") == 0) { @@ -3911,7 +3918,7 @@ mail_esmtp_args(kp, vp, e) } else if (sm_strcasecmp(kp, "envid") == 0) { - if (bitset(PRIV_NORECEIPTS, PrivacyFlags)) + if (!bitset(SRV_OFFER_DSN, features)) { usrerr("504 5.7.0 Sorry, ENVID not supported, we do not allow DSN"); /* NOTREACHED */ @@ -3937,7 +3944,7 @@ mail_esmtp_args(kp, vp, e) } else if (sm_strcasecmp(kp, "ret") == 0) { - if (bitset(PRIV_NORECEIPTS, PrivacyFlags)) + if (!bitset(SRV_OFFER_DSN, features)) { usrerr("504 5.7.0 Sorry, RET not supported, we do not allow DSN"); /* NOTREACHED */ @@ -4130,23 +4137,25 @@ mail_esmtp_args(kp, vp, e) ** kp -- the parameter key. ** vp -- the value of that parameter. ** e -- the envelope. +** features -- current server features ** ** Returns: ** none. */ static void -rcpt_esmtp_args(a, kp, vp, e) +rcpt_esmtp_args(a, kp, vp, e, features) ADDRESS *a; char *kp; char *vp; ENVELOPE *e; + unsigned int features; { if (sm_strcasecmp(kp, "notify") == 0) { char *p; - if (bitset(PRIV_NORECEIPTS, PrivacyFlags)) + if (!bitset(SRV_OFFER_DSN, features)) { usrerr("504 5.7.0 Sorry, NOTIFY not supported, we do not allow DSN"); /* NOTREACHED */ @@ -4187,7 +4196,7 @@ rcpt_esmtp_args(a, kp, vp, e) } else if (sm_strcasecmp(kp, "orcpt") == 0) { - if (bitset(PRIV_NORECEIPTS, PrivacyFlags)) + if (!bitset(SRV_OFFER_DSN, features)) { usrerr("504 5.7.0 Sorry, ORCPT not supported, we do not allow DSN"); /* NOTREACHED */ -- cgit v1.1