Skip to content

Commit

Permalink
Merge pull request #446 from elyscape/fix_pw_hash
Browse files Browse the repository at this point in the history
Fix pw_hash() on JRuby < 1.7.17
  • Loading branch information
DavidS committed May 6, 2015
2 parents 7181e4e + 7d7e905 commit 20669e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/puppet/parser/functions/pw_hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
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
Expand All @@ -49,6 +51,6 @@
raise Puppet::ParseError, 'system does not support enhanced salts'
end
else
password.crypt("$#{hash_type}$#{args[2]}")
password.crypt(salt)
end
end

0 comments on commit 20669e3

Please sign in to comment.