summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/parse.y
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@cvs.openbsd.org>2015-12-12 11:31:30 +0000
committerSunil Nimmagadda <sunil@cvs.openbsd.org>2015-12-12 11:31:30 +0000
commit69a4d8adf4ef019650632df65037817078856840 (patch)
tree7ece1c723e593ab262cb881866eefd8b5e451d9b /usr.sbin/smtpd/parse.y
parent07e85fed5c588ee19838edcb65ecb563037006f6 (diff)
Implement senders map.
senders table allows to restrict the addresses that an authenticated user can use in the SMTP dialogue. Ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/parse.y')
-rw-r--r--usr.sbin/smtpd/parse.y22
1 files changed, 21 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index b45dd260ce7..fa8bc4c4987 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.167 2015/12/12 09:00:22 gilles Exp $ */
+/* $OpenBSD: parse.y,v 1.168 2015/12/12 11:31:29 sunil Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -114,6 +114,7 @@ enum listen_options {
LO_HOSTNAMES = 0x000100,
LO_MASKSOURCE = 0x000200,
LO_NODSN = 0x000400,
+ LO_SENDERS = 0x000800,
LO_RECEIVEDAUTH = 0x001000,
LO_CA = 0x010000
};
@@ -131,6 +132,7 @@ static struct listen_opts {
char *tag;
char *hostname;
struct table *hostnametable;
+ struct table *sendertable;
uint16_t flags;
uint32_t options;
@@ -619,6 +621,22 @@ opt_listen : INET4 {
listen_opts.options |= LO_NODSN;
listen_opts.flags &= ~F_EXT_DSN;
}
+ | SENDERS tables {
+ struct table *t = $2;
+
+ if (listen_opts.options & LO_SENDERS) {
+ yyerror("senders already specified");
+ YYERROR;
+ }
+ listen_opts.options |= LO_SENDERS;
+
+ if (! table_check_use(t, T_DYNAMIC|T_HASH, K_MAILADDRMAP)) {
+ yyerror("invalid use of table \"%s\" as "
+ "SENDERS parameter", t->t_name);
+ YYERROR;
+ }
+ listen_opts.sendertable = t;
+ }
;
listen : opt_listen listen
@@ -2081,6 +2099,8 @@ config_listener(struct listener *h, struct listen_opts *lo)
(void)strlcpy(h->hostname, lo->hostname, sizeof(h->hostname));
if (lo->hostnametable)
(void)strlcpy(h->hostnametable, lo->hostnametable->t_name, sizeof(h->hostnametable));
+ if (lo->sendertable)
+ (void)strlcpy(h->sendertable, lo->sendertable->t_name, sizeof(h->sendertable));
if (lo->ssl & F_TLS_VERIFY)
h->flags |= F_TLS_VERIFY;