aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilles Chehade <gilles@poolp.org>2017-07-31 23:08:06 +0200
committerGilles Chehade <gilles@poolp.org>2017-07-31 23:08:06 +0200
commit5b57fd05d1a33d8205db284eb26a0ab7a5ebc498 (patch)
tree0aafad750921b01c5ddfb78bfbc909b313c2cc36
parentMerge branch 'master' of ssh://ssh.github.com/OpenSMTPD/OpenSMTPD (diff)
downloadOpenSMTPD-5b57fd05d1a33d8205db284eb26a0ab7a5ebc498.tar.xz
OpenSMTPD-5b57fd05d1a33d8205db284eb26a0ab7a5ebc498.zip
sync with openbsd
-rw-r--r--smtpd/aliases.58
-rw-r--r--smtpd/dns.c4
-rw-r--r--smtpd/makemap.c19
-rw-r--r--smtpd/mda.c8
-rw-r--r--smtpd/parse.y13
-rw-r--r--smtpd/parser.c16
-rw-r--r--smtpd/smtp_session.c8
-rw-r--r--smtpd/smtpctl.c15
-rw-r--r--smtpd/smtpctl/CVS/Entries2
-rw-r--r--smtpd/smtpctl/Makefile3
-rw-r--r--smtpd/smtpd.conf.565
-rw-r--r--smtpd/smtpd.h7
-rw-r--r--smtpd/smtpd/CVS/Entries2
13 files changed, 71 insertions, 99 deletions
diff --git a/smtpd/aliases.5 b/smtpd/aliases.5
index ea89ea3e..6f89dc56 100644
--- a/smtpd/aliases.5
+++ b/smtpd/aliases.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: aliases.5,v 1.13 2016/06/30 18:41:39 gilles Exp $
+.\" $OpenBSD: aliases.5,v 1.14 2017/05/29 12:16:50 tedu Exp $
.\"
.\" Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 30 2016 $
+.Dd $Mdocdate: May 29 2017 $
.Dt ALIASES 5
.Os
.Sh NAME
@@ -69,9 +69,7 @@ Include any definitions in
as alias entries.
The format of the file is identical to this one.
.It Ar user-part@domain-part
-An email address in RFC 5322 format
-(see
-.Xr mailaddr 7 ) .
+An email address in RFC 5322 format.
If an address extension is appended to the user-part,
it is first compared for an exact match.
It is then stripped so that an address such as user+ext@example.com
diff --git a/smtpd/dns.c b/smtpd/dns.c
index d4dc267b..0f12f922 100644
--- a/smtpd/dns.c
+++ b/smtpd/dns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dns.c,v 1.83 2015/10/28 07:28:13 gilles Exp $ */
+/* $OpenBSD: dns.c,v 1.84 2017/05/31 04:50:55 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -246,7 +246,7 @@ dns_imsg(struct mproc *p, struct imsg *imsg)
as = res_query_async(s->name, C_IN, T_MX, NULL);
if (as == NULL) {
- log_warn("warn: req_query_async: %s", s->name);
+ log_warn("warn: res_query_async: %s", s->name);
m_create(s->p, IMSG_MTA_DNS_HOST_END, 0, 0, -1);
m_add_id(s->p, s->reqid);
m_add_int(s->p, DNS_EINVAL);
diff --git a/smtpd/makemap.c b/smtpd/makemap.c
index af24a8c0..8f32e766 100644
--- a/smtpd/makemap.c
+++ b/smtpd/makemap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makemap.c,v 1.66 2017/01/09 09:53:23 reyk Exp $ */
+/* $OpenBSD: makemap.c,v 1.67 2017/07/27 18:48:30 sunil Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -55,12 +55,7 @@ static int dump_db(const char *, DBTYPE);
struct smtpd smtpd;
struct smtpd *env = &smtpd;
char *source;
-extern char *__progname;
-
-enum program {
- P_MAKEMAP,
- P_NEWALIASES
-} mode;
+static int mode;
enum output_type {
T_PLAIN,
@@ -84,7 +79,7 @@ fork_proc_backend(const char *backend, const char *conf, const char *procname)
}
int
-makemap(int argc, char *argv[])
+makemap(int prog_mode, int argc, char *argv[])
{
struct stat sb;
char dbname[PATH_MAX];
@@ -98,7 +93,7 @@ makemap(int argc, char *argv[])
log_init(1, LOG_MAIL);
- mode = strcmp(__progname, "newaliases") ? P_MAKEMAP : P_NEWALIASES;
+ mode = prog_mode;
conf = CONF_FILE;
type = T_PLAIN;
opts = "b:C:d:ho:O:t:U";
@@ -501,9 +496,9 @@ static void
usage(void)
{
if (mode == P_NEWALIASES)
- fprintf(stderr, "usage: %s [-f file]\n", __progname);
+ fprintf(stderr, "usage: newaliases [-f file]\n");
else
- fprintf(stderr, "usage: %s [-U] [-d dbtype] [-o dbfile] "
- "[-t type] file\n", __progname);
+ fprintf(stderr, "usage: makemap [-U] [-d dbtype] [-o dbfile] "
+ "[-t type] file\n");
exit(1);
}
diff --git a/smtpd/mda.c b/smtpd/mda.c
index ef6b6f8e..ead92a85 100644
--- a/smtpd/mda.c
+++ b/smtpd/mda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda.c,v 1.126 2016/11/30 17:43:32 eric Exp $ */
+/* $OpenBSD: mda.c,v 1.127 2017/07/31 16:45:03 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -617,7 +617,8 @@ mda_getlastline(int fd, char *dst, size_t dstsz)
char *ln = NULL;
size_t sz = 0;
ssize_t len;
-
+ int out = 0;
+
if (lseek(fd, 0, SEEK_SET) < 0) {
log_warn("warn: mda: lseek");
close(fd);
@@ -632,10 +633,11 @@ mda_getlastline(int fd, char *dst, size_t dstsz)
while ((len = getline(&ln, &sz, fp)) != -1) {
if (ln[len - 1] == '\n')
ln[len - 1] = '\0';
+ out = 1;
}
fclose(fp);
- if (sz != 0) {
+ if (out) {
(void)strlcpy(dst, "\"", dstsz);
(void)strnvis(dst + 1, ln, dstsz - 2, VIS_SAFE | VIS_CSTYLE);
(void)strlcat(dst, "\"", dstsz);
diff --git a/smtpd/parse.y b/smtpd/parse.y
index 20736f65..b522d402 100644
--- a/smtpd/parse.y
+++ b/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.196 2017/05/22 13:43:15 gilles Exp $ */
+/* $OpenBSD: parse.y,v 1.197 2017/07/11 06:08:40 natano Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -169,7 +169,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 NODSN SESSION
+%token TABLE SMTPS CERTIFICATE DOMAIN BOUNCEWARN LIMIT INET4 INET6 NODSN SESSION
%token RELAY BACKUP VIA DELIVER TO LMTP MAILDIR MBOX RCPTTO 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 DHE
@@ -515,14 +515,6 @@ opt_if_listen : INET4 {
listen_opts.options |= LO_SSL;
listen_opts.ssl = F_STARTTLS;
}
- | SECURE {
- if (listen_opts.options & LO_SSL) {
- yyerror("TLS mode already specified");
- YYERROR;
- }
- listen_opts.options |= LO_SSL;
- listen_opts.ssl = F_SSL;
- }
| TLS_REQUIRE {
if (listen_opts.options & LO_SSL) {
yyerror("TLS mode already specified");
@@ -1512,7 +1504,6 @@ lookup(char *s)
{ "reject", REJECT },
{ "relay", RELAY },
{ "scheduler", SCHEDULER },
- { "secure", SECURE },
{ "sender", SENDER },
{ "senders", SENDERS },
{ "session", SESSION },
diff --git a/smtpd/parser.c b/smtpd/parser.c
index bb019c13..df90e508 100644
--- a/smtpd/parser.c
+++ b/smtpd/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.40 2015/01/09 08:28:02 gilles Exp $ */
+/* $OpenBSD: parser.c,v 1.41 2017/07/31 16:38:33 gilles Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
@@ -117,20 +117,6 @@ cmd_install(const char *pattern, int (*cmd)(int, struct parameter*))
return (n);
}
-static void
-cmd_dump(struct node *node, int depth)
-{
- struct node *n;
- int i;
-
- for(i = 0; i < depth; i++)
- printf(" ");
- printf("%s\n", node->token ? node->token : "");
-
- TAILQ_FOREACH(n, &node->children, entry)
- cmd_dump(n, depth + 1);
-}
-
static int
cmd_check(const char *str, struct node *node, struct parameter *res)
{
diff --git a/smtpd/smtp_session.c b/smtpd/smtp_session.c
index 7790a3b0..7060b80b 100644
--- a/smtpd/smtp_session.c
+++ b/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.303 2017/05/17 14:00:06 deraadt Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.304 2017/06/19 08:35:56 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -1474,12 +1474,12 @@ smtp_data_io(struct io *io, int evt, void *arg)
break;
case IO_LOWAT:
- if (s->tx->dataeom && io_queued(s->tx->oev) == 0) {
- smtp_data_io_done(s);
- } else if (io_paused(s->io, IO_IN)) {
+ if (io_paused(s->io, IO_IN)) {
log_debug("debug: smtp: %p: filter congestion over: resuming session", s);
io_resume(s->io, IO_IN);
}
+ if (s->tx->dataeom && io_queued(s->tx->oev) == 0)
+ smtp_data_io_done(s);
break;
default:
diff --git a/smtpd/smtpctl.c b/smtpd/smtpctl.c
index 63dace23..bd858632 100644
--- a/smtpd/smtpctl.c
+++ b/smtpd/smtpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpctl.c,v 1.153 2017/05/19 19:56:42 eric Exp $ */
+/* $OpenBSD: smtpctl.c,v 1.154 2017/07/27 18:48:30 sunil Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
@@ -1096,10 +1096,8 @@ sendmail_compat(int argc, char **argv)
* that should invoke makemap/newaliases.
*/
for (i = 1; i < argc; i++)
- if (strncmp(argv[i], "-bi", 3) == 0) {
- __progname = "newaliases";
- exit(makemap(argc, argv));
- }
+ if (strncmp(argv[i], "-bi", 3) == 0)
+ exit(makemap(P_NEWALIASES, argc, argv));
if (!srv_connect())
offlinefp = offline_file();
@@ -1115,9 +1113,10 @@ sendmail_compat(int argc, char **argv)
sendmail = 1;
exit(enqueue(argc, argv, offlinefp));
- } else if (strcmp(__progname, "makemap") == 0 ||
- strcmp(__progname, "newaliases") == 0)
- exit(makemap(argc, argv));
+ } else if (strcmp(__progname, "makemap") == 0)
+ exit(makemap(P_MAKEMAP, argc, argv));
+ else if (strcmp(__progname, "newaliases") == 0)
+ exit(makemap(P_NEWALIASES, argc, argv));
}
static void
diff --git a/smtpd/smtpctl/CVS/Entries b/smtpd/smtpctl/CVS/Entries
index 8214dd8b..b82bc161 100644
--- a/smtpd/smtpctl/CVS/Entries
+++ b/smtpd/smtpctl/CVS/Entries
@@ -1,2 +1,2 @@
-/Makefile/1.44/Wed Mar 30 06:38:46 2016//
+/Makefile/1.45/Mon Jul 31 21:07:37 2017//
D
diff --git a/smtpd/smtpctl/Makefile b/smtpd/smtpctl/Makefile
index 1285fdb4..0355bb93 100644
--- a/smtpd/smtpctl/Makefile
+++ b/smtpd/smtpctl/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.44 2016/03/30 06:38:46 jmc Exp $
+# $OpenBSD: Makefile,v 1.45 2017/07/03 22:21:47 espie Exp $
.PATH: ${.CURDIR}/..
@@ -19,6 +19,7 @@ CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual
CFLAGS+= -Wsign-compare
CFLAGS+= -Werror-implicit-function-declaration
CFLAGS+= -DNO_IO
+YFLAGS=
SRCS= enqueue.c
SRCS+= parser.c
diff --git a/smtpd/smtpd.conf.5 b/smtpd/smtpd.conf.5
index 7aa2c424..c08e45ee 100644
--- a/smtpd/smtpd.conf.5
+++ b/smtpd/smtpd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: smtpd.conf.5,v 1.169 2017/05/24 13:26:03 jmc Exp $
+.\" $OpenBSD: smtpd.conf.5,v 1.174 2017/07/11 06:08:40 natano 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: May 24 2017 $
+.Dd $Mdocdate: July 11 2017 $
.Dt SMTPD.CONF 5
.Os
.Sh NAME
@@ -653,52 +653,28 @@ of inflight envelopes falls below
.Ar num .
Changing the default value might degrade performance.
.It Xo
-.Ic listen on socket
-.Op Ic mask-source
-.br
.Bk -words
.Ic listen on Ar interface
.Op Ar family
.Op Ic port Ar port
-.Op Ic tls | tls-require | tls-require verify | smtps | secure
+.Op Ic tls | tls-require | tls-require verify | smtps
.Op Ic pki Ar pkiname
.Op Ic ca Ar caname
.Op Ic auth | auth-optional Op < Ns Ar authtable Ns >
.Op Ic tag Ar tag
.Op Ic hostname Ar hostname
.Op Ic hostnames No < Ns Ar names Ns >
-.Op Ic senders No < Ns Ar users Ns > Op masquerade
+.Op Ic senders No < Ns Ar users Ns > Op Cm masquerade
.Op Ic mask-source
.Op Ic received-auth
.Op Ic no-dsn
.Ek
.Xc
-.Pp
-Specify a
-.Ic socket
-or an
+Specify an
.Ar interface
+and optional
+.Ar port
to listen on for incoming connections.
-The
-.Ic listen on socket
-directive is used to modify the behavior of the listener handling
-messages submitted through the local enqueuer, for example via the
-.Xr mail 1
-utility.
-This is an optional directive: if unspecified then
-.Xr smtpd 8
-will simply listen for connections on the
-.Ic socket
-as if it was configured with no option.
-Clients connecting through the
-.Ic socket
-will always be tagged with the 'local'
-.Ic tag .
-.Pp
-To listen on a specific network interface, specify an
-.Ar interface
-and an optional
-.Ar port .
An interface group, an IP address or a domain name may
be used in place of
.Ar interface .
@@ -725,8 +701,6 @@ If
is specified, the client must provide a valid certificate to be
able to establish an SMTP session.
.Pp
-.Ic secure
-may be specified to provide both STARTTLS and SMTPS services.
Host certificates may be used for these connections,
and must be previously declared using the pki directive.
If
@@ -795,7 +769,9 @@ parameter is used, then
will look up a mapping of username to email addresses to see whether
the authenticated user is allowed to submit mail
as the sender that was provided in the SMTP session.
-In addition, if the masquerade option is provided,
+In addition, if the
+.Cm masquerade
+option is provided,
the From header will be rewritten
to match the sender provided in the SMTP session.
.Pp
@@ -817,6 +793,27 @@ If the
.Ic no-dsn
parameter is used, DSN (Delivery Status Notification) extension will not
be enabled.
+.It Xo
+.Ic listen on socket
+.Op Ic mask-source
+.Xc
+Modify behaviour for the listener which handles messages
+submitted through the local enqueuer,
+such as the
+.Xr mail 1
+utility.
+Clients connecting in this manner are tagged with the "local"
+.Ic tag .
+.Pp
+Parameters available are:
+.Bl -tag -width "mask-source"
+.It Ic mask-source
+Skip the
+.Ic from
+part when prepending the
+.Dq Received
+header.
+.El
.It Ic max-message-size Ar n
Specify a maximum message size of
.Ar n
diff --git a/smtpd/smtpd.h b/smtpd/smtpd.h
index f158efa7..4474f447 100644
--- a/smtpd/smtpd.h
+++ b/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.532 2017/05/26 21:30:00 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.533 2017/07/27 18:48:30 sunil Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -104,6 +104,9 @@
#define MTA_EXT_DSN 0x400
+#define P_NEWALIASES 0
+#define P_MAKEMAP 1
+
struct userinfo {
char username[SMTPD_VUSERNAME_SIZE];
char directory[PATH_MAX];
@@ -1254,7 +1257,7 @@ size_t mda_expand_format(char *, size_t, const struct envelope *,
/* makemap.c */
-int makemap(int, char **);
+int makemap(int, int, char **);
/* mailaddr.c */
diff --git a/smtpd/smtpd/CVS/Entries b/smtpd/smtpd/CVS/Entries
index 669ea77a..ff39838b 100644
--- a/smtpd/smtpd/CVS/Entries
+++ b/smtpd/smtpd/CVS/Entries
@@ -1,2 +1,2 @@
-/Makefile/1.87/Fri May 26 21:41:15 2017//
+/Makefile/1.87/Fri May 26 21:42:52 2017//
D