Skip to content

Commit

Permalink
Merge pull request #35 from stevewatanabe/couchbase-26.2
Browse files Browse the repository at this point in the history
Ensure host name when setting up TLS connection
  • Loading branch information
stevewatanabe authored Feb 28, 2024
2 parents a017a60 + 8486788 commit a4ae7bf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/ssl/src/inet_tls_dist.erl
Original file line number Diff line number Diff line change
Expand Up @@ -635,19 +635,27 @@ do_setup(
Timer = trace(dist_util:start_timer(SetupTime)),
ParseAddress = fun (A) -> inet:parse_strict_address(A, Family) end,
{#net_address{
host = _Host,
host = Host,
address = {Ip, PortNum}},
ConnectOptions,
Version} =
trace(inet_tcp_dist:fam_setup(
Family, Node, LongOrShortNames, ParseAddress)),
%% Ensure Host is a name (vs an IP address) before specifying server
%% name indication.
MaybeOpts = case inet:parse_address(Host) of
{ok, _} ->
[];
_ ->
[{server_name_indication, Host}]
end,
Opts =
inet_tcp_dist:merge_options(
inet_tcp_dist:merge_options(
ConnectOptions,
get_ssl_options(client)),
[Family, binary, {active, false}, {packet, 4}, {nodelay, true}],
[]),
MaybeOpts),
KTLS = proplists:get_value(ktls, Opts, false),
dist_util:reset_timer(Timer),
maybe
Expand Down

0 comments on commit a4ae7bf

Please sign in to comment.