From cfae22235633b160e3fd52f0c0c8d6f2e81278ea Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Thu, 29 Sep 2022 11:17:55 +0200 Subject: [PATCH 1/2] Fix stream from verification https://datatracker.ietf.org/doc/html/rfc6120#section-8.1.2.1 1. When a server receives an XML stanza from a connected client, the server MUST add a 'from' attribute to the stanza or override the 'from' attribute specified by the client, where the value of the 'from' attribute MUST be the full JID () determined by the server for the connected resource that generated the stanza (see Section 4.3.6), or the bare JID () in the case of subscription-related presence stanzas (see [XMPP-IM]). --- src/c2s/mongoose_c2s.erl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/c2s/mongoose_c2s.erl b/src/c2s/mongoose_c2s.erl index 732fa750ee..4246417e64 100644 --- a/src/c2s/mongoose_c2s.erl +++ b/src/c2s/mongoose_c2s.erl @@ -569,8 +569,15 @@ maybe_retry_state({wait_for_sasl_response, SaslState, Retries}) -> verify_from(El, StateJid) -> case exml_query:attr(El, <<"from">>) of undefined -> true; - SJid -> - jid:are_equal(jid:from_binary(SJid), StateJid) + GJid -> + case jid:from_binary(GJid) of + error -> + false; + #jid{lresource = <<>>} = GivenJid -> + jid:are_bare_equal(GivenJid, StateJid); + #jid{} = GivenJid -> + jid:are_equal(GivenJid, StateJid) + end end. -spec handle_foreign_packet(c2s_data(), c2s_state(), exml:element()) -> fsm_res(). From e555aaef6b5b01aea157915c306bb90fe9e9081e Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 3 Oct 2022 22:42:17 +0200 Subject: [PATCH 2/2] Reenable several suites that can pass already --- big_tests/default.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/big_tests/default.spec b/big_tests/default.spec index f3cf840e7e..cd23dbb4ae 100644 --- a/big_tests/default.spec +++ b/big_tests/default.spec @@ -73,9 +73,9 @@ {suites, "tests", mongoose_elasticsearch_SUITE}. % {suites, "tests", mongooseimctl_SUITE}. % {suites, "tests", muc_SUITE}. -% {suites, "tests", muc_http_api_SUITE}. -% {suites, "tests", muc_light_SUITE}. -% {suites, "tests", muc_light_http_api_SUITE}. +{suites, "tests", muc_http_api_SUITE}. +{suites, "tests", muc_light_SUITE}. +{suites, "tests", muc_light_http_api_SUITE}. % {suites, "tests", muc_light_legacy_SUITE}. {suites, "tests", oauth_SUITE}. {suites, "tests", offline_SUITE}. @@ -85,8 +85,8 @@ {suites, "tests", presence_SUITE}. {suites, "tests", privacy_SUITE}. {suites, "tests", private_SUITE}. -% {suites, "tests", pubsub_SUITE}. -% {suites, "tests", pubsub_s2s_SUITE}. +{suites, "tests", pubsub_SUITE}. +{suites, "tests", pubsub_s2s_SUITE}. % {suites, "tests", push_SUITE}. {suites, "tests", push_http_SUITE}. % {suites, "tests", push_integration_SUITE}.