Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
0d2774fb
Commit
0d2774fb
authored
Dec 02, 2019
by
Francesc Guasch
Browse files
wip(auth): properly pass the algorithm
issue #1208
parent
e7530137
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada/Auth/LDAP.pm
View file @
0d2774fb
...
...
@@ -104,8 +104,8 @@ sub _password_store($password, $storage, $algorithm) {
}
sub
_password_pbkdf2
($password, $algorithm='SHA-
1
') {
$algorithm
=
'
SHA-
1
'
if
!
defined
$algorithm
;
sub
_password_pbkdf2
($password, $algorithm='SHA-
256
') {
$algorithm
=
'
SHA-
256
'
if
!
defined
$algorithm
;
my
$salt
=
encode
('
ascii
',
'
random_name
');
my
$iters
=
100
;
...
...
@@ -483,10 +483,10 @@ sub _match_password {
my
$salt
=
encode
('
ascii
',
'
random_name
');
if
(
lc
(
$storage
)
eq
'
pbkdf2
')
{
my
(
$algorithm
)
=
$password_ldap
=~
/^{[a-z0-9]+_([a-z0-9]+)}/i
;
my
(
$algorithm
,
$n
)
=
$password_ldap
=~
/^{[a-z0-9]+_([a-z
]+)([
0-9]+)}/i
;
confess
"
Error: I can't find the algorithm in
$password_ldap
"
if
!
$algorithm
;
return
verify_hex
(
$password_ldap
,
$algorithm
return
verify_hex
(
$password_ldap
,
"
$algorithm
-
$n
"
,
encode
('
ascii
',
$password
)
,
$salt
)
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment