summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <klishinm@vmware.com>2021-04-20 01:20:40 +0300
committerGitHub <noreply@github.com>2021-04-20 01:20:40 +0300
commit0dc1501f7b73e5049387ed62a975e726a6a3e81d (patch)
tree6eb9cb7fefc7e3f70508c43af3073cc47834880c
parenta17dde45bc309509046615a30f371fd775f66c06 (diff)
parent60a9a899401a4c2522b0a1395996d64ba2949bb2 (diff)
downloadrabbitmq-server-git-0dc1501f7b73e5049387ed62a975e726a6a3e81d.tar.gz
Merge pull request #2985 from rabbitmq/mk-decode-other-name-as-directory-string
Mk decode other name as directory string
-rw-r--r--deps/rabbit_common/src/rabbit_cert_info.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/deps/rabbit_common/src/rabbit_cert_info.erl b/deps/rabbit_common/src/rabbit_cert_info.erl
index 2ea1ebd594..537915ca44 100644
--- a/deps/rabbit_common/src/rabbit_cert_info.erl
+++ b/deps/rabbit_common/src/rabbit_cert_info.erl
@@ -110,10 +110,12 @@ 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
- <<12, 14, Rest/binary>> -> Rest;
- Other -> Other
+ %% 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, {_, Val}} -> Val;
+ Other -> Other
end.
%% Format and rdnSequence as a RFC4514 subject string.