Skip to content

Commit c040879

Browse files
committed
Fix EHLO response duplication if login methods come last
1 parent db72a1f commit c040879

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

emailproxy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
__author__ = 'Simon Robinson'
77
__copyright__ = 'Copyright (c) 2025 Simon Robinson'
88
__license__ = 'Apache 2.0'
9-
__package_version__ = '2025.7.18' # for pyproject.toml usage only - needs to be ast.literal_eval() compatible
9+
__package_version__ = '2025.10.2' # for pyproject.toml usage only - needs to be ast.literal_eval() compatible
1010
__version__ = '-'.join('%02d' % int(part) for part in __package_version__.split('.')) # ISO 8601 (YYYY-MM-DD)
1111

1212
import abc
@@ -2313,12 +2313,12 @@ def process_data(self, byte_data):
23132313
updated_response = re.sub(r'250([ -])AUTH(?: [A-Z\d_-]{1,20})+', r'250\1AUTH PLAIN LOGIN', str_data,
23142314
flags=re.IGNORECASE)
23152315
updated_response = re.sub(r'250([ -])STARTTLS(?:\r\n)?', r'', updated_response, flags=re.IGNORECASE)
2316+
self.ehlo_response += '%s\r\n' % updated_response if updated_response else ''
23162317
if ehlo_end and self.ehlo.lower().startswith(b'ehlo'):
23172318
if 'AUTH PLAIN LOGIN' not in self.ehlo_response:
23182319
self.ehlo_response += '250-AUTH PLAIN LOGIN\r\n'
23192320
if self.custom_configuration['local_starttls'] and not self.client_connection.ssl_connection:
23202321
self.ehlo_response += '250-STARTTLS\r\n' # we always remove STARTTLS; re-add if permitted
2321-
self.ehlo_response += '%s\r\n' % updated_response if updated_response else ''
23222322

23232323
if ehlo_end:
23242324
self.client_connection.connection_state = SMTPOAuth2ClientConnection.STATE.PENDING

0 commit comments

Comments
 (0)