[radius_auth] utilisation de hashlib au lieu de md5

Ignore-this: ad72777a01e9f3ce6ea9017b1987a2dc
le module md5 est déprécié

darcs-hash:20120510115602-ce021-e2f913ecb31fe5dcd088c7fea5154b8c4e4354bf.gz
This commit is contained in:
Daniel Stan 2012-05-10 13:56:02 +02:00
parent e15b3beb71
commit 1d164bd426

View file

@ -1,7 +1,7 @@
#! /usr/bin/env python #! /usr/bin/env python
# -*- coding: iso-8859-15 -*- # -*- coding: iso-8859-15 -*-
import os, md5, sys, binascii import os, hashlib, sys, binascii
from syslog import syslog, openlog from syslog import syslog, openlog
sys.path.append('/usr/scripts/gestion') sys.path.append('/usr/scripts/gestion')
@ -19,7 +19,7 @@ def chap_ok(password, challenge, clear_pass) :
try : try :
challenge = binascii.a2b_hex(challenge.replace('0x','')) challenge = binascii.a2b_hex(challenge.replace('0x',''))
password = binascii.a2b_hex(password.replace('0x','')) password = binascii.a2b_hex(password.replace('0x',''))
if md5.new(password[0] + clear_pass + challenge).digest() == password[1:] : if hashlib.md5(password[0] + clear_pass + challenge).digest() == password[1:] :
return True return True
except : except :
return False return False