diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/xmpp/connection.c | 12 | ||||
-rw-r--r-- | src/xmpp/iq.c | 10 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index d57a1376..3165a18e 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -198,6 +198,10 @@ _conn_apply_settings(const char* const jid, const char* const passwd, const char long flags = xmpp_conn_get_flags(conn.xmpp_conn); + /* clear all TLS & auth related flags */ + flags &= ~(XMPP_CONN_FLAG_DISABLE_TLS | XMPP_CONN_FLAG_MANDATORY_TLS + | XMPP_CONN_FLAG_LEGACY_SSL | XMPP_CONN_FLAG_TRUST_TLS + | XMPP_CONN_FLAG_LEGACY_AUTH); if (!tls_policy || (g_strcmp0(tls_policy, "force") == 0)) { flags |= XMPP_CONN_FLAG_MANDATORY_TLS; } else if (g_strcmp0(tls_policy, "trust") == 0) { @@ -213,8 +217,6 @@ _conn_apply_settings(const char* const jid, const char* const passwd, const char flags |= XMPP_CONN_FLAG_LEGACY_AUTH; } - xmpp_conn_set_flags(conn.xmpp_conn, flags); - /* Print debug logs that can help when users share the logs */ if (flags != 0) { log_debug("Connecting with flags (0x%lx):", flags); @@ -230,6 +232,12 @@ _conn_apply_settings(const char* const jid, const char* const passwd, const char #undef LOG_FLAG_IF_SET } + if (xmpp_conn_set_flags(conn.xmpp_conn, flags)) { + log_error("libstrophe doesn't accept this combination of flags: 0x%x", flags); + conn.conn_status = JABBER_DISCONNECTED; + return FALSE; + } + char* cert_path = prefs_get_tls_certpath(); if (cert_path) { xmpp_conn_set_capath(conn.xmpp_conn, cert_path); diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 89511176..e6c1f6dc 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -1396,9 +1396,7 @@ _autoping_timed_send(xmpp_conn_t* const conn, void* const userdata) log_warning("Server doesn't advertise %s feature, disabling autoping.", XMPP_FEATURE_PING); prefs_set_autoping(0); cons_show_error("Server ping not supported (%s), autoping disabled.", XMPP_FEATURE_PING); - xmpp_conn_t* conn = connection_get_conn(); - xmpp_timed_handler_delete(conn, _autoping_timed_send); - return 1; + return 0; } if (autoping_wait) { @@ -1464,8 +1462,7 @@ _auto_pong_id_handler(xmpp_stanza_t* const stanza, void* const userdata) log_warning("Server ping (id=%s) error type 'cancel', disabling autoping.", id); prefs_set_autoping(0); cons_show_error("Server ping not supported, autoping disabled."); - xmpp_conn_t* conn = connection_get_conn(); - xmpp_timed_handler_delete(conn, _autoping_timed_send); + xmpp_timed_handler_delete(connection_get_conn(), _autoping_timed_send); } return 0; @@ -1533,8 +1530,7 @@ _version_result_id_handler(xmpp_stanza_t* const stanza, void* const userdata) log_warning("From attribute specified different JID, using original JID."); } - xmpp_conn_t* conn = connection_get_conn(); - xmpp_ctx_t* ctx = xmpp_conn_get_context(conn); + xmpp_ctx_t* ctx = connection_get_ctx(); Jid* jidp = jid_create((char*)userdata); |