commit 180c1141123301764db43dfd435d8063048b1502 Author: Isis Lovecruft isis@torproject.org Date: Wed May 28 18:15:30 2014 +0000
Update b.e.server.MailDelivery.validateFrom() docstring. --- lib/bridgedb/email/server.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/bridgedb/email/server.py b/lib/bridgedb/email/server.py index 96527f5..cdc1721 100644 --- a/lib/bridgedb/email/server.py +++ b/lib/bridgedb/email/server.py @@ -692,11 +692,19 @@ class MailDelivery(object): return hdr
def validateFrom(self, helo, origin): - """Validate the ``"From:"`` address on the incoming email. + """Validate the ``MAIL FROM:`` address on the incoming SMTP connection.
This is done at the SMTP layer. Meaning that if a Postfix or other email server is proxying emails from the outside world to BridgeDB, - the ``origin.domain`` will be set to the local hostname. + the :api:`origin.domain <twisted.email.smtp.Address.domain` will be + set to the local hostname. Therefore, if the SMTP ``MAIL FROM:`` + domain name is our own hostname (as returned from + :func:`socket.gethostname`) or our own FQDN, allow the connection. + + Otherwise, if the ``MAIL FROM:`` domain has a canonical domain in our + mapping (taken from :ivar:`context.canon <MailContext.canon>`, which + is taken in turn from the ``EMAIL_DOMAIN_MAP``), then our + :ivar:`fromCanonicalSMTP` is set to that domain.
:type helo: tuple :param helo: The lines received during SMTP client HELO.
tor-commits@lists.torproject.org