From 84bfc385cfad73c3e24ee36b014f2e81dc10ea81 Mon Sep 17 00:00:00 2001 From: Julian Paul Dasmarinas Date: Tue, 27 Jun 2023 09:58:45 +0800 Subject: [PATCH] Fix openssl error when using multiple hosts --- lib/net/ldap/connection.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/net/ldap/connection.rb b/lib/net/ldap/connection.rb index 83887e5e..f51b7b7e 100644 --- a/lib/net/ldap/connection.rb +++ b/lib/net/ldap/connection.rb @@ -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 @@ -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] &&