From 550c9c86a95b3bc9f98e11a99e376e0a6ec0bf82 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 3 Dec 2024 19:56:47 +0300 Subject: common code moved to the separate method --- protocols/JabberG/src/jabber_thread.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'protocols/JabberG/src/jabber_thread.cpp') diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index f1db58dd1e..c283904cde 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -648,6 +648,18 @@ void CJabberProto::PerformAuthentication(ThreadData *info) ///////////////////////////////////////////////////////////////////////////////////////// +void CJabberProto::OnProcessChannelBinding(const TiXmlElement *node) +{ + for (auto *it : TiXmlFilter(node, "channel-binding")) { + if (auto *pszType = it->Attribute("type")) { + if (!mir_strcmp(pszType, "tls-exporter")) + m_bTlsExporter = true; + else if (!mir_strcmp(pszType, "tls-server-end-point")) + m_bTlsServerEndpoint = true; + } + } +} + void CJabberProto::OnProcessFeatures(const TiXmlElement *node, ThreadData *info) { info->jabberServerCaps = JABBER_RESOURCE_CAPS_NONE; @@ -711,6 +723,8 @@ void CJabberProto::OnProcessFeatures(const TiXmlElement *node, ThreadData *info) } else if (!mir_strcmp(c->Name(), "upgrade") && c->Attribute("xmlns", "urn:xmpp:sasl:upgrade:0")) OnProcessUpgrade(c, info); + else if (!mir_strcmp(pszName, "sasl-channel-binding") && c->Attribute("xmlns", JABBER_FEAT_CHANNEL_BINDING)) + OnProcessChannelBinding(c); } } else if (!mir_strcmp(pszName, "session")) @@ -728,16 +742,8 @@ void CJabberProto::OnProcessFeatures(const TiXmlElement *node, ThreadData *info) } else info->jabberServerCaps |= pCaps->GetCaps(); } - else if (!mir_strcmp(pszName, "sasl-channel-binding") && !mir_strcmp(xmlns, JABBER_FEAT_CHANNEL_BINDING)) { - for (auto *it : TiXmlFilter(n, "channel-binding")) { - if (auto *pszType = it->Attribute("type")) { - if (!mir_strcmp(pszType, "tls-exporter")) - m_bTlsExporter = true; - else if (!mir_strcmp(pszType, "tls-server-end-point")) - m_bTlsServerEndpoint = true; - } - } - } + else if (!mir_strcmp(pszName, "sasl-channel-binding") && !mir_strcmp(xmlns, JABBER_FEAT_CHANNEL_BINDING)) + OnProcessChannelBinding(n); } if (areMechanismsDefined) { -- cgit v1.2.3