From eff6c34632c8c4097c94162b38d5ca97b06ba15a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Tue, 4 Dec 2018 15:40:07 +0200 Subject: [PATCH] Catch asterisk before resolve_domain Asterisk results in IDNA error and a 500 return code. --- core/admin/mailu/internal/views/postfix.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py index 894532a3..7343459a 100644 --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -27,6 +27,8 @@ def postfix_alias_map(alias): @internal.route("/postfix/transport/") def postfix_transport(email): + if email == '*': + return flask.abort(404) localpart, domain_name = models.Email.resolve_domain(email) relay = models.Relay.query.get(domain_name) or flask.abort(404) return flask.jsonify("smtp:[{}]".format(relay.smtp))