python / python/cpython

Smtp auth login should fail immediately if error is bad authentication

Open
#100,331 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib topic-email type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Bug report

when using smtplib.SMTP.login, library is using different authentication schemes if available: cram-md5, plain, login
when cram-md5 fails with bad password (smtp error code 535), there is no point in trying plain and login.
Also when server is behind a proxy doing ssl termination, plain and login may fail with a different failure mode:
unprotected password needs ssl mode
leading to confusion on what the real problem is.

Your environment

  • CPython versions tested on: conda python 3.9 (concerned code is identical on trunk)
  • Operating system and architecture: Ubuntu 22.04
Linked PRs
  • gh-100332

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with smtplib.SMTP.login and review linked PR gh-100332, which addresses this report. Verify that a bad-authentication response from one authentication scheme stops further attempts and that the resulting error remains representative of the authentication failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.