Catch asterisk before resolve_domain

Asterisk results in IDNA error and a 500 return code.
master
Tim Möhlmann 6 years ago committed by GitHub
parent ed81c076f2
commit eff6c34632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,6 +27,8 @@ def postfix_alias_map(alias):
@internal.route("/postfix/transport/<email>") @internal.route("/postfix/transport/<email>")
def postfix_transport(email): def postfix_transport(email):
if email == '*':
return flask.abort(404)
localpart, domain_name = models.Email.resolve_domain(email) localpart, domain_name = models.Email.resolve_domain(email)
relay = models.Relay.query.get(domain_name) or flask.abort(404) relay = models.Relay.query.get(domain_name) or flask.abort(404)
return flask.jsonify("smtp:[{}]".format(relay.smtp)) return flask.jsonify("smtp:[{}]".format(relay.smtp))

Loading…
Cancel
Save