239 |
|
|
240 |
|
if ((ret = SSL_accept(client_p->localClient->fd.ssl)) <= 0) |
241 |
|
{ |
242 |
+ |
if ((CurrentTime - client_p->localClient->firsttime) > 30) |
243 |
+ |
{ |
244 |
+ |
exit_client(client_p, client_p, "Timeout during SSL handshake"); |
245 |
+ |
return; |
246 |
+ |
} |
247 |
+ |
|
248 |
|
switch (SSL_get_error(client_p->localClient->fd.ssl, ret)) |
249 |
|
{ |
250 |
|
case SSL_ERROR_WANT_WRITE: |
251 |
|
comm_setselect(&client_p->localClient->fd, COMM_SELECT_WRITE, |
252 |
< |
(PF *) ssl_handshake, client_p, 0); |
252 |
> |
(PF *) ssl_handshake, client_p, 30); |
253 |
|
return; |
254 |
|
|
255 |
|
case SSL_ERROR_WANT_READ: |
256 |
|
comm_setselect(&client_p->localClient->fd, COMM_SELECT_READ, |
257 |
< |
(PF *) ssl_handshake, client_p, 0); |
257 |
> |
(PF *) ssl_handshake, client_p, 30); |
258 |
|
return; |
259 |
|
|
260 |
|
default: |
263 |
|
} |
264 |
|
} |
265 |
|
|
266 |
+ |
comm_settimeout(&client_p->localClient->fd, 0, NULL, NULL); |
267 |
+ |
|
268 |
|
if ((cert = SSL_get_peer_certificate(client_p->localClient->fd.ssl))) |
269 |
|
{ |
270 |
|
int res = SSL_get_verify_result(client_p->localClient->fd.ssl); |