mirror of
				https://github.com/optim-enterprises-bv/Mailu.git
				synced 2025-10-30 17:47:55 +00:00 
			
		
		
		
	Merge pull request #850 from merchise/issue-846
Check if sender address is not null before trying to check the domain.
This commit is contained in:
		| @@ -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: 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: 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: 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 | v1.5.1 - 2017-11-21 | ||||||
| ------------------- | ------------------- | ||||||
|   | |||||||
| @@ -49,5 +49,18 @@ def postfix_sender_login(sender): | |||||||
| def postfix_sender_access(sender): | def postfix_sender_access(sender): | ||||||
|     """ Simply reject any sender that pretends to be from a local domain |     """ 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) |         localpart, domain_name = models.Email.resolve_domain(sender) | ||||||
|         return flask.jsonify("REJECT") if models.Domain.query.get(domain_name) else flask.abort(404) |         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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Nebukadneza
					Nebukadneza