Merge pull request #446 from elyscape/fix_pw_hash
Fix pw_hash() on JRuby < 1.7.17
This commit is contained in:
commit
20669e39b1
1 changed files with 3 additions and 1 deletions
|
@ -38,6 +38,8 @@ Puppet::Parser::Functions::newfunction(
|
|||
password = args[0]
|
||||
return nil if password.nil? or password.empty?
|
||||
|
||||
salt = "$#{hash_type}$#{args[2]}"
|
||||
|
||||
# handle weak implementations of String#crypt
|
||||
if 'test'.crypt('$1$1') != '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
|
||||
# JRuby < 1.7.17
|
||||
|
@ -49,6 +51,6 @@ Puppet::Parser::Functions::newfunction(
|
|||
raise Puppet::ParseError, 'system does not support enhanced salts'
|
||||
end
|
||||
else
|
||||
password.crypt("$#{hash_type}$#{args[2]}")
|
||||
password.crypt(salt)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue