on est vraiment insensible, et on ajoute un type de mot de passe oubli ;-)
darcs-hash:20060428001240-4ec08-bfd301f6f9dd5ab86759e0d430e8b54e1c6502ba.gz
This commit is contained in:
parent
219e0d050e
commit
d11be40f29
1 changed files with 6 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: iso8859-15 -*-
|
# -*- coding: iso8859-15 -*-
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# ldap_passwd.py : manipulation des mots de passes LDAP
|
# 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
|
# The authors of this code are
|
||||||
# Bjorn Ove Grotan <bgrotan@grotan.com>
|
# Bjorn Ove Grotan <bgrotan@grotan.com>
|
||||||
|
@ -63,7 +63,8 @@ algos = {
|
||||||
'sha':'Secure Hash Algorithm',
|
'sha':'Secure Hash Algorithm',
|
||||||
'md5':'MD5',
|
'md5':'MD5',
|
||||||
'smd5':'Seeded MD5',
|
'smd5':'Seeded MD5',
|
||||||
'crypt':'standard unix crypt'
|
'crypt':'standard unix crypt',
|
||||||
|
'cleartext':'clear text'
|
||||||
}
|
}
|
||||||
if smb:
|
if smb:
|
||||||
algos['lmpassword'] = 'lan man hash'
|
algos['lmpassword'] = 'lan man hash'
|
||||||
|
@ -83,6 +84,7 @@ def mkpasswd(pwd, sambaver=3, algo='SSHA', salt=getsalt()):
|
||||||
LDAP - so default is seeded sha
|
LDAP - so default is seeded sha
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
algo = algo.lower()
|
||||||
if algo not in algos.keys():
|
if algo not in algos.keys():
|
||||||
raise TypeError, 'Algorithm <%s> not supported in this version.' % algo
|
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)
|
pwdhash = "{sambaNTPassword}" + smbpasswd.lmhash(pwd)
|
||||||
elif sambaver == 2:
|
elif sambaver == 2:
|
||||||
pwdhash = "{NTPassword}" + smbpasswd.lmhash(pwd)
|
pwdhash = "{NTPassword}" + smbpasswd.lmhash(pwd)
|
||||||
|
elif algo == 'cleartext':
|
||||||
|
pwdhash = "{CLEARTEXT}" + pwd
|
||||||
return pwdhash.strip()
|
return pwdhash.strip()
|
||||||
|
|
||||||
def checkpwd(pwd, pwdhash):
|
def checkpwd(pwd, pwdhash):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue