From d11be40f29e486d643e35887ff2c907c36cdad9c Mon Sep 17 00:00:00 2001 From: chove Date: Fri, 28 Apr 2006 02:12:40 +0200 Subject: [PATCH] on est vraiment insensible, et on ajoute un type de mot de passe oubli ;-) darcs-hash:20060428001240-4ec08-bfd301f6f9dd5ab86759e0d430e8b54e1c6502ba.gz --- gestion/ldap_passwd.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gestion/ldap_passwd.py b/gestion/ldap_passwd.py index df73050d..5e853e53 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.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 @@ -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):