From 2d9f516d1d36bbdd4b114dd3652bbeaebd2fa379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 27 Dec 2017 19:23:28 +0100 Subject: =?UTF-8?q?Don=E2=80=99t=20answer=20to=20some=20requests=20towards?= =?UTF-8?q?=20MUC=20participants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These requests are only meant to be received by the room itself. The participant must answer with not-implemented instead. fix #3323 --- src/xmpp/biboumi_component.cpp | 17 ++++++++++++----- tests/end_to_end/__main__.py | 8 +++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index a998fbe..e6eca3b 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -444,8 +444,13 @@ void BiboumiComponent::handle_iq(const Stanza& stanza) { if (iid.type == Iid::Type::Server) adhoc_handler = &this->irc_server_adhoc_commands_handler; - else + else if (iid.type == Iid::Type::Channel && to.resource.empty()) adhoc_handler = &this->irc_channel_adhoc_commands_handler; + else + { + error_name = "feature-not-implemented"; + return; + } } // Execute the command, if any, and get a result XmlNode that we // insert in our response @@ -495,7 +500,7 @@ void BiboumiComponent::handle_iq(const Stanza& stanza) stanza_error.disable(); } } - else if (iid.type == Iid::Type::Channel) + else if (iid.type == Iid::Type::Channel && to.resource.empty()) { if (node.empty()) { @@ -554,7 +559,7 @@ void BiboumiComponent::handle_iq(const Stanza& stanza) this->irc_server_adhoc_commands_handler); stanza_error.disable(); } - else if (iid.type == Iid::Type::Channel) + else if (iid.type == Iid::Type::Channel && to.resource.empty()) { // Get the channel's adhoc commands this->send_adhoc_commands_list(id, from, to_str, (Config::get("admin", "") == @@ -562,6 +567,8 @@ void BiboumiComponent::handle_iq(const Stanza& stanza) this->irc_channel_adhoc_commands_handler); stanza_error.disable(); } + else // “to” is a MUC user, not the room itself + error_name = "feature-not-implemented"; } else if (node.empty() && iid.type == Iid::Type::Server) { // Disco on an IRC server: get the list of channels @@ -784,7 +791,7 @@ bool BiboumiComponent::handle_room_configuration_form_request(const std::string& { Iid iid(to.local, {'#', '&'}); - if (iid.type != Iid::Type::Channel) + if (iid.type != Iid::Type::Channel || !to.resource.empty()) return false; Stanza iq("iq"); @@ -806,7 +813,7 @@ bool BiboumiComponent::handle_room_configuration_form(const XmlNode& query, cons { Iid iid(to.local, {'#', '&'}); - if (iid.type != Iid::Type::Channel) + if (iid.type != Iid::Type::Channel || !to.resource.empty()) return false; Jid requester(from); diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index 271f87b..649e073 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -909,7 +909,13 @@ if __name__ == '__main__': partial(expect_stanza, ("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']", "/iq/disco_items:query/disco_items:item[6]")), ], conf='fixed_server'), - + Scenario("list_muc_user_adhoc", + [ + handshake_sequence(), + partial(send_stanza, ""), + partial(expect_stanza, "/iq[@type='error']/error[@type='cancel']/stanza:feature-not-implemented"), + ] + ), Scenario("execute_hello_adhoc_command", [ handshake_sequence(), -- cgit v1.2.3