Skip to content

Commit

Permalink
starttls: Clear unencrypted commands from buffer (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arusekk authored May 18, 2024
1 parent 6e148d7 commit b3a4a2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aiosmtpd/docs/NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

.. towncrier release notes start
1.4.6 (2024-05-06)
==================

* STARTTLS is now fully enforced if used.

1.4.5 (2024-03-02)
==================
Expand Down
3 changes: 3 additions & 0 deletions aiosmtpd/smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ def connection_made(self, transport: asyncio.BaseTransport) -> None:
self._reader._transport = transport # type: ignore[attr-defined]
self._writer._transport = transport # type: ignore[attr-defined]
self.transport = transport
# Discard any leftover unencrypted data
# See https://tools.ietf.org/html/rfc3207#page-7
self._reader._buffer.clear() # type: ignore[attr-defined]
# Do SSL certificate checking as rfc3207 part 4.1 says. Why is
# _extra a protected attribute?
assert self._tls_protocol is not None
Expand Down

0 comments on commit b3a4a2c

Please sign in to comment.