From 7a135968ad505c9ac82d56e27773a33ea77ccfdc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Dec 2023 17:57:01 +0300 Subject: Jabber: fix for SCRAM-xxx-PLUS login --- protocols/JabberG/src/jabber_secur.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 263574c448..9fe33337a6 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -209,18 +209,6 @@ TScramAuth::TScramAuth(ThreadData *info, const char *pszMech, const EVP_MD *pMet hashMethod(pMethod) { priority = iPriority; - - if ((iPriority % 10) == 1) { - int cbLen, tlsVer = info->proto->m_bTlsExporter; - void *pData = Netlib_GetTlsUnique(info->s, cbLen, tlsVer); - if (pData == nullptr) - bIsValid = false; - else { - bindFlag = (tlsVer == 13) ? "p=tls-exporter,," : "p=tls-unique,,"; - bindData.append(pData, cbLen); - } - } - else bindFlag = "n,,"; } TScramAuth::~TScramAuth() @@ -254,6 +242,19 @@ char* TScramAuth::getInitialRequest() Utils_GetRandom(nonce, sizeof(nonce)); cnonce = mir_base64_encode(nonce, sizeof(nonce)); + if ((priority % 10) == 1) { + if (info->proto->m_bTlsExporter) { + int cbLen, tlsVer = true; + void *pData = Netlib_GetTlsUnique(info->s, cbLen, tlsVer); + if (pData == nullptr) + return nullptr; + + bindFlag = (tlsVer == 13) ? "p=tls-exporter,," : "p=tls-unique,,"; + bindData.append(pData, cbLen); + } + } + else bindFlag = "n,,"; + CMStringA buf(FORMAT, "n=%s,r=%s", info->conn.username, cnonce); msg1 = mir_strdup(buf); -- cgit v1.2.3