diff options
author | David Schmitt <david.schmitt@puppetlabs.com> | 2015-05-06 09:11:37 +0100 |
---|---|---|
committer | David Schmitt <david.schmitt@puppetlabs.com> | 2015-05-06 09:11:37 +0100 |
commit | 20669e39b18da020b82833a6e1b7b50aa9d0c1dd (patch) | |
tree | 433fdf817e8fb29dcaf42a90666aa5a499bbd15a /lib | |
parent | 7181e4ebcaf59cb16e7166aa254cbb637590423a (diff) | |
parent | 7d7e905b543448f5d37d13c9e1a03d1e0be307fe (diff) |
Merge pull request #446 from elyscape/fix_pw_hash
Fix pw_hash() on JRuby < 1.7.17
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/functions/pw_hash.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/pw_hash.rb b/lib/puppet/parser/functions/pw_hash.rb index 4682a63..41d4223 100644 --- a/lib/puppet/parser/functions/pw_hash.rb +++ b/lib/puppet/parser/functions/pw_hash.rb @@ -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 |