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 05568af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions aiosmtpd/docs/NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

.. towncrier release notes start
* 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 05568af

Please sign in to comment.