diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2021-04-20 01:16:29 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2021-04-20 01:16:29 +0300 |
| commit | 73eb9b56ecf872d3dd8cbffbbc339776df7678ba (patch) | |
| tree | c0a491e23208b5e8065a565b924579dd6a2ef1ec | |
| parent | e15f2b46f36829d85de95bdf28f5a59c78c4fcf4 (diff) | |
| download | rabbitmq-server-git-73eb9b56ecf872d3dd8cbffbbc339776df7678ba.tar.gz | |
Decode other name using 'OTP-PUB-KEY':decode/2
and assume it is a string-like value ("directory string")
because other values would not make much sense in the
username extraction context.
References #2983.
| -rw-r--r-- | deps/rabbit_common/src/rabbit_cert_info.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/deps/rabbit_common/src/rabbit_cert_info.erl b/deps/rabbit_common/src/rabbit_cert_info.erl index 81a2fad8cc..5688fa215c 100644 --- a/deps/rabbit_common/src/rabbit_cert_info.erl +++ b/deps/rabbit_common/src/rabbit_cert_info.erl @@ -110,9 +110,11 @@ find_by_type(Type, {rdnSequence, RDNs}) -> %%-------------------------------------------------------------------------- sanitize_other_name(Bin) when is_binary(Bin) -> - %% strip off leading values that seem to be ASN.1 UTF value encoding artifacts - case Bin of - <<_:2/binary, Rest/binary>> -> Rest; + %% We make a wild assumption about the types here + %% but ASN.1 decoding functions in OTP only offer so much and SAN values + %% are expected to be "string-like" by RabbitMQ + case 'OTP-PUB-KEY':decode('DirectoryString', Bin) of + {ok, {utf8String, Val}} -> Val; Other -> Other end. |
