Skip to content

Commit 0573dc6

Browse files
author
Dan Janowski
committed
add missing verify_fun mfa translation
inet_tls_dist is missing a configuration translation for verify_fun from an mfa tuple to a closure that can be called during ssl_handshake.
1 parent 526fe92 commit 0573dc6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/ssl/src/inet_tls_dist.erl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ get_ssl_server_options(PeerIP) when PeerIP =/= undefined ->
425425
%%
426426
setup_verify_client([Opt | Opts], PeerIP) ->
427427
case Opt of
428+
{verify_fun,{Mod,Fun,Init}} ->
429+
[{verify_fun, {fun Mod:Fun/3, Init}} | setup_verify_client(Opts, PeerIP)];
428430
{verify_fun,{VerifyFun, _}} ->
429431
case fun inet_tls_dist:verify_client/3 of
430432
VerifyFun ->
@@ -446,6 +448,16 @@ setup_verify_client([Opt | Opts], PeerIP) ->
446448
setup_verify_client([], _PeerIP) ->
447449
[].
448450

451+
setup_verify_server([]) ->
452+
[];
453+
setup_verify_server([Opt|Opts]) ->
454+
case Opt of
455+
{verify_fun,{Mod,Fun,Init}} ->
456+
[{verify_fun, {fun Mod:Fun/3, Init}} | setup_verify_server(Opts)];
457+
_ ->
458+
[Opt | setup_verify_server(Opts)]
459+
end.
460+
449461
allowed_hosts(Allowed) ->
450462
lists:usort(allowed_node_hosts(Allowed)).
451463
%%
@@ -639,7 +651,7 @@ do_setup(
639651
inet_tcp_dist:merge_options(
640652
inet_tcp_dist:merge_options(
641653
ConnectOptions,
642-
get_ssl_options(client)),
654+
setup_verify_server(get_ssl_options(client))),
643655
[Family, binary, {active, false}, {packet, 4},
644656
{read_ahead, false}, {nodelay, true}],
645657
[{server_name_indication, Host}]),

0 commit comments

Comments
 (0)