summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Cogoluègnes <acogoluegnes@gmail.com>2019-06-14 14:21:09 +0200
committerArnaud Cogoluègnes <acogoluegnes@gmail.com>2019-06-14 14:21:09 +0200
commit2f958a03a04d781ad39290d0a12ee4b5d6f8201a (patch)
treed182d73625c6739765d8e1a165ea1acad4c41ed8
parent719886fb8f5034f62194588a8e99c1151d8b1bf6 (diff)
downloadrabbitmq-server-git-2f958a03a04d781ad39290d0a12ee4b5d6f8201a.tar.gz
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
-rw-r--r--src/rabbit_direct.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl
index b918d2e671..b84b4d91bb 100644
--- a/src/rabbit_direct.erl
+++ b/src/rabbit_direct.erl
@@ -132,7 +132,9 @@ extract_protocol(Infos) ->
maybe_call_connection_info_module(Protocol, Creds, VHost, Pid, Infos) ->
Module = rabbit_data_coercion:to_atom(string:to_lower(
- "rabbit_" ++ rabbit_data_coercion:to_list(Protocol) ++ "_connection_info")
+ "rabbit_" ++
+ lists:flatten(string:replace(rabbit_data_coercion:to_list(Protocol), " ", "_", all)) ++
+ "_connection_info")
),
Args = [Creds, VHost, Pid, Infos],
code_server_cache:maybe_call_mfa(Module, additional_authn_params, Args, []).