Skip to content

Commit

Permalink
starttls: Clear unencrypted commands from buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Arusekk committed May 18, 2024
1 parent 7c121ef commit 8c31694
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()
# 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 8c31694

Please sign in to comment.