From 3e136fc57a2e509e5a4dd265a798b196205b0a80 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 4 Oct 2026 22:02:19 +0200 Subject: Fix more warnings --- .../module/xep/0388_extensible_sasl_profile.vala | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'xmpp-vala/src/module/xep/0388_extensible_sasl_profile.vala') diff --git a/xmpp-vala/src/module/xep/0388_extensible_sasl_profile.vala b/xmpp-vala/src/module/xep/0388_extensible_sasl_profile.vala index 1c6afb30..54d00482 100644 --- a/xmpp-vala/src/module/xep/0388_extensible_sasl_profile.vala +++ b/xmpp-vala/src/module/xep/0388_extensible_sasl_profile.vala @@ -43,19 +43,27 @@ namespace Xmpp.Xep.ExtensibleSaslProfile { stream.expect_further_negotiation_stanzas = true; var authorisation_identifier = node.get_subnode("authorization-identifier", NS_URI); - string jid_string = authorisation_identifier.get_string_content(); - Jid jid = Jid.from_string(jid_string); + string jid_string = authorisation_identifier != null ? authorisation_identifier.get_string_content() : ""; + try { + Jid jid = Jid.from_string(jid_string); - foreach (var inline_provider in inline_activation_providers.values) { - inline_provider.on_bound(stream, jid, node); + foreach (var inline_provider in inline_activation_providers.values) { + inline_provider.on_bound(stream, jid, node); + } + } catch (InvalidJidError e) { + warning("Server provided invalid authorization-identifier \"%s\": %s", jid_string, e.message); } } else if (node.name == "challenge" && stream.has_flag(Flag.IDENTITY)) { Flag flag = stream.get_flag(Flag.IDENTITY); if (flag.mechanism == Mechanism.SCRAM_SHA_1) { - var challenge_response = compute_challenge_response(node.get_string_content(), flag.password, flag.client_nonce, flag.name); - flag.server_signature = challenge_response.expected_server_signature; - stream.write(new StanzaNode.build("response", NS_URI).add_self_xmlns() - .put_node(new StanzaNode.text(Base64.encode((uchar[]) (challenge_response.response).to_utf8())))); + try { + var challenge_response = compute_challenge_response(node.get_string_content(), flag.password, flag.client_nonce, flag.name); + flag.server_signature = challenge_response.expected_server_signature; + stream.write(new StanzaNode.build("response", NS_URI).add_self_xmlns() + .put_node(new StanzaNode.text(Base64.encode((uchar[]) (challenge_response.response).to_utf8())))); + } catch (Error e) { + warning("Error computing challenge response: %s", e.message); + } } } else if (node.name == "failure") { stream.remove_flag(stream.get_flag(Flag.IDENTITY)); -- cgit v1.3