Unverified Commit 3fb13ff3 authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge pull request #398 from mpkut/6.2.34_fix_rehash_password by mpkut

Avoid rehashing user password hashes in {add,update}_global_user()
parents 3e2a5e0e c0ec8d84
......@@ -642,9 +642,17 @@ sub update_global_user {
## use hash fingerprint to store password
## hashes that use salts will randomly generate one
$values->{'password'} =
Sympa::User::password_fingerprint($values->{'password'}, undef)
if ($values->{'password'});
## avoid rehashing passwords that are already hash strings
if ($values->{'password'}) {
if (defined(hash_type($values->{'password'}))) {
$log->syslog('debug',
'password is in %s format, not rehashing',
hash_type($values->{'password'}));
} else {
$values->{'password'} =
Sympa::User::password_fingerprint($values->{'password'}, undef);
}
}
## Canonicalize lang if possible.
$values->{'lang'} = Sympa::Language::canonic_lang($values->{'lang'})
......@@ -722,9 +730,17 @@ sub add_global_user {
## encrypt password with the configured password hash algorithm
## an salt of 'undef' means generate a new random one
$values->{'password'} =
Sympa::User::password_fingerprint($values->{'password'}, undef)
if ($values->{'password'});
## avoid rehashing passwords that are already hash strings
if ($values->{'password'}) {
if (defined(hash_type($values->{'password'}))) {
$log->syslog('debug',
'password is in %s format, not rehashing',
hash_type($values->{'password'}));
} else {
$values->{'password'} =
Sympa::User::password_fingerprint($values->{'password'}, undef);
}
}
## Canonicalize lang if possible
$values->{'lang'} = Sympa::Language::canonic_lang($values->{'lang'})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment