From 95c8d120b40e0bca89d1b6f83e902de9529e8006 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sat, 28 Jan 2023 17:36:09 +0100 Subject: IqHandling: Don't accept IQ results/errors --- src/client/QXmppIqHandling.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/client/QXmppIqHandling.cpp') diff --git a/src/client/QXmppIqHandling.cpp b/src/client/QXmppIqHandling.cpp index be164f0f..ddc980fe 100644 --- a/src/client/QXmppIqHandling.cpp +++ b/src/client/QXmppIqHandling.cpp @@ -25,3 +25,16 @@ void QXmpp::Private::sendIqReply(QXmppClient *client, iq.setId(requestId); client->reply(std::move(iq), e2eeMetadata); } + +std::tuple QXmpp::Private::checkIsIqRequest(const QDomElement &el) +{ + if (el.tagName() != QStringLiteral("iq")) { + return { false, {}, {} }; + } + auto queryElement = el.firstChildElement(); + auto iqType = el.attribute(QStringLiteral("type")); + if (iqType != QStringLiteral("get") && iqType != QStringLiteral("set")) { + return { false, {}, {} }; + } + return { true, queryElement.tagName(), queryElement.namespaceURI() }; +} -- cgit v1.2.3