diff --git a/CHANGELOG.md b/CHANGELOG.md index c50806f5..4dd9438a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -122,6 +122,7 @@ v1.6.0 - 2019-01-18 - Bug: Fetched accounts: Password field is of type "text" ([#789](https://github.com/Mailu/Mailu/issues/789)) - Bug: Auto-forward destination not accepting top level domains ([#818](https://github.com/Mailu/Mailu/issues/818)) - Bug: DOMAIN_REGISTRATION=False in .env was not treated correctly ([#830](https://github.com/Mailu/Mailu/issues/830)) +- Bug: Internal error when checking null sender address ([#846](https://github.com/Mailu/Mailu/issues/846)) v1.5.1 - 2017-11-21 ------------------- diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py index e94bfc28..0b229825 100644 --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -49,5 +49,18 @@ def postfix_sender_login(sender): def postfix_sender_access(sender): """ Simply reject any sender that pretends to be from a local domain """ - localpart, domain_name = models.Email.resolve_domain(sender) - return flask.jsonify("REJECT") if models.Domain.query.get(domain_name) else flask.abort(404) + if not is_void_address(sender): + localpart, domain_name = models.Email.resolve_domain(sender) + return flask.jsonify("REJECT") if models.Domain.query.get(domain_name) else flask.abort(404) + else: + return flask.abort(404) + + +def is_void_address(email): + '''True if the email is void (null) email address. + ''' + if email.startswith('<') and email.endswith('>'): + email = email[1:-1] + # Some MTAs use things like '' instead of '<>'; so let's + # consider void any such thing. + return '@' not in email