From cf2eb4a131a22ffb7720c96e6cc5783e330d8782 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Wed, 8 Nov 2023 11:35:07 -0500 Subject: [PATCH] Fix openldap_password function to avoid errors with latest Puppet 7 Errors: Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, failed to coerce org.jruby.RubySymbol to java.lang.String Stack trace on puppetserver: /etc/puppetlabs/code/environments/test/modules/openldap/lib/puppet/functions/openldap_password.rb:38:in `generate_password' --- lib/puppet/functions/openldap_password.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/functions/openldap_password.rb b/lib/puppet/functions/openldap_password.rb index 23facbdc..207bf520 100644 --- a/lib/puppet/functions/openldap_password.rb +++ b/lib/puppet/functions/openldap_password.rb @@ -26,16 +26,16 @@ def generate_password(secret, scheme = 'SSHA') case scheme[%r{([A-Z,0-9]+)}, 1] when 'CRYPT' - salt = call_function(:fqdn_rand_string, 2) + salt = call_function('fqdn_rand_string', 2) password = "{CRYPT}#{secret.crypt(salt)}" when 'MD5' password = "{MD5}#{Digest::MD5.hexdigest(secret)}" when 'SMD5' - salt = call_function(:fqdn_rand_string, 8) + salt = call_function('fqdn_rand_string', 8) md5_hash_with_salt = "#{Digest::MD5.digest(secret + salt)}#{salt}" password = "{SMD5}#{[md5_hash_with_salt].pack('m').delete("\n")}" when 'SSHA' - salt = call_function(:fqdn_rand_string, 8) + salt = call_function('fqdn_rand_string', 8) password = "{SSHA}#{Base64.encode64("#{Digest::SHA1.digest(secret + salt)}#{salt}").chomp}" when 'SHA' password = "{SHA}#{Digest::SHA1.hexdigest(secret)}"