summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2012-12-08 17:57:20 +0200
committerAlexander Bokovoy <ab@samba.org>2012-12-08 18:41:07 +0100
commitb6e2be8e147b4d34a0424a8851b03b24f180048c (patch)
treea7cbb16a4f3f4ee736bb4127204d951725ca5fd0 /buildtools/wafsamba
parent56d9c8c4bf29eb473f9f4e7a7ef16fc6020db6b5 (diff)
downloadsamba-b6e2be8e147b4d34a0424a8851b03b24f180048c.tar.gz
samba-b6e2be8e147b4d34a0424a8851b03b24f180048c.tar.bz2
samba-b6e2be8e147b4d34a0424a8851b03b24f180048c.zip
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
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba_utils.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index cab87a4dbb..c1ac7e29b2 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -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')