diff options
author | 2019-08-25 03:40:45 +0000 | |
---|---|---|
committer | 2019-08-25 03:40:45 +0000 | |
commit | a1d6d12691b4c7e6e1381baaf23b8ca6be176258 (patch) | |
tree | d51d590bd1120ea4aab41ac6f24907d29dcd877b | |
parent | Simply logic of detaching things. scsi_detach_bus() folded into (diff) | |
download | wireguard-openbsd-a1d6d12691b4c7e6e1381baaf23b8ca6be176258.tar.xz wireguard-openbsd-a1d6d12691b4c7e6e1381baaf23b8ca6be176258.zip |
Allow for "port smtp" and "port smtps" on listen statement.
This was previously not allowed, because both smtp and smtps are keywords.
Since port's argument is non-optional and smtp and smtps are common enough
there is no chance for misinterpretation.
Problem reported by phatbuckett <at> gmail <dot> com
OK gilles@
-rw-r--r-- | usr.sbin/smtpd/parse.y | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index bafa3bccf21..6d7ba697bba 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.258 2019/08/23 19:05:01 martijn Exp $ */ +/* $OpenBSD: parse.y,v 1.259 2019/08/25 03:40:45 martijn Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -1863,6 +1863,38 @@ opt_if_listen : INET4 { free($2); listen_opts.port = ntohs(servent->s_port); } + | PORT SMTP { + struct servent *servent; + + if (listen_opts.options & LO_PORT) { + yyerror("port already specified"); + YYERROR; + } + listen_opts.options |= LO_PORT; + + servent = getservbyname("smtp", "tcp"); + if (servent == NULL) { + yyerror("invalid port: smtp"); + YYERROR; + } + listen_opts.port = ntohs(servent->s_port); + } + | PORT SMTPS { + struct servent *servent; + + if (listen_opts.options & LO_PORT) { + yyerror("port already specified"); + YYERROR; + } + listen_opts.options |= LO_PORT; + + servent = getservbyname("smtps", "tcp"); + if (servent == NULL) { + yyerror("invalid port: smtps"); + YYERROR; + } + listen_opts.port = ntohs(servent->s_port); + } | PORT NUMBER { if (listen_opts.options & LO_PORT) { yyerror("port already specified"); |