crypt s'crit en minuscules contrairement aux autres methodes cites

pour infor, les anciens mot de passes sont en crypt,
certains sont en SMD5
d'autres sont en SSHA (les nouveaux)

darcs-hash:20060428000109-4ec08-3efc6459d169a2a85498f5dc23a86b041b6ca002.gz
This commit is contained in:
chove 2006-04-28 02:01:09 +02:00
parent 56078717bb
commit 0c43bc40d8

View file

@ -1,7 +1,7 @@
# -*- coding: iso8859-15 -*-
###############################################################################
# ldap_passwd.py : manipulation des mots de passes LDAP
# $Id: ldap_passwd.py,v 1.1 2006-04-27 23:53:03 chove Exp $
# $Id: ldap_passwd.py,v 1.2 2006-04-28 00:01:09 chove Exp $
###############################################################################
# The authors of this code are
# Bjorn Ove Grotan <bgrotan@grotan.com>
@ -75,7 +75,7 @@ def mkpasswd(pwd, sambaver=3, algo='SSHA', salt=getsalt()):
'SHA':'Secure Hash Algorithm',
'MD5':'MD5',
'SMD5':'Seeded MD5',
'CRYPT':'standard unix crypt'
'crypt':'standard unix crypt'
}
if smb:
@ -93,8 +93,8 @@ def mkpasswd(pwd, sambaver=3, algo='SSHA', salt=getsalt()):
pwdhash = "{MD5}" + base64.encodestring(md5.new(str(pwd)).digest())
elif algo == 'SMD5':
pwdhash = "{SMD5}" + base64.encodestring(md5.new(str(pwd) + salt).digest() + salt)
elif algo =='CRYPT':
pwdhash = "{CRYPT}" + crypt.crypt(str(pwd),getsalt(length=2)) # crypt only uses a salt of length 2
elif algo =='crypt':
pwdhash = "{crypt}" + crypt.crypt(str(pwd),getsalt(length=2)) # crypt only uses a salt of length 2
elif algo == 'LMPassword':
if sambaver==3:
pwdhash = "{sambaLMPassword}" + smbpasswd.lmhash(pwd)
@ -115,7 +115,7 @@ def checkpwd(pwd, pwdhash):
'SHA':'Secure Hash Algorithm',
'MD5':'MD5',
'SMD5':'Seeded MD5',
'CRYPT':'standard unix crypt'
'crypt':'standard unix crypt'
}
if smb: