Open
Description
When authenticating using the PLAIN and LOGIN authentication mechanisms over SSL/TLS authentication fails. It will succeed when running the server is using STARTTLS. The following test will fail:
def test_AUTH_LOGIN_success(mock_smtpd_use_starttls, smtpd, user):
with SMTP(smtpd.hostname, smtpd.port) as client:
client.starttls()
code, resp = client.docmd('AUTH', f'LOGIN {encode(user.username)}')
assert code == 334
assert resp == bytes(encode('Password'), 'ascii')
code, resp = client.docmd(f'{encode(user.password)}')
assert code == 235
The following, however, fails:
def test_AUTH_LOGIN_failure(mock_smtpd_use_ssl, smtpd, user):
with SMTP_SSL(smtpd.hostname, smtpd.port) as client:
code, resp = client.docmd('AUTH', f'LOGIN {encode(user.username)}')
assert code == 334
assert resp == bytes(encode('Password'), 'ascii')
code, resp = client.docmd(f'{encode(user.password)}')
assert code == 235 # Fails here because the code is "538 Authentication required."
Metadata
Metadata
Assignees
Labels
No labels