Fix NTLM authentication with email address

When using "user@dns-domain" for NTLM authentication, the whole string
should be sent as the username, and the domain should be set to an
empty string.
The domain sent by the server is still reflected if the username
does not contain an '@' character.

Manually tested using MS IIS on a domain-joined PC.

Task-number: QTBUG-19894
Task-number: ou1cimx1#949951
Change-Id: Ie1f81172e71cb7cce7b8c909062be990c24aea47
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
This commit is contained in:
Shane Kearns 2011-12-09 12:06:04 +00:00 committed by Qt by Nokia
parent b830c9cede
commit f74ff46c7a

View File

@ -220,12 +220,6 @@ void QAuthenticator::setUser(const QString &user)
d->userDomain = user.left(separatorPosn);
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.mid(separatorPosn + 1);
d->extractedUser = user.left(separatorPosn);
d->user = user;
} else {
d->extractedUser = user;
d->user = user;
@ -1381,8 +1375,9 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
int offset = QNtlmPhase3BlockBase::Size;
Q_ASSERT(QNtlmPhase3BlockBase::Size == sizeof(QNtlmPhase3BlockBase));
if(ctx->userDomain.isEmpty()) {
// for kerberos style user@domain logins, NTLM domain string should be left empty
if (ctx->userDomain.isEmpty() && !ctx->extractedUser.contains(QLatin1Char('@'))) {
offset = qEncodeNtlmString(pb.domain, offset, ch.targetNameStr, unicode);
pb.domainStr = ch.targetNameStr;
} else {