From 0c43bc40d89359819e5bd8bc44d0d294b5c1d069 Mon Sep 17 00:00:00 2001 From: chove Date: Fri, 28 Apr 2006 02:01:09 +0200 Subject: [PATCH] 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 --- gestion/ldap_passwd.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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:]