Merge pull request from merchise/issue-846

Check if sender address is not null before trying to check the domain.
master
Nebukadneza committed by GitHub
commit f050140be2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
-------------------

@ -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
"""
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 '<MAILER-DAEMON>' instead of '<>'; so let's
# consider void any such thing.
return '@' not in email

Loading…
Cancel
Save