1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

wafsamba: replace try:except: case with explicit comment about FIPS mode

Since exceptions will be caught be outer try:except: pair anyway, mark
the test of MD5 code by the comment that explains why we need to really
test it.

Do it for both hashlib.md5 and md5 modules.

Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Sat Dec  8 18:41:07 CET 2012 on sn-devel-104
This commit is contained in:
Alexander Bokovoy 2012-12-08 17:57:20 +02:00
parent 56d9c8c4bf
commit b6e2be8e14

View File

@ -388,17 +388,16 @@ def RUN_COMMAND(cmd,
# make sure we have md5. some systems don't have it
try:
from hashlib import md5
try:
foo = md5.md5('abcd')
except ValueError:
raise
# Even if hashlib.md5 exists, it may be unusable.
# Try to use MD5 function. In FIPS mode this will cause an exception
# and we'll get to the replacement code
foo = md5.md5('abcd')
except:
try:
import md5
try:
foo = md5.md5('abcd')
except ValueError:
raise
# repeat the same check here, mere success of import is not enough.
# Try to use MD5 function. In FIPS mode this will cause an exception
foo = md5.md5('abcd')
except:
import Constants
Constants.SIG_NIL = hash('abcd')