[enh] use the full length of available chars for salt generation

This commit is contained in:
Laurent Peuch 2017-08-14 15:24:45 +02:00
parent 8c6db3845d
commit 9d0e615bb4

View file

@ -136,7 +136,7 @@ def user_create(auth, username, firstname, lastname, mail, password,
# Adapt values for LDAP # Adapt values for LDAP
fullname = '%s %s' % (firstname, lastname) fullname = '%s %s' % (firstname, lastname)
char_set = string.ascii_uppercase + string.digits char_set = string.ascii_uppercase + string.ascii_lowercase + string.digits + "./"
salt = ''.join([random.SystemRandom().choice(char_set) for x in range(8)]) salt = ''.join([random.SystemRandom().choice(char_set) for x in range(8)])
salt = '$1$' + salt + '$' salt = '$1$' + salt + '$'
user_pwd = '{CRYPT}' + crypt.crypt(str(password), salt) user_pwd = '{CRYPT}' + crypt.crypt(str(password), salt)