Skip to content

Commit

Permalink
Merge pull request #417 from jpdasma/fix-sni-multiple-host
Browse files Browse the repository at this point in the history
Fix openssl error when using multiple hosts
  • Loading branch information
HarlemSquirrel authored Jun 29, 2023
2 parents 46c7d9e + 84bfc38 commit 95cec38
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 95cec38

Please sign in to comment.