Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
4300-kernel-Fix-auth-get-set_cookie-for-dynamic...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4300-kernel-Fix-auth-get-set_cookie-for-dynamic-node-name.patch of Package erlang
From 8689be8f37184653ff2cf92589fd86b7a1314418 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson <sverker@erlang.org> Date: Thu, 16 Dec 2021 17:03:04 +0100 Subject: [PATCH] kernel: Fix auth:get/set_cookie for dynamic node name --- lib/kernel/src/auth.erl | 42 ++++++++++++++++------ lib/kernel/test/erl_distribution_SUITE.erl | 35 +++++++++++++----- 2 files changed, 58 insertions(+), 19 deletions(-) diff --git a/lib/kernel/test/erl_distribution_SUITE.erl b/lib/kernel/test/erl_distribution_SUITE.erl index aa1a6d6a27..373be74e51 100644 --- a/lib/kernel/test/erl_distribution_SUITE.erl +++ b/lib/kernel/test/erl_distribution_SUITE.erl @@ -61,7 +61,7 @@ setopts_do/2, setopts_deadlock_test/2, keep_conn/1, time_ping/1, - dyn_differing_cookies/2]). + ddc_remote_run/2]). -export([net_kernel_start_do_test/1]). @@ -2207,14 +2207,25 @@ dyn_differing_cookies(Config) when is_list(Config) -> %% and cookie configuration of mother node DynNodeCookieL = BaseName++"_cookieA", DynNodeCookie = list_to_atom(DynNodeCookieL), - {_NF, Port} = + {_NF1, Port1} = start_node_unconnected( "-setcookie "++MotherNodeL++" "++MotherNodeCookieL, undefined, DynNodeCookie, ?MODULE, run_remote_test, - [atom_to_list(?FUNCTION_NAME), MotherNodeL] ), + ["ddc_remote_run", MotherNodeL, "cmdline", MotherNodeCookieL] ), + + dyn_differing_cookies(MotherNode, MotherNodeCookie, DynNodeCookie, Port1), + + %% Same again, but use erlang:set_cookie/2 to set MotherNodeCookie + {_NF2, Port2} = + start_node_unconnected( + "", + undefined, DynNodeCookie, + ?MODULE, run_remote_test, + ["ddc_remote_run", MotherNodeL, "set_cookie", MotherNodeCookieL] ), + + dyn_differing_cookies(MotherNode, MotherNodeCookie, DynNodeCookie, Port2). - dyn_differing_cookies(MotherNode, MotherNodeCookie, DynNodeCookie, Port). dyn_differing_cookies(MotherNode, MotherNodeCookie, DynNodeCookie, Port) -> receive @@ -2224,7 +2235,7 @@ dyn_differing_cookies(MotherNode, MotherNodeCookie, DynNodeCookie, Port) -> DynNodeCookie = rpc:call( DynNode, erlang, get_cookie, [] ), MotherNodeCookie = rpc:call( DynNode, erlang, get_cookie, [MotherNode] ), - {?FUNCTION_NAME, DynNode} ! + {ddc_remote_run, DynNode} ! {MotherNode, MotherNodeCookie, DynNode}, 0 = wait_for_port_exit(Port), @@ -2239,9 +2250,17 @@ dyn_differing_cookies(MotherNode, MotherNodeCookie, DynNodeCookie, Port) -> error({unexpected, Other}) end. -dyn_differing_cookies(MotherNode, _Args) -> +ddc_remote_run(MotherNode, [SetCookie, MotherNodeCookieL]) -> nonode@nohost = node(), [] = nodes(hidden), + MotherNodeCookie = list_to_atom(MotherNodeCookieL), + case SetCookie of + "set_cookie" -> + erlang:set_cookie(MotherNode, MotherNodeCookie); + "cmdline" -> + ok + end, + MotherNodeCookie = erlang:get_cookie(MotherNode), true = net_kernel:connect_node( MotherNode ), [ MotherNode ] = nodes(hidden), DynNode = node(), @@ -2251,8 +2270,8 @@ dyn_differing_cookies(MotherNode, _Args) -> %% Here we get the mother node's default cookie MotherNodeCookie = rpc:call( MotherNode, erlang, get_cookie, [DynNode] ), DynNodeCookie = erlang:get_cookie(), - register( ?FUNCTION_NAME, self() ), - {?FUNCTION_NAME, MotherNode} ! + register(ddc_remote_run, self() ), + {dyn_differing_cookies, MotherNode} ! {MotherNode, MotherNodeCookie, DynNodeCookie, DynNode}, receive { MotherNode, MotherNodeCookie, DynNode } -> -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor