aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/objects/qthttp/qhttpauthenticator.cpp
diff options
context:
space:
mode:
authorGravatar ctrlaltca2024-03-24 11:39:46 +0100
committerGravatar GitHub2024-03-24 11:39:46 +0100
commite68e34095057a9d7d7aedbaf8ad9773913aa4794 (patch)
treed4953cef4477a68cacf76259a129653f2f080da8 /src/modules/objects/qthttp/qhttpauthenticator.cpp
parentFix Wayland appId (#2621) (diff)
downloadKVIrc-e68e34095057a9d7d7aedbaf8ad9773913aa4794.tar.gz
KVIrc-e68e34095057a9d7d7aedbaf8ad9773913aa4794.tar.bz2
KVIrc-e68e34095057a9d7d7aedbaf8ad9773913aa4794.zip
More qt6 porting (#2622)
* Port QColor::setNamedColor to QColor::fromString * Port from QVariant::Type to QmetaType::Type * KviCoreActions: port from QAction::parentWidget to qobject_cast + QAction::parent * KviIrcView: port QString::fromUtf16 usage to the non-obsolete char16_t* overload * KviTopicWidget: port QMouseEvent to a non-obsolete overload * Port QMouseEvent from old pos(), x(), y(), to position() * Port obsolete QMessageBox usage to custom buttons * KviApplication: initialize the dbus notify message "replace ID" to 0 * KviIrcConnection: port deprecated QString::count() to QString::size() * KvsObject_*: port QColor::setNamedColor to QColor::fromString * KvsObject_widget: port QWidget::isTopLevel to QWidget::isWindow * KviMainWindow: use QKeyCombination instead of int for shortcuts * QHttp: avoid deprecated methods for QCryptographicHash * ScriptEditorWidget: use the new signature for QMenu::addAction() * KviInputEditor: Extract ACCEL_KEY from header and avoid warning * KviStringConversion: convert old Qt5 font weights to new "css" font weights * syntax fix
Diffstat (limited to 'src/modules/objects/qthttp/qhttpauthenticator.cpp')
-rw-r--r--src/modules/objects/qthttp/qhttpauthenticator.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/modules/objects/qthttp/qhttpauthenticator.cpp b/src/modules/objects/qthttp/qhttpauthenticator.cpp
index daf1465e4..2d256c6de 100644
--- a/src/modules/objects/qthttp/qhttpauthenticator.cpp
+++ b/src/modules/objects/qthttp/qhttpauthenticator.cpp
@@ -599,10 +599,11 @@ static QByteArray digestMd5ResponseHelper(
)
{
QCryptographicHash hash(QCryptographicHash::Md5);
+ QByteArray colon(":");
hash.addData(userName);
- hash.addData(":", 1);
+ hash.addData(colon);
hash.addData(realm);
- hash.addData(":", 1);
+ hash.addData(colon);
hash.addData(password);
QByteArray ha1 = hash.result();
if(alg.toLower() == "md5-sess")
@@ -613,9 +614,9 @@ static QByteArray digestMd5ResponseHelper(
// but according to the errata page at http://www.rfc-editor.org/errata_list.php, ID 1649, it
// must be the following line:
hash.addData(ha1.toHex());
- hash.addData(":", 1);
+ hash.addData(colon);
hash.addData(nonce);
- hash.addData(":", 1);
+ hash.addData(colon);
hash.addData(cNonce);
ha1 = hash.result();
};
@@ -624,11 +625,11 @@ static QByteArray digestMd5ResponseHelper(
// calculate H(A2)
hash.reset();
hash.addData(method);
- hash.addData(":", 1);
+ hash.addData(colon);
hash.addData(digestUri);
if(qop.toLower() == "auth-int")
{
- hash.addData(":", 1);
+ hash.addData(colon);
hash.addData(hEntity);
}
QByteArray ha2hex = hash.result().toHex();
@@ -636,17 +637,17 @@ static QByteArray digestMd5ResponseHelper(
// calculate response
hash.reset();
hash.addData(ha1);
- hash.addData(":", 1);
+ hash.addData(colon);
hash.addData(nonce);
- hash.addData(":", 1);
+ hash.addData(colon);
if(!qop.isNull())
{
hash.addData(nonceCount);
- hash.addData(":", 1);
+ hash.addData(colon);
hash.addData(cNonce);
- hash.addData(":", 1);
+ hash.addData(colon);
hash.addData(qop);
- hash.addData(":", 1);
+ hash.addData(colon);
}
hash.addData(ha2hex);
return hash.result().toHex();
@@ -1226,7 +1227,7 @@ static QByteArray qCreatev2Hash(const QHttpAuthenticatorPrivate * ctx,
{
QCryptographicHash md4(QCryptographicHash::Md4);
QByteArray passUnicode = qStringAsUcs2Le(ctx->password);
- md4.addData(passUnicode.data(), passUnicode.size());
+ md4.addData(passUnicode);
QByteArray hashKey = md4.result();
Q_ASSERT(hashKey.size() == 16);