Skip to content

Commit

Permalink
call ruby instead of mysql to generate hex string and replace regex w…
Browse files Browse the repository at this point in the history
…ith more explicit one
  • Loading branch information
C24-AK committed May 27, 2024
1 parent 20f6fa1 commit 9d1bb5f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/functions/mysql/password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def password(password, sensitive = false)
password = password.unwrap if password.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)

result_string = if %r{\*[A-F0-9]{40}$}.match?(password) || %r{0x[A-F0-9]+$}.match?(password)
result_string = if %r{\*[A-F0-9]{40}$}.match?(password) || %r{0x24412430303524[A-F0-9]{63}$}.match?(password)
password
elsif password.empty?
''
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/mysql_user/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.instances
if @plugin == 'caching_sha2_password'
# Escaping all single quotes to prevent errors when password generated it
@password = @password.gsub("'") { "\\'" }
@password = mysql_caller("SELECT CONCAT('0x',HEX('#{@password}'))", 'regular').chomp
@password = '0x' + @password.each_byte.map { |b| b.to_s(16) }.join
end

@tls_options = parse_tls_options(ssl_type, ssl_cipher, x509_issuer, x509_subject)
Expand Down

0 comments on commit 9d1bb5f

Please sign in to comment.