[erlang-questions] ssl timing issue in R15B?

Lukas P <>
Mon Mar 26 11:59:28 CEST 2012


Dne 23. března 2012 18:16 Attila Rajmund Nohl
<> napsal(a):
> 2012/3/23 Lukas P <>:
>> Hello.
>>
>> I think that I have been hit by a SSL timing issue in R15B. My
>> functional test (= SSL/TCP client) crahes my server unless the test
>> contains a sleep.
>>
>> The tested server implements a TCP based, line oriented protocol.
>> Switch to SSL can be started with a "STARTTLS\r\n" command.
>>
>> The functional test starts a TCP connection and upgrades it to SSL:
>>
>> upgrade_connection_to_ssl(Socket) ->
>>    SendResult = gen_tcp:send(Socket, "STARTTLS\r\n"),
>>    %timer:sleep(10), % workaround for a SSL timing bug
>>    SslConnectResult = case SendResult of
>>        ok ->
>>            ssl:connect(Socket, [{active, false}, {packet, line}, list], 2000);
>>        {error, Reason1} ->
>>            {error, Reason1}
>>    end,
>>    ...
>>
>> After the server receives "STARTTLS\r\n", it performs ssl:ssl_accept
>> on the socket:
>>
>>    inet:setopts(Socket, [{active, false}]),
>
> Don't you need a {reuseaddr, true} option here? The default is false.

Unfortunately not, the tcp socket is already connected.

When you look at the walkback, you can see that there is definitely a
bug in ssl_record:get_tls_records_aux/2 (erlang:size/1 must not be
used on a list).

Lukas



More information about the erlang-questions mailing list