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):