Restore old interface if TLS connection failed
This was reported as creating a segfault in [0] [0] https://github.com/profanity-im/profanity/issues/1963 Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
@@ -1092,6 +1092,7 @@ int conn_tls_start(xmpp_conn_t *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (conn->tls != NULL) {
|
if (conn->tls != NULL) {
|
||||||
|
struct conn_interface old_intf = conn->intf;
|
||||||
conn->intf = tls_intf;
|
conn->intf = tls_intf;
|
||||||
conn->intf.conn = conn;
|
conn->intf.conn = conn;
|
||||||
if (tls_start(conn->tls)) {
|
if (tls_start(conn->tls)) {
|
||||||
@@ -1102,6 +1103,7 @@ int conn_tls_start(xmpp_conn_t *conn)
|
|||||||
tls_free(conn->tls);
|
tls_free(conn->tls);
|
||||||
conn->tls = NULL;
|
conn->tls = NULL;
|
||||||
conn->tls_failed = 1;
|
conn->tls_failed = 1;
|
||||||
|
conn->intf = old_intf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user