[openssl-users] 2nd client connects to 1:1-server leads to client crash

Newcomer83 at web.de Newcomer83 at web.de
Wed May 13 14:11:12 UTC 2015


Hello everyone,

I have a server that is supposed to accept only one client. The connection works just fine. When I tried to connect to the server with a second client while another connection is already active, I expected that the 2nd client would return some error code, but instead it crashes completely. I am using non-blocking sockets for both clients (i.e. both clients are the same application, but different instances). Interestingly it doesn't crash during the connect call, but during the call to SSL_connect. My non-blocking socket attempts to connect until either an error happens or WSAEISCONN is returned (i.e. connect request was mande on an already connected socket), so it seems to connect even though the server isn't waiting for a connection anymore.
In most cases it crashes after I got an SSL_ERROR_WANT_READ from SSL_connect, sometimes it crashes before that. In some lucky cases I get error code 5 without it crashing, but in most cases the crash happens.

My server looks pretty much like this one: https://www.cs.utah.edu/~swalton/listings/articles/ssl_server.c
I.e. it waits for a connection and when a client connected it waits for a message, processes it and returns the result. Do I have to reprogram the server to actively refuse multiple connections? And why does the connect function work?

I am using OpenSSL 1.0.2a. The client runs on Windows 7, the server on lUbuntu inside a VM on the same PC.

Thanks in advance for the help!

Cheers
Alex


More information about the openssl-users mailing list