diff --git a/gestion/ldap_passwd.py b/gestion/ldap_passwd.py index bdbb8665..00b5919b 100644 --- a/gestion/ldap_passwd.py +++ b/gestion/ldap_passwd.py @@ -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 @@ -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: @@ -123,7 +123,7 @@ def checkpwd(pwd, pwdhash): alg['NTPassword'] = 'nt hash' algo = pwdhash[1:].split('}')[0] - + if algo.startswith('samba'): sambaver = 3 algo = algo[5:]