Fix TLS connections not working over SOCKS.

Thanks to Mark Oeltjenbruns.
pull/1151/head
Roger A. Light 7 years ago
parent a2b78d87a6
commit e8320cbf19

@ -4,6 +4,9 @@
Broker: Broker:
- Fixed comment handling for config options that have optional arguments. - Fixed comment handling for config options that have optional arguments.
Library:
- Fix TLS connections not working over SOCKS.
Build: Build:
- Fix comparison of boolean values in CMake build. Closes #1101. - Fix comparison of boolean values in CMake build. Closes #1101.
- Fix compilation when openssl deprecated APIs are not available. - Fix compilation when openssl deprecated APIs are not available.

@ -610,7 +610,7 @@ static int net__init_ssl_ctx(struct mosquitto *mosq)
#endif #endif
int net__socket_connect_step3(struct mosquitto *mosq, const char *host, uint16_t port, const char *bind_address, bool blocking) int net__socket_connect_step3(struct mosquitto *mosq, const char *host)
{ {
#ifdef WITH_TLS #ifdef WITH_TLS
BIO *bio; BIO *bio;
@ -671,8 +671,13 @@ int net__socket_connect(struct mosquitto *mosq, const char *host, uint16_t port,
mosq->sock = sock; mosq->sock = sock;
rc = net__socket_connect_step3(mosq, host, port, bind_address, blocking); #ifdef WITH_SOCKS
if(rc) return rc; if(!mosq->socks5_host)
#endif
{
rc = net__socket_connect_step3(mosq, host);
if(rc) return rc;
}
return MOSQ_ERR_SUCCESS; return MOSQ_ERR_SUCCESS;
} }

@ -61,7 +61,7 @@ int net__socket_close(struct mosquitto *mosq);
int net__try_connect(struct mosquitto *mosq, const char *host, uint16_t port, mosq_sock_t *sock, const char *bind_address, bool blocking); int net__try_connect(struct mosquitto *mosq, const char *host, uint16_t port, mosq_sock_t *sock, const char *bind_address, bool blocking);
int net__try_connect_step1(struct mosquitto *mosq, const char *host); int net__try_connect_step1(struct mosquitto *mosq, const char *host);
int net__try_connect_step2(struct mosquitto *mosq, uint16_t port, mosq_sock_t *sock); int net__try_connect_step2(struct mosquitto *mosq, uint16_t port, mosq_sock_t *sock);
int net__socket_connect_step3(struct mosquitto *mosq, const char *host, uint16_t port, const char *bind_address, bool blocking); int net__socket_connect_step3(struct mosquitto *mosq, const char *host);
int net__socket_nonblock(mosq_sock_t *sock); int net__socket_nonblock(mosq_sock_t *sock);
int net__socketpair(mosq_sock_t *sp1, mosq_sock_t *sp2); int net__socketpair(mosq_sock_t *sp1, mosq_sock_t *sp2);

@ -424,6 +424,10 @@ int socks5__read(struct mosquitto *mosq)
/* Auth passed */ /* Auth passed */
packet__cleanup(&mosq->in_packet); packet__cleanup(&mosq->in_packet);
mosq->state = mosq_cs_new; mosq->state = mosq_cs_new;
if(mosq->socks5_host){
int rc = net__socket_connect_step3(mosq, mosq->host);
if(rc) return rc;
}
return send__connect(mosq, mosq->keepalive, mosq->clean_session); return send__connect(mosq, mosq->keepalive, mosq->clean_session);
}else{ }else{
i = mosq->in_packet.payload[1]; i = mosq->in_packet.payload[1];

Loading…
Cancel
Save