File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
lib/puppet/parser/functions Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 32
32
password = args [ 0 ] . to_s
33
33
return nil if password . empty?
34
34
35
- # work around JRuby bug in String#crypt for JRuby < 1.7.17
36
- if RUBY_PLATFORM == 'java' and 'test' . crypt ( '$1$1' ) != '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
37
- def password . crypt ( salt )
38
- # puppetserver bundles Apache Commons Codec
39
- org . apache . commons . codec . digest . Crypt . crypt ( self . to_java_bytes , salt )
35
+ # handle weak implementations of String#crypt
36
+ if 'test' . crypt ( '$1$1' ) != '$1$1$Bp8CU9Oujr9SSEw53WV6G.'
37
+ # JRuby < 1.7.17
38
+ if RUBY_PLATFORM == 'java'
39
+ # override String#crypt for password variable
40
+ def password . crypt ( salt )
41
+ # puppetserver bundles Apache Commons Codec
42
+ org . apache . commons . codec . digest . Crypt . crypt ( self . to_java_bytes , salt )
43
+ end
44
+ else
45
+ # MS Windows and other systems that don't support enhanced salts
46
+ raise Puppet ::ParseError , 'system does not support enhanced salts'
40
47
end
41
48
end
42
49
password . crypt ( "$#{ args [ 1 ] } $#{ args [ 2 ] } " )
You can’t perform that action at this time.
0 commit comments