TLS compile and crash fixes.

This commit is contained in:
Jan Vidar Krey 2009-10-09 21:11:11 +02:00
parent 0f30ebf045
commit 0c5d98c671
2 changed files with 13 additions and 6 deletions

View File

@ -66,16 +66,23 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
}
#ifdef SSL_SUPPORT
if (bytes >= 11
if (bytes >= 11 &&
probe_recvbuf[0] == 22 &&
probe_recvbuf[1] == 3 && /* protocol major version */
probe_recvbuf[5] == 1 && /* message type */
probe_recvbuf[9] == probe_recvbuf[1] &&
probe_recvbuf[10] == probe_recvbuf[2])
{
LOG_TRACE("Probed TLS %d.%d connection", (int) probe_recvbuf[1], (int) probe_recvbuf[2]);
net_con_ssl_handshake(con, NET_CON_SSL_MODE_SERVER);
if (probe->hub->config->tls_enable)
{
LOG_TRACE("Probed TLS %d.%d connection", (int) probe_recvbuf[1], (int) probe_recvbuf[2]);
net_con_ssl_handshake(con, NET_CON_SSL_MODE_SERVER);
}
else
{
LOG_TRACE("Probed TLS %d.%d connection. TLS disabled in hub.", (int) probe_recvbuf[1], (int) probe_recvbuf[2]);
probe_destroy(probe);
}
return;
}
#endif

View File

@ -142,7 +142,7 @@ static void net_con_event(int fd, short ev, void *arg)
}
else
{
CALLBACK((con, events);
CALLBACK(con, events);
}
}
else
@ -523,7 +523,7 @@ ssize_t net_con_ssl_connect(struct net_connection* con)
return handle_openssl_error(con, ret);
}
return ret;
// }
}
ssize_t net_con_ssl_handshake(struct net_connection* con, int ssl_mode)
{