Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 37997a4fc4560352e7f41964781a758eab4382f7 Mon Sep 17 00:00:00 2001
- From: Thiago Macieira <thiago.macieira@nokia.com>
- Date: Tue, 16 Mar 2010 19:30:52 +0100
- Subject: [PATCH] Get rid of the QAuthenticatorPrivate::realm member
- This is now only in the options hash.
- ---
- src/network/kernel/qauthenticator.cpp | 24 +++++++++++++-----------
- src/network/kernel/qauthenticator_p.h | 1 -
- 2 files changed, 13 insertions(+), 12 deletions(-)
- diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
- index 95be0d1..621e9f5 100644
- --- a/src/network/kernel/qauthenticator.cpp
- +++ b/src/network/kernel/qauthenticator.cpp
- @@ -110,7 +110,12 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
- \section2 NTLM version 1
- - The NTLM authentication mechanism currently supports no incoming or outgoing options.
- + \table
- + \header \o Option \o Direction \o Description
- + \row \o \tt{realm} \o Incoming \o Contains the realm of the authentication, the same as realm()
- + \endtable
- +
- + The NTLM authentication mechanism supports no outgoing options.
- \section2 Digest-MD5
- @@ -180,7 +185,6 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const
- return true;
- return d->user == other.d->user
- && d->password == other.d->password
- - && d->realm == other.d->realm
- && d->method == other.d->method
- && d->options == other.d->options
- && d->outgoingOptions == other.d->outgoingOptions;
- @@ -396,16 +400,13 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header,
- switch(method) {
- case Basic:
- - realm = QString::fromLatin1(options.value("realm"));
- if (user.isEmpty())
- phase = Done;
- break;
- case Ntlm:
- // #### extract from header
- - realm.clear();
- break;
- case DigestMd5: {
- - realm = QString::fromLatin1(options.value("realm"));
- if (options.value("stale").toLower() == "true")
- phase = Start;
- if (user.isEmpty())
- @@ -413,7 +414,6 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header,
- break;
- }
- default:
- - realm.clear();
- challenge = QByteArray();
- phase = Invalid;
- }
- @@ -628,10 +628,11 @@ QByteArray QAuthenticatorPrivate::digestMd5Response(const QByteArray &challenge,
- QByteArray nonce = options.value("nonce");
- QByteArray opaque = options.value("opaque");
- QByteArray qop = options.value("qop");
- + QByteArray realm = options.value("realm");
- // qDebug() << "calculating digest: method=" << method << "path=" << path;
- QByteArray response = digestMd5ResponseHelper(options.value("algorithm"), user.toLatin1(),
- - realm.toLatin1(), password.toLatin1(),
- + realm, password.toLatin1(),
- nonce, nonceCountString,
- cnonce, qop, method,
- path, QByteArray());
- @@ -639,7 +640,7 @@ QByteArray QAuthenticatorPrivate::digestMd5Response(const QByteArray &challenge,
- QByteArray credentials;
- credentials += "username=\"" + user.toLatin1() + "\", ";
- - credentials += "realm=\"" + realm.toLatin1() + "\", ";
- + credentials += "realm=\"" + realm + "\", ";
- credentials += "nonce=\"" + nonce + "\", ";
- credentials += "uri=\"" + path + "\", ";
- if (!opaque.isEmpty())
- @@ -1128,7 +1129,8 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
- bool unicode = ch.flags & NTLMSSP_NEGOTIATE_UNICODE;
- - ctx->realm = ch.targetNameStr;
- + QString realm = ch.targetNameStr;
- + ctx->options[QLatin1String("realm")] = realm;
- pb.flags = NTLMSSP_NEGOTIATE_NTLM;
- if (unicode)
- @@ -1140,8 +1142,8 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
- int offset = QNtlmPhase3BlockBase::Size;
- Q_ASSERT(QNtlmPhase3BlockBase::Size == sizeof(QNtlmPhase3BlockBase));
- - offset = qEncodeNtlmString(pb.domain, offset, ctx->realm, unicode);
- - pb.domainStr = ctx->realm;
- + offset = qEncodeNtlmString(pb.domain, offset, realm, unicode);
- + pb.domainStr = realm;
- offset = qEncodeNtlmString(pb.user, offset, ctx->user, unicode);
- pb.userStr = ctx->user;
- diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h
- index 36227cc..c9bbfa2 100644
- --- a/src/network/kernel/qauthenticator_p.h
- +++ b/src/network/kernel/qauthenticator_p.h
- @@ -75,7 +75,6 @@ public:
- QVariantHash options;
- QVariantHash outgoingOptions;
- Method method;
- - QString realm;
- QByteArray challenge;
- enum Phase {
- --
- 1.7.0.rc2.29.g363cd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement