From 2bf0d384aca5129ebb60403bc993b2408db52e32 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Fri, 16 Jun 2023 11:05:34 +0200 Subject: QXmppStreamFeatures.cpp: Fix wrong mechanism parsing Inside a urn:ietf:params:xml:ns:xmpp-sasl "mechanisms" element, the following tree is expected: SCRAM-SHA-1 PLAIN ... However, QXmppStreamFeatures::parse was looking for "mechanism" from the parent element, and not from the node belonging to "mechanisms". This caused authentication to never being performed, rendering QXmpp near to useless. --- src/base/QXmppStreamFeatures.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/base') diff --git a/src/base/QXmppStreamFeatures.cpp b/src/base/QXmppStreamFeatures.cpp index 8041ea4d..89ce8e9a 100644 --- a/src/base/QXmppStreamFeatures.cpp +++ b/src/base/QXmppStreamFeatures.cpp @@ -319,7 +319,7 @@ void QXmppStreamFeatures::parse(const QDomElement &element) // parse advertised SASL Authentication mechanisms QDomElement mechs = element.firstChildElement(QStringLiteral("mechanisms")); if (mechs.namespaceURI() == ns_sasl) { - for (auto subElement = element.firstChildElement(QStringLiteral("mechanism")); + for (auto subElement = mechs.firstChildElement(QStringLiteral("mechanism")); !subElement.isNull(); subElement = subElement.nextSiblingElement(QStringLiteral("mechanism"))) { d->authMechanisms << subElement.text(); -- cgit v1.2.3