|
|
@ -199,17 +199,14 @@ int net__socket_accept(struct mosquitto_db *db, mosq_sock_t listensock)
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
/* TLS init */
|
|
|
|
/* TLS init */
|
|
|
|
for(i=0; i<db->config->listener_count; i++){
|
|
|
|
if(new_context->listener->ssl_ctx){
|
|
|
|
for(j=0; j<db->config->listeners[i].sock_count; j++){
|
|
|
|
new_context->ssl = SSL_new(new_context->listener->ssl_ctx);
|
|
|
|
if(db->config->listeners[i].socks[j] == listensock){
|
|
|
|
|
|
|
|
if(db->config->listeners[i].ssl_ctx){
|
|
|
|
|
|
|
|
new_context->ssl = SSL_new(db->config->listeners[i].ssl_ctx);
|
|
|
|
|
|
|
|
if(!new_context->ssl){
|
|
|
|
if(!new_context->ssl){
|
|
|
|
context__cleanup(db, new_context, true);
|
|
|
|
context__cleanup(db, new_context, true);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SSL_set_ex_data(new_context->ssl, tls_ex_index_context, new_context);
|
|
|
|
SSL_set_ex_data(new_context->ssl, tls_ex_index_context, new_context);
|
|
|
|
SSL_set_ex_data(new_context->ssl, tls_ex_index_listener, &db->config->listeners[i]);
|
|
|
|
SSL_set_ex_data(new_context->ssl, tls_ex_index_listener, new_context->listener);
|
|
|
|
new_context->want_write = true;
|
|
|
|
new_context->want_write = true;
|
|
|
|
bio = BIO_new_socket(new_sock, BIO_NOCLOSE);
|
|
|
|
bio = BIO_new_socket(new_sock, BIO_NOCLOSE);
|
|
|
|
SSL_set_bio(new_context->ssl, bio, bio);
|
|
|
|
SSL_set_bio(new_context->ssl, bio, bio);
|
|
|
@ -236,9 +233,6 @@ int net__socket_accept(struct mosquitto_db *db, mosq_sock_t listensock)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if(db->config->connection_messages == true){
|
|
|
|
if(db->config->connection_messages == true){
|
|
|
|