en cas de cration massive de mots de passes, il utilisait toujours la meme
salt (ce qui n'est pas gravec en soit... mais bon) darcs-hash:20060428002237-4ec08-61c60810827e5ab433158e53656e34fa65ac8f5c.gz
This commit is contained in:
parent
d11be40f29
commit
42a295928e
1 changed files with 5 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.4 2006-04-28 00:12:40 chove Exp $
|
# $Id: ldap_passwd.py,v 1.5 2006-04-28 00:22:37 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>
|
||||||
|
@ -78,12 +78,15 @@ def getsalt(chars=string.letters+string.digits, length=16):
|
||||||
salt += random.choice(chars)
|
salt += random.choice(chars)
|
||||||
return salt
|
return salt
|
||||||
|
|
||||||
def mkpasswd(pwd, sambaver=3, algo='SSHA', salt=getsalt()):
|
def mkpasswd(pwd, sambaver=3, algo='SSHA', salt=None):
|
||||||
''' Make a given password cryptated, possibly with different
|
''' Make a given password cryptated, possibly with different
|
||||||
crypt-algorihtms. This module was written for use with
|
crypt-algorihtms. This module was written for use with
|
||||||
LDAP - so default is seeded sha
|
LDAP - so default is seeded sha
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
if salt == None:
|
||||||
|
salt = getsalt()
|
||||||
|
|
||||||
algo = algo.lower()
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue