Skip to content

Commit

Permalink
Fix openssl error when using multiple hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
jpdasma committed Jun 27, 2023
1 parent 46c7d9e commit 84bfc38
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/net/ldap/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ def socket_class=(socket_class)
@socket_class = socket_class
end

def prepare_socket(server, timeout=nil)
def prepare_socket(server, timeout=nil, hostname='127.0.0.1')
socket = server[:socket]
encryption = server[:encryption]
hostname = server[:host]

@conn = socket
setup_encryption(encryption, timeout, hostname) if encryption
Expand All @@ -51,7 +50,7 @@ def open_connection(server)
errors = []
hosts.each do |host, port|
begin
prepare_socket(server.merge(socket: @socket_class.new(host, port, socket_opts)), timeout)
prepare_socket(server.merge(socket: @socket_class.new(host, port, socket_opts)), timeout, host)
if encryption
if encryption[:tls_options] &&
encryption[:tls_options][:verify_mode] &&
Expand Down

0 comments on commit 84bfc38

Please sign in to comment.