]> granicus.if.org Git - ejabberd/commitdiff
Fix extraction of host names from certificates
authorHolger Weiss <holger@zedat.fu-berlin.de>
Tue, 22 Apr 2014 20:12:04 +0000 (22:12 +0200)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Tue, 22 Apr 2014 20:12:04 +0000 (22:12 +0200)
src/ejabberd_s2s_in.erl

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