mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Don't crash on certificates without extensions (EJAB-1724)
This commit is contained in:
parent
2a115a83d2
commit
b2eb9f197a
@ -620,10 +620,15 @@ get_s2s_state(S2sPid) ->
|
|||||||
[{s2s_pid, S2sPid} | Infos].
|
[{s2s_pid, S2sPid} | Infos].
|
||||||
|
|
||||||
get_cert_domains(Cert) ->
|
get_cert_domains(Cert) ->
|
||||||
{rdnSequence, Subject} =
|
TBSCert = Cert#'Certificate'.tbsCertificate,
|
||||||
(Cert#'Certificate'.tbsCertificate)#'TBSCertificate'.subject,
|
Subject = case TBSCert#'TBSCertificate'.subject of
|
||||||
Extensions =
|
{rdnSequence, Subj} -> lists:flatten(Subj);
|
||||||
(Cert#'Certificate'.tbsCertificate)#'TBSCertificate'.extensions,
|
_ -> []
|
||||||
|
end,
|
||||||
|
Extensions = case TBSCert#'TBSCertificate'.extensions of
|
||||||
|
Exts when is_list(Exts) -> Exts;
|
||||||
|
_ -> []
|
||||||
|
end,
|
||||||
lists:flatmap(fun (#'AttributeTypeAndValue'{type =
|
lists:flatmap(fun (#'AttributeTypeAndValue'{type =
|
||||||
?'id-at-commonName',
|
?'id-at-commonName',
|
||||||
value = Val}) ->
|
value = Val}) ->
|
||||||
@ -646,7 +651,7 @@ get_cert_domains(Cert) ->
|
|||||||
end;
|
end;
|
||||||
(_) -> []
|
(_) -> []
|
||||||
end,
|
end,
|
||||||
lists:flatten(Subject))
|
Subject)
|
||||||
++
|
++
|
||||||
lists:flatmap(fun (#'Extension'{extnID =
|
lists:flatmap(fun (#'Extension'{extnID =
|
||||||
?'id-ce-subjectAltName',
|
?'id-ce-subjectAltName',
|
||||||
|
Loading…
Reference in New Issue
Block a user