< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate] A few bugs in resiprocate


I checked resiprocate's source code and find a few issues (most are windows 
and openssl related):

1. TLSConnection.cxx is not includeed in the VS projects(at least not in 
resiprocate_7_1.vcproj). An user will have trouble to build it with USE_SSL 
defined.

2. By default, the windows build uses static CRT, but in Threadif.cxx there 
is a CreateThread call. They do not play nicely together, see MSDN:
A thread that uses functions from the static C run-time libraries should use 
the _beginthreadex and _endthreadex C run-time functions for thread 
management rather than CreateThread and ExitThread. Failure to do so results 
in small memory leaks when ExitThread is called. Note that this is not a 
problem with the C run-time in a DLL.

3. Openssl's random generator is not intialized on windows. See Random.cxx. 
We can simply do:

::RAND_screen ();

It's not perfect(see http://www.openssl.org/support/faq.html#USER1), but 
better than nothing(otherwise some openssl API may fail).

4. Openssl are not used thread safe.

See http://www.openssl.org/support/faq.html#PROG1

5. Seems resiprocate uses non-bloking socket (TlsTransport inherites from 
TcpBaseTransport and there is makeSocketNonBlocking call in 
TcpBaseTransport's ctor)? If so, there are quiet a few problem in the 
implementation.

For example, SSL_Pending is not called before SSL_Read and SSL_Write.