summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/smtpd/parse.y15
-rw-r--r--usr.sbin/smtpd/smtp_session.c16
-rw-r--r--usr.sbin/smtpd/smtpd.conf.510
-rw-r--r--usr.sbin/smtpd/smtpd.h3
4 files changed, 33 insertions, 11 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index a3f6d38737e..9e8e95536cf 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.145 2014/07/09 09:53:37 eric Exp $ */
+/* $OpenBSD: parse.y,v 1.146 2014/07/09 12:44:54 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -109,6 +109,7 @@ enum listen_options {
LO_HOSTNAME = 0x80,
LO_HOSTNAMES = 0x100,
LO_MASKSOURCE = 0x200,
+ LO_NODSN = 0x400,
};
static struct listen_opts {
@@ -159,7 +160,7 @@ typedef struct {
%}
%token AS QUEUE COMPRESSION ENCRYPTION MAXMESSAGESIZE MAXMTADEFERRED LISTEN ON ANY PORT EXPIRE
-%token TABLE SECURE SMTPS CERTIFICATE DOMAIN BOUNCEWARN LIMIT INET4 INET6
+%token TABLE SECURE SMTPS CERTIFICATE DOMAIN BOUNCEWARN LIMIT INET4 INET6 NODSN
%token RELAY BACKUP VIA DELIVER TO LMTP MAILDIR MBOX HOSTNAME HOSTNAMES
%token ACCEPT REJECT INCLUDE ERROR MDA FROM FOR SOURCE MTA PKI SCHEDULER
%token ARROW AUTH TLS LOCAL VIRTUAL TAG TAGGED ALIAS FILTER KEY CA DHPARAMS
@@ -558,6 +559,14 @@ opt_listen : INET4 {
listen_opts.options |= LO_MASKSOURCE;
listen_opts.flags |= F_MASK_SOURCE;
}
+ | NODSN {
+ if (listen_opts.options & LO_NODSN) {
+ yyerror("no-dsn already specified");
+ YYERROR;
+ }
+ listen_opts.options |= LO_NODSN;
+ listen_opts.flags &= ~F_EXT_DSN;
+ }
;
listen : opt_listen listen
@@ -740,6 +749,7 @@ main : BOUNCEWARN {
memset(&l, 0, sizeof l);
memset(&listen_opts, 0, sizeof listen_opts);
listen_opts.family = AF_UNSPEC;
+ listen_opts.flags |= F_EXT_DSN;
} ON STRING listen {
listen_opts.ifx = $4;
create_listener(conf->sc_listeners, &listen_opts);
@@ -1289,6 +1299,7 @@ lookup(char *s)
{ "mbox", MBOX },
{ "mda", MDA },
{ "mta", MTA },
+ { "no-dsn", NODSN },
{ "on", ON },
{ "pki", PKI },
{ "port", PORT },
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index c0e47f88218..0487f55af9a 100644
--- a/usr.sbin/smtpd/smtp_session.c
+++ b/usr.sbin/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.214 2014/07/08 20:14:46 eric Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.215 2014/07/09 12:44:54 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -156,6 +156,9 @@ struct smtp_session {
((s)->listener->flags & F_AUTH && (s)->flags & SF_SECURE && \
!((s)->flags & SF_AUTHENTICATED))
+#define ADVERTISE_EXT_DSN(s) \
+ ((s)->listener->flags & F_EXT_DSN)
+
static int smtp_mailaddr(struct mailaddr *, char *, int, char **, const char *);
static void smtp_session_init(void);
static int smtp_lookup_servername(struct smtp_session *);
@@ -686,7 +689,8 @@ smtp_mfa_response(struct smtp_session *s, int msg, int status, uint32_t code,
smtp_reply(s, "250-8BITMIME");
smtp_reply(s, "250-ENHANCEDSTATUSCODES");
smtp_reply(s, "250-SIZE %zu", env->sc_maxsize);
- smtp_reply(s, "250-DSN");
+ if (ADVERTISE_EXT_DSN(s))
+ smtp_reply(s, "250-DSN");
if (ADVERTISE_TLS(s))
smtp_reply(s, "250-STARTTLS");
if (ADVERTISE_AUTH(s))
@@ -1394,7 +1398,7 @@ smtp_parse_rcpt_args(struct smtp_session *s, char *args)
if (*b == '\0')
continue;
- if (strncasecmp(b, "NOTIFY=", 7) == 0) {
+ if (ADVERTISE_EXT_DSN(s) && strncasecmp(b, "NOTIFY=", 7) == 0) {
b += 7;
while ((p = strsep(&b, ","))) {
if (*p == '\0')
@@ -1413,7 +1417,7 @@ smtp_parse_rcpt_args(struct smtp_session *s, char *args)
combined with other options");
return (-1);
}
- } else if (strncasecmp(b, "ORCPT=", 6) == 0) {
+ } else if (ADVERTISE_EXT_DSN(s) && strncasecmp(b, "ORCPT=", 6) == 0) {
b += 6;
if (!text_to_mailaddr(&s->evp.dsn_orcpt, b)) {
smtp_reply(s, "553 ORCPT address syntax error");
@@ -1446,13 +1450,13 @@ smtp_parse_mail_args(struct smtp_session *s, char *args)
s->flags &= ~SF_8BITMIME;
else if (strcasecmp(b, "BODY=8BITMIME") == 0)
;
- else if (strncasecmp(b, "RET=", 4) == 0) {
+ else if (ADVERTISE_EXT_DSN(s) && strncasecmp(b, "RET=", 4) == 0) {
b += 4;
if (strcasecmp(b, "HDRS") == 0)
s->evp.dsn_ret = DSN_RETHDRS;
else if (strcasecmp(b, "FULL") == 0)
s->evp.dsn_ret = DSN_RETFULL;
- } else if (strncasecmp(b, "ENVID=", 6) == 0) {
+ } else if (ADVERTISE_EXT_DSN(s) && strncasecmp(b, "ENVID=", 6) == 0) {
b += 6;
if (strlcpy(s->evp.dsn_envid, b, sizeof(s->evp.dsn_envid))
>= sizeof(s->evp.dsn_envid)) {
diff --git a/usr.sbin/smtpd/smtpd.conf.5 b/usr.sbin/smtpd/smtpd.conf.5
index 2e9f6e7fd33..920b2945dc6 100644
--- a/usr.sbin/smtpd/smtpd.conf.5
+++ b/usr.sbin/smtpd/smtpd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: smtpd.conf.5,v 1.120 2014/07/08 07:59:31 sobrado Exp $
+.\" $OpenBSD: smtpd.conf.5,v 1.121 2014/07/09 12:44:54 eric Exp $
.\"
.\" Copyright (c) 2008 Janne Johansson <jj@openbsd.org>
.\" Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net>
@@ -17,7 +17,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\"
-.Dd $Mdocdate: July 8 2014 $
+.Dd $Mdocdate: July 9 2014 $
.Dt SMTPD.CONF 5
.Os
.Sh NAME
@@ -599,6 +599,7 @@ Changing the default value might degrade performances.
.Op Ic hostname Ar hostname
.Op Ic hostnames Aq Ar names
.Op Ic mask-source
+.Op Ic no-dsn
.Ek
.Xc
.Pp
@@ -695,6 +696,11 @@ If the
.Ic mask-source
parameter is used, then the listener will skip the "from" part
when prepending the "Received" header.
+.Pp
+If the
+.Ic no-dsn
+parameter is used, DSN (Delivery Status Notification) extension will not
+be enabled.
.It Ic max-message-size Ar n
Specify a maximum message size of
.Ar n
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index c4eabaedf9a..43c3c8f325d 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.466 2014/07/09 09:53:37 eric Exp $ */
+/* $OpenBSD: smtpd.h,v 1.467 2014/07/09 12:44:54 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -78,6 +78,7 @@
#define F_LMTP 0x80
#define F_MASK_SOURCE 0x100
#define F_TLS_VERIFY 0x200
+#define F_EXT_DSN 0x400
/* must match F_* for mta */
#define RELAY_STARTTLS 0x01