aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-06-16 11:05:34 +0200
committerLinus Jahn <lnj@kaidan.im>2023-06-17 12:33:08 +0200
commit2bf0d384aca5129ebb60403bc993b2408db52e32 (patch)
tree490f9f6a954372e47858a53259928ab7c95a8d3e
parent6fe82239fc55b16953f965ea4e20e5fbfe806dd5 (diff)
QXmppStreamFeatures.cpp: Fix wrong mechanism parsing
Inside a urn:ietf:params:xml:ns:xmpp-sasl "mechanisms" element, the following tree is expected: <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> <mechanism>SCRAM-SHA-1</mechanism> <mechanism>PLAIN</mechanism> ... </mechanisms> 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.
-rw-r--r--src/base/QXmppStreamFeatures.cpp2
1 files changed, 1 insertions, 1 deletions
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();