cpython: 4da7edbf78d4 (original) (raw)

Mercurial > cpython

changeset 98491:4da7edbf78d4

Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not supported. Check if it is supported, it may not be supported on OpenBSD for example. [#25287]

Victor Stinner victor.stinner@gmail.com
date Fri, 02 Oct 2015 23:00:39 +0200
parents 45640def1e3d
children 72129c767c92
files Doc/library/crypt.rst Lib/crypt.py Misc/NEWS
diffstat 3 files changed, 6 insertions(+), 3 deletions(-)[+] [-] Doc/library/crypt.rst 2 Lib/crypt.py 3 Misc/NEWS 4

line wrap: on

line diff

--- a/Doc/library/crypt.rst +++ b/Doc/library/crypt.rst @@ -64,7 +64,7 @@ Module Attributes A list of available password hashing algorithms, as crypt.METHOD_* objects. This list is sorted from strongest to

Module Functions

--- a/Lib/crypt.py +++ b/Lib/crypt.py @@ -54,9 +54,8 @@ METHOD_SHA256 = _Method('SHA256', '5', 1 METHOD_SHA512 = _Method('SHA512', '6', 16, 106) methods = [] -for _method in (METHOD_SHA512, METHOD_SHA256, METHOD_MD5): +for _method in (METHOD_SHA512, METHOD_SHA256, METHOD_MD5, METHOD_CRYPT): _result = crypt('', _method) if _result and len(_result) == _method.total_size: methods.append(_method) -methods.append(METHOD_CRYPT) del _result, _method

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -40,6 +40,10 @@ Core and Builtins Library ------- +- Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not