summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qauthenticator.cpp
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-11-09 01:23:37 (GMT)
committerLorn Potter <lorn.potter@nokia.com>2010-11-09 01:23:37 (GMT)
commit6b8a95b2521d843ec2b3f7c787c15b92e4ea686f (patch)
tree346bc8925d83b2729f485d1259729fca931de07d /src/network/kernel/qauthenticator.cpp
parentbb8f085611f4cb91b7bde7220d407948edcc572c (diff)
parente00af84cc9230df411981d2f3b9296b61d5d1c50 (diff)
downloadQt-6b8a95b2521d843ec2b3f7c787c15b92e4ea686f.zip
Qt-6b8a95b2521d843ec2b3f7c787c15b92e4ea686f.tar.gz
Qt-6b8a95b2521d843ec2b3f7c787c15b92e4ea686f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/network/kernel/qauthenticator.cpp')
-rw-r--r--src/network/kernel/qauthenticator.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index f97d833..73f6b94 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -164,9 +164,13 @@ QAuthenticator &QAuthenticator::operator=(const QAuthenticator &other)
{
if (d == other.d)
return *this;
- detach();
- d->user = other.d->user;
- d->password = other.d->password;
+
+ if (d && !d->ref.deref())
+ delete d;
+
+ d = other.d;
+ if (d)
+ d->ref.ref();
return *this;
}
@@ -232,19 +236,21 @@ void QAuthenticator::setUser(const QString &user)
//domain name is present
d->realm.clear();
d->userDomain = user.left(separatorPosn);
- d->user = user.mid(separatorPosn + 1);
+ d->extractedUser = user.mid(separatorPosn + 1);
+ d->user = user;
} else if((separatorPosn = user.indexOf(QLatin1String("@"))) != -1) {
//domain name is present
d->realm.clear();
d->userDomain = user.left(separatorPosn);
- d->user = user.left(separatorPosn);
+ d->extractedUser = user.left(separatorPosn);
+ d->user = user;
} else {
+ d->extractedUser = user;
d->user = user;
d->realm.clear();
d->userDomain.clear();
}
break;
- // For other auth mechanisms, domain name will be part of username
default:
d->user = user;
break;
@@ -1196,7 +1202,7 @@ static QByteArray qCreatev2Hash(const QAuthenticatorPrivate *ctx,
Q_ASSERT(hashKey.size() == 16);
// Assuming the user and domain is always unicode in challenge
QByteArray message =
- qStringAsUcs2Le(ctx->user.toUpper()) +
+ qStringAsUcs2Le(ctx->extractedUser.toUpper()) +
qStringAsUcs2Le(phase3->domainStr);
phase3->v2Hash = qEncodeHmacMd5(hashKey, message);
@@ -1401,8 +1407,8 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
pb.domainStr = ctx->userDomain;
}
- offset = qEncodeNtlmString(pb.user, offset, ctx->user, unicode);
- pb.userStr = ctx->user;
+ offset = qEncodeNtlmString(pb.user, offset, ctx->extractedUser, unicode);
+ pb.userStr = ctx->extractedUser;
offset = qEncodeNtlmString(pb.workstation, offset, ctx->workstation, unicode);
pb.workstationStr = ctx->workstation;