Skip to content

(CONT-1035) Alter logic of pw_hash #1370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/puppet/parser/functions/pw_hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@

# handle weak implementations of String#crypt
# dup the string to get rid of frozen status for testing
if (+'test').crypt('$1$1') == '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
if RUBY_PLATFORM == 'java'
# puppetserver bundles Apache Commons Codec
org.apache.commons.codec.digest.Crypt.crypt(password.to_java_bytes, salt)
elsif (+'test').crypt('$1$1') == '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
password.crypt(salt)
else
# JRuby < 1.7.17
# MS Windows and other systems that don't support enhanced salts
raise Puppet::ParseError, 'system does not support enhanced salts' unless RUBY_PLATFORM == 'java'

# puppetserver bundles Apache Commons Codec
org.apache.commons.codec.digest.Crypt.crypt(password.to_java_bytes, salt)
raise Puppet::ParseError, 'system does not support enhanced salts'
end
end