ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.1.x/src/s_bsd.c
(Generate patch)

Comparing ircd-hybrid/branches/8.1.x/src/s_bsd.c (file contents):
Revision 2461 by michael, Tue Jul 30 17:20:29 2013 UTC vs.
Revision 2462 by michael, Sat Aug 17 20:37:43 2013 UTC

# Line 252 | Line 252 | static void
252   ssl_handshake(int fd, struct Client *client_p)
253   {
254    X509 *cert = NULL;
255 <  int ret = SSL_accept(client_p->localClient->fd.ssl);
255 >  int ret = 0;
256 >
257 >  if ((ret = SSL_accept(client_p->localClient->fd.ssl)) <= 0)
258 >  {
259 >    switch (SSL_get_error(client_p->localClient->fd.ssl, ret))
260 >    {
261 >      case SSL_ERROR_WANT_WRITE:
262 >        comm_setselect(&client_p->localClient->fd, COMM_SELECT_WRITE,
263 >                       (PF *) ssl_handshake, client_p, 0);
264 >        return;
265 >
266 >      case SSL_ERROR_WANT_READ:
267 >        comm_setselect(&client_p->localClient->fd, COMM_SELECT_READ,
268 >                       (PF *) ssl_handshake, client_p, 0);
269 >        return;
270 >
271 >      default:
272 >        exit_client(client_p, client_p, "Error during SSL handshake");
273 >        return;
274 >    }
275 >  }
276  
277    if ((cert = SSL_get_peer_certificate(client_p->localClient->fd.ssl)))
278    {
# Line 279 | Line 299 | ssl_handshake(int fd, struct Client *cli
299      X509_free(cert);
300    }
301  
282  if (ret <= 0)
283  {
284    switch (SSL_get_error(client_p->localClient->fd.ssl, ret))
285    {
286      case SSL_ERROR_WANT_WRITE:
287        comm_setselect(&client_p->localClient->fd, COMM_SELECT_WRITE,
288                       (PF *) ssl_handshake, client_p, 0);
289        return;
290
291      case SSL_ERROR_WANT_READ:
292        comm_setselect(&client_p->localClient->fd, COMM_SELECT_READ,
293                       (PF *) ssl_handshake, client_p, 0);
294        return;
295
296      default:
297        exit_client(client_p, client_p, "Error during SSL handshake");
298        return;
299    }
300  }
301
302    start_auth(client_p);
303   }
304   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines