Skip to content

Commit 8d525d2

Browse files
committed
(CONT-1035) Alter logic of pw_hash
The method as it is currently is causing issues with certain customers crypto setups
1 parent 1dee9ef commit 8d525d2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: lib/puppet/parser/functions/pw_hash.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@
7676

7777
# handle weak implementations of String#crypt
7878
# dup the string to get rid of frozen status for testing
79-
if (+'test').crypt('$1$1') == '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
79+
if RUBY_PLATFORM == 'java'
80+
# puppetserver bundles Apache Commons Codec
81+
org.apache.commons.codec.digest.Crypt.crypt(password.to_java_bytes, salt)
82+
elsif (+'test').crypt('$1$1') == '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
8083
password.crypt(salt)
8184
else
8285
# JRuby < 1.7.17
8386
# MS Windows and other systems that don't support enhanced salts
84-
raise Puppet::ParseError, 'system does not support enhanced salts' unless RUBY_PLATFORM == 'java'
85-
86-
# puppetserver bundles Apache Commons Codec
87-
org.apache.commons.codec.digest.Crypt.crypt(password.to_java_bytes, salt)
87+
raise Puppet::ParseError, 'system does not support enhanced salts'
8888
end
8989
end

0 commit comments

Comments
 (0)