25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Fix extraction of host names from certificates

This commit is contained in:
Holger Weiss 2014-04-22 22:12:04 +02:00
parent 9497dbff17
commit 4bc8b6bc9f

View File

@ -749,7 +749,7 @@ get_cert_domains(Cert) ->
case 'OTP-PUB-KEY':decode('X520CommonName', Val) of case 'OTP-PUB-KEY':decode('X520CommonName', Val) of
{ok, {_, D1}} -> {ok, {_, D1}} ->
D = if is_binary(D1) -> D1; D = if is_binary(D1) -> D1;
is_binary(D1) -> (D1); is_list(D1) -> list_to_binary(D1);
true -> error true -> error
end, end,
if D /= error -> if D /= error ->
@ -770,8 +770,7 @@ get_cert_domains(Cert) ->
lists:flatmap(fun (#'Extension'{extnID = lists:flatmap(fun (#'Extension'{extnID =
?'id-ce-subjectAltName', ?'id-ce-subjectAltName',
extnValue = Val}) -> extnValue = Val}) ->
BVal = if is_binary(Val) -> iolist_to_binary(Val); BVal = if is_list(Val) -> list_to_binary(Val);
is_binary(Val) -> Val;
true -> Val true -> Val
end, end,
case 'OTP-PUB-KEY':decode('SubjectAltName', BVal) case 'OTP-PUB-KEY':decode('SubjectAltName', BVal)
@ -811,9 +810,9 @@ get_cert_domains(Cert) ->
_ -> [] _ -> []
end; end;
({dNSName, D}) ({dNSName, D})
when is_binary(D) -> when is_list(D) ->
case case
jlib:string_to_jid(D) jlib:string_to_jid(list_to_binary(D))
of of
#jid{luser = <<"">>, #jid{luser = <<"">>,
lserver = LD, lserver = LD,