diff options
author | fiaxh <git@lightrise.org> | 2020-12-31 23:19:06 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-12-31 23:19:06 +0100 |
commit | 2c22c0428cb53252930d52e6327f14a6fcc8cf03 (patch) | |
tree | a282774719bd346c47df955b7b35b7754fbf130d | |
parent | c7b242a72e411f54192ae74f0bebaf090c4dc17a (diff) | |
download | dino-2c22c0428cb53252930d52e6327f14a6fcc8cf03.tar.gz dino-2c22c0428cb53252930d52e6327f14a6fcc8cf03.zip |
Fix segfault on accept_certificate signal (fixup 81a5505)
-rw-r--r-- | libdino/src/service/connection_manager.vala | 2 | ||||
-rw-r--r-- | libdino/src/service/registration.vala | 8 | ||||
-rw-r--r-- | xmpp-vala/src/core/direct_tls_xmpp_stream.vala | 6 | ||||
-rw-r--r-- | xmpp-vala/src/core/starttls_xmpp_stream.vala | 6 | ||||
-rw-r--r-- | xmpp-vala/src/core/stream_connect.vala | 6 | ||||
-rw-r--r-- | xmpp-vala/src/core/tls_xmpp_stream.vala | 4 |
6 files changed, 16 insertions, 16 deletions
diff --git a/libdino/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala index 3ea6386b..e0f4e19c 100644 --- a/libdino/src/service/connection_manager.vala +++ b/libdino/src/service/connection_manager.vala @@ -197,7 +197,7 @@ public class ConnectionManager : Object { change_connection_state(account, ConnectionState.CONNECTING); stream_result = yield Xmpp.establish_stream(account.bare_jid, module_manager.get_modules(account, resource), log_options, - (_, peer_cert, errors) => { return on_invalid_certificate(account.domainpart, peer_cert, errors); } + (peer_cert, errors) => { return on_invalid_certificate(account.domainpart, peer_cert, errors); } ); connections[account].stream = stream_result.stream; diff --git a/libdino/src/service/registration.vala b/libdino/src/service/registration.vala index 365f31b0..4255f322 100644 --- a/libdino/src/service/registration.vala +++ b/libdino/src/service/registration.vala @@ -30,7 +30,7 @@ public class Register : StreamInteractionModule, Object{ list.add(new Sasl.Module(account.bare_jid.to_string(), account.password)); XmppStreamResult stream_result = yield Xmpp.establish_stream(account.bare_jid.domain_jid, list, Application.print_xmpp, - (_, peer_cert, errors) => { return ConnectionManager.on_invalid_certificate(account.domainpart, peer_cert, errors); } + (peer_cert, errors) => { return ConnectionManager.on_invalid_certificate(account.domainpart, peer_cert, errors); } ); if (stream_result.stream == null) { @@ -83,7 +83,7 @@ public class Register : StreamInteractionModule, Object{ list.add(new Iq.Module()); XmppStreamResult stream_result = yield Xmpp.establish_stream(jid.domain_jid, list, Application.print_xmpp, - (_, peer_cert, errors) => { return ConnectionManager.on_invalid_certificate(jid.domainpart, peer_cert, errors); } + (peer_cert, errors) => { return ConnectionManager.on_invalid_certificate(jid.domainpart, peer_cert, errors); } ); if (stream_result.stream == null) { @@ -137,7 +137,7 @@ public class Register : StreamInteractionModule, Object{ list.add(new Xep.InBandRegistration.Module()); XmppStreamResult stream_result = yield Xmpp.establish_stream(jid.domain_jid, list, Application.print_xmpp, - (_, peer_cert, errors) => { return ConnectionManager.on_invalid_certificate(jid.domainpart, peer_cert, errors); } + (peer_cert, errors) => { return ConnectionManager.on_invalid_certificate(jid.domainpart, peer_cert, errors); } ); if (stream_result.stream == null) { @@ -188,7 +188,7 @@ public class Register : StreamInteractionModule, Object{ list.add(new Xep.InBandRegistration.Module()); XmppStreamResult stream_result = yield Xmpp.establish_stream(jid.domain_jid, list, Application.print_xmpp, - (_, peer_cert, errors) => { return ConnectionManager.on_invalid_certificate(jid.domainpart, peer_cert, errors); } + (peer_cert, errors) => { return ConnectionManager.on_invalid_certificate(jid.domainpart, peer_cert, errors); } ); if (stream_result.stream == null) { diff --git a/xmpp-vala/src/core/direct_tls_xmpp_stream.vala b/xmpp-vala/src/core/direct_tls_xmpp_stream.vala index 1c262598..ca38b7bb 100644 --- a/xmpp-vala/src/core/direct_tls_xmpp_stream.vala +++ b/xmpp-vala/src/core/direct_tls_xmpp_stream.vala @@ -4,11 +4,11 @@ public class Xmpp.DirectTlsXmppStream : TlsXmppStream { uint16 port; TlsXmppStream.OnInvalidCert on_invalid_cert_outer; - public DirectTlsXmppStream(Jid remote_name, string host, uint16 port, TlsXmppStream.OnInvalidCert on_invalid_cert) { + public DirectTlsXmppStream(Jid remote_name, string host, uint16 port, owned TlsXmppStream.OnInvalidCert on_invalid_cert) { base(remote_name); this.host = host; this.port = port; - this.on_invalid_cert_outer = on_invalid_cert; + this.on_invalid_cert_outer = (owned)on_invalid_cert; } public override async void connect() throws IOStreamError { @@ -21,7 +21,7 @@ public class Xmpp.DirectTlsXmppStream : TlsXmppStream { tls_connection.set_advertised_protocols(new string[]{"xmpp-client"}); #endif tls_connection.accept_certificate.connect(on_invalid_certificate); - tls_connection.accept_certificate.connect(on_invalid_cert_outer); + tls_connection.accept_certificate.connect((cert, flags) => on_invalid_cert_outer(cert, flags)); reset_stream(tls_connection); yield setup(); diff --git a/xmpp-vala/src/core/starttls_xmpp_stream.vala b/xmpp-vala/src/core/starttls_xmpp_stream.vala index 401d7295..1e4f7954 100644 --- a/xmpp-vala/src/core/starttls_xmpp_stream.vala +++ b/xmpp-vala/src/core/starttls_xmpp_stream.vala @@ -6,11 +6,11 @@ public class Xmpp.StartTlsXmppStream : TlsXmppStream { uint16 port; TlsXmppStream.OnInvalidCert on_invalid_cert_outer; - public StartTlsXmppStream(Jid remote, string host, uint16 port, TlsXmppStream.OnInvalidCert on_invalid_cert) { + public StartTlsXmppStream(Jid remote, string host, uint16 port, owned TlsXmppStream.OnInvalidCert on_invalid_cert) { base(remote); this.host = host; this.port = port; - this.on_invalid_cert_outer = on_invalid_cert; + this.on_invalid_cert_outer = (owned)on_invalid_cert; } public override async void connect() throws IOStreamError { @@ -42,7 +42,7 @@ public class Xmpp.StartTlsXmppStream : TlsXmppStream { reset_stream(conn); conn.accept_certificate.connect(on_invalid_certificate); - conn.accept_certificate.connect(on_invalid_cert_outer); + conn.accept_certificate.connect((cert, flags) => on_invalid_cert_outer(cert, flags)); } catch (Error e) { stderr.printf("Failed to start TLS: %s\n", e.message); } diff --git a/xmpp-vala/src/core/stream_connect.vala b/xmpp-vala/src/core/stream_connect.vala index 9a3dac76..b58563f7 100644 --- a/xmpp-vala/src/core/stream_connect.vala +++ b/xmpp-vala/src/core/stream_connect.vala @@ -13,7 +13,7 @@ namespace Xmpp { public IOStreamError? io_error { get; set; } } - public async XmppStreamResult establish_stream(Jid bare_jid, Gee.List<XmppStreamModule> modules, string? log_options, TlsXmppStream.OnInvalidCert on_invalid_cert) { + public async XmppStreamResult establish_stream(Jid bare_jid, Gee.List<XmppStreamModule> modules, string? log_options, owned TlsXmppStream.OnInvalidCert on_invalid_cert) { Jid remote = bare_jid.domain_jid; //Lookup xmpp-client and xmpps-client SRV records @@ -58,9 +58,9 @@ namespace Xmpp { foreach (SrvTargetInfo target in targets) { try { if (target.service == "xmpp-client") { - stream = new StartTlsXmppStream(remote, target.host, target.port, on_invalid_cert); + stream = new StartTlsXmppStream(remote, target.host, target.port, (owned)on_invalid_cert); } else { - stream = new DirectTlsXmppStream(remote, target.host, target.port, on_invalid_cert); + stream = new DirectTlsXmppStream(remote, target.host, target.port, (owned)on_invalid_cert); } stream.log = new XmppLog(bare_jid.to_string(), log_options); diff --git a/xmpp-vala/src/core/tls_xmpp_stream.vala b/xmpp-vala/src/core/tls_xmpp_stream.vala index f47b3c80..043c5c70 100644 --- a/xmpp-vala/src/core/tls_xmpp_stream.vala +++ b/xmpp-vala/src/core/tls_xmpp_stream.vala @@ -2,7 +2,7 @@ public abstract class Xmpp.TlsXmppStream : IoXmppStream { public TlsCertificateFlags? errors; - public delegate bool OnInvalidCert(GLib.TlsConnection conn, GLib.TlsCertificate peer_cert, GLib.TlsCertificateFlags errors); + public delegate bool OnInvalidCert(GLib.TlsCertificate peer_cert, GLib.TlsCertificateFlags errors); protected TlsXmppStream(Jid remote_name) { base(remote_name); @@ -19,7 +19,7 @@ public abstract class Xmpp.TlsXmppStream : IoXmppStream { error_str += @"$(f), "; } } - warning(@"[%p, %s] Tls Certificate Errors: %s", this, this.remote_name, error_str); + warning(@"[%p, %s] Tls Certificate Errors: %s", this, this.remote_name.to_string(), error_str); return false; } }
\ No newline at end of file |