From fa731a46235e7d6b46450f339539247d3671514b Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 16 Nov 2018 16:27:31 +0100 Subject: Split login jid/password into two steps with checks --- xmpp-vala/src/module/tls.vala | 3 ++- xmpp-vala/src/module/xep/0368_srv_records_tls.vala | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'xmpp-vala') diff --git a/xmpp-vala/src/module/tls.vala b/xmpp-vala/src/module/tls.vala index f2d58d32..c3afc4b3 100644 --- a/xmpp-vala/src/module/tls.vala +++ b/xmpp-vala/src/module/tls.vala @@ -58,7 +58,7 @@ namespace Xmpp.Tls { } } - public static bool on_invalid_certificate(TlsCertificate peer_cert, TlsCertificateFlags errors) { + public bool on_invalid_certificate(TlsCertificate peer_cert, TlsCertificateFlags errors) { string error_str = ""; foreach (var f in new TlsCertificateFlags[]{TlsCertificateFlags.UNKNOWN_CA, TlsCertificateFlags.BAD_IDENTITY, TlsCertificateFlags.NOT_ACTIVATED, TlsCertificateFlags.EXPIRED, TlsCertificateFlags.REVOKED, @@ -68,6 +68,7 @@ namespace Xmpp.Tls { } } warning(@"Tls Certificate Errors: $(error_str)"); + invalid_certificate(peer_cert, errors); return false; } diff --git a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala index 87c8e433..a40d0bb5 100644 --- a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala +++ b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala @@ -38,7 +38,7 @@ public class TlsConnectionProvider : ConnectionProvider { try { IOStream? io_stream = yield client.connect_to_host_async(srv_target.get_hostname(), srv_target.get_port()); TlsConnection tls_connection = TlsClientConnection.new(io_stream, new NetworkAddress(stream.remote_name.to_string(), srv_target.get_port())); - tls_connection.accept_certificate.connect(Tls.Module.on_invalid_certificate); + tls_connection.accept_certificate.connect(stream.get_module(Tls.Module.IDENTITY).on_invalid_certificate); stream.add_flag(new Tls.Flag() { finished=true }); return tls_connection; } catch (Error e) { -- cgit v1.2.3-70-g09d2