summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2016-02-22 16:19:06 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2016-02-22 16:19:06 +0000
commitceedca6f43776a7ce90db20acb1e65bc6855033c (patch)
tree373ab53c9df63d9db881730214f7ccae57109ade
parent7a859003e629f783d5a5ae2b2e0a2366e711acdc (diff)
the default address family for a listener was set too late and would
override the value provided by the user if any. this commit moves the initialization earlier to avoid this. issue reported by and fix ok jturner@
-rw-r--r--usr.sbin/smtpd/parse.y13
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index c3747a86abf..33bae1c3127 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.182 2016/02/13 20:43:07 gilles Exp $ */
+/* $OpenBSD: parse.y,v 1.183 2016/02/22 16:19:05 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -469,7 +469,7 @@ opt_if_listen : INET4 {
if (config_lo_filter(&listen_opts, $2)) {
YYERROR;
}
-}
+ }
| SMTPS {
if (listen_opts.options & LO_SSL) {
yyerror("TLS mode already specified");
@@ -663,7 +663,7 @@ opt_if_listen : INET4 {
;
listener_type : socket_listener
- | interface_listener
+ | if_listener
;
socket_listener : SOCKET sock_listen {
@@ -675,10 +675,7 @@ socket_listener : SOCKET sock_listen {
}
;
-interface_listener:
- STRING if_listen {
- listen_opts.family = AF_UNSPEC;
- listen_opts.flags |= F_EXT_DSN;
+if_listener : STRING if_listen {
listen_opts.ifx = $1;
create_if_listener(conf->sc_listeners, &listen_opts);
}
@@ -882,6 +879,8 @@ main : BOUNCEWARN {
| LIMIT SCHEDULER limits_scheduler
| LISTEN {
memset(&listen_opts, 0, sizeof listen_opts);
+ listen_opts.family = AF_UNSPEC;
+ listen_opts.flags |= F_EXT_DSN;
} ON listener_type
| FILTER STRING STRING {
if (!strcmp($3, "chain")) {