Skip to content

Commit 5316f76

Browse files
committed
Replace spaces by underscores when forging module name
Plugins can provide a module to be called to extract extra information at authentication time. The module name is based on the protocol used. Some protocols have a space in their name, like "Web MQTT", so spaces in such cases must be replaced by underscores to come up with a valid Erlang module name. [#166271318] References #1767 (cherry picked from commit 2f958a0)
1 parent f3de582 commit 5316f76

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/rabbit_direct.erl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ extract_protocol(Infos) ->
133133

134134
maybe_call_connection_info_module(Protocol, Creds, VHost, Pid, Infos) ->
135135
Module = rabbit_data_coercion:to_atom(string:to_lower(
136-
"rabbit_" ++ rabbit_data_coercion:to_list(Protocol) ++ "_connection_info")
136+
"rabbit_" ++
137+
lists:flatten(string:replace(rabbit_data_coercion:to_list(Protocol), " ", "_", all)) ++
138+
"_connection_info")
137139
),
138140
Args = [Creds, VHost, Pid, Infos],
139141
code_server_cache:maybe_call_mfa(Module, additional_authn_params, Args, []).

0 commit comments

Comments
 (0)