diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-12-12 14:44:37 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-12-12 14:44:37 +0000 |
commit | be889dac5acefea176a22d383964cde31a3f5fa7 (patch) | |
tree | ac5e766fdb4bbc056c8254a23c2227a5fa37a16a /usr.sbin/smtpd | |
parent | 35b8f4d18393e2207d1e6851a8f343d274e941f8 (diff) |
check in parse.y that pki param is a valid hostname
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/parse.y | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index 13e371e70b9..26aecfba828 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.172 2015/12/12 12:38:36 gilles Exp $ */ +/* $OpenBSD: parse.y,v 1.173 2015/12/12 14:44:36 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -891,6 +891,15 @@ main : BOUNCEWARN { } filter_args | PKI STRING { char buf[HOST_NAME_MAX+1]; + + /* if not catchall, check that it is a valid domain */ + if (strcmp($2, "*") != 0) { + if (! res_hnok($2)) { + yyerror("not a valid domain name: %s", $2); + free($2); + YYERROR; + } + } xlowercase(buf, $2, sizeof(buf)); free($2); pki = dict_get(conf->sc_pki_dict, buf); |