diff options
Diffstat (limited to 'src/s_bsd.c')
-rw-r--r-- | src/s_bsd.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/s_bsd.c b/src/s_bsd.c index d75e187..20bef26 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -252,7 +252,27 @@ static void ssl_handshake(int fd, struct Client *client_p) { X509 *cert = NULL; - int ret = SSL_accept(client_p->localClient->fd.ssl); + int ret = 0; + + if ((ret = SSL_accept(client_p->localClient->fd.ssl)) <= 0) + { + switch (SSL_get_error(client_p->localClient->fd.ssl, ret)) + { + case SSL_ERROR_WANT_WRITE: + comm_setselect(&client_p->localClient->fd, COMM_SELECT_WRITE, + (PF *) ssl_handshake, client_p, 0); + return; + + case SSL_ERROR_WANT_READ: + comm_setselect(&client_p->localClient->fd, COMM_SELECT_READ, + (PF *) ssl_handshake, client_p, 0); + return; + + default: + exit_client(client_p, client_p, "Error during SSL handshake"); + return; + } + } if ((cert = SSL_get_peer_certificate(client_p->localClient->fd.ssl))) { @@ -279,26 +299,6 @@ ssl_handshake(int fd, struct Client *client_p) X509_free(cert); } - if (ret <= 0) - { - switch (SSL_get_error(client_p->localClient->fd.ssl, ret)) - { - case SSL_ERROR_WANT_WRITE: - comm_setselect(&client_p->localClient->fd, COMM_SELECT_WRITE, - (PF *) ssl_handshake, client_p, 0); - return; - - case SSL_ERROR_WANT_READ: - comm_setselect(&client_p->localClient->fd, COMM_SELECT_READ, - (PF *) ssl_handshake, client_p, 0); - return; - - default: - exit_client(client_p, client_p, "Error during SSL handshake"); - return; - } - } - start_auth(client_p); } #endif |