on est vraiment insensible, et on ajoute un type de mot de passe oubli ;-)

darcs-hash:20060428001240-4ec08-bfd301f6f9dd5ab86759e0d430e8b54e1c6502ba.gz
This commit is contained in:
chove 2006-04-28 02:12:40 +02:00
parent 219e0d050e
commit d11be40f29

View file

@ -1,7 +1,7 @@
# -*- coding: iso8859-15 -*-
###############################################################################
# ldap_passwd.py : manipulation des mots de passes LDAP
# $Id: ldap_passwd.py,v 1.3 2006-04-28 00:09:45 chove Exp $
# $Id: ldap_passwd.py,v 1.4 2006-04-28 00:12:40 chove Exp $
###############################################################################
# The authors of this code are
# Bjorn Ove Grotan <bgrotan@grotan.com>
@ -63,7 +63,8 @@ algos = {
'sha':'Secure Hash Algorithm',
'md5':'MD5',
'smd5':'Seeded MD5',
'crypt':'standard unix crypt'
'crypt':'standard unix crypt',
'cleartext':'clear text'
}
if smb:
algos['lmpassword'] = 'lan man hash'
@ -83,6 +84,7 @@ def mkpasswd(pwd, sambaver=3, algo='SSHA', salt=getsalt()):
LDAP - so default is seeded sha
'''
algo = algo.lower()
if algo not in algos.keys():
raise TypeError, 'Algorithm <%s> not supported in this version.' % algo
@ -106,6 +108,8 @@ def mkpasswd(pwd, sambaver=3, algo='SSHA', salt=getsalt()):
pwdhash = "{sambaNTPassword}" + smbpasswd.lmhash(pwd)
elif sambaver == 2:
pwdhash = "{NTPassword}" + smbpasswd.lmhash(pwd)
elif algo == 'cleartext':
pwdhash = "{CLEARTEXT}" + pwd
return pwdhash.strip()
def checkpwd(pwd, pwdhash):