Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CRAM-MD5 fails if Python has been built without HMAC-MD5 support #136134

Open
Assignees
picnixz
Labels
stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error
@ouldriw

Description

@ouldriw

Bug report

Bug description:

When using smtplib to send emails in an environment where MD5 is not supported (e.g. FIPS), using SMTP.login to authenticate with an SMTP server will fail with:

  File "/usr/lib64/python3.9/smtplib.py", line 739, in login    (code, resp) = self.auth(  File "/usr/lib64/python3.9/smtplib.py", line 652, in auth    authobject(challenge).encode('ascii'), eol='')  File "/usr/lib64/python3.9/smtplib.py", line 670, in auth_cram_md5    return self.user + " " + hmac.HMAC(  File "/usr/lib64/python3.9/hmac.py", line 60, in _init_    self._init_hmac(key, msg, digestmod)  File "/usr/lib64/python3.9/hmac.py", line 69, in _init_hmac    self._hmac = _hashopenssl.hmac_new(key, msg, digestmod=digestmod)ValueError: [digital envelope routines] unsupported

The docs for SMTP.login say:
"Each of the authentication methods supported bysmtplib are tried in turn if they are advertised as supported by the server."

But the problem here is auth_cram_md5 is always attempted first and the ValueError is not caught so smtplib never moves on to other authentication methods

CPython versions tested on:

3.9

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp