summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hartmann <phartmann@blackberry.com>2014-03-07 14:49:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-20 19:01:53 +0100
commitd9f5200fb852ae9dbe89bbc511960bfd51ecd091 (patch)
tree1d90f1ee805e334aa2c6cc87ed402c0f163d43df
parent53f81ac946d69bcd68a02620bf52dc42fcdcc506 (diff)
network: add support for NTLM Session Security
tested manually with internal proxy. Patch-by: Jonathan Lauvernier <Jonathan.Lauvernier@gmail.com> Change-Id: Ief5b4579b3444ce70eb99637edf771d37d3971fb Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
-rw-r--r--src/network/kernel/qauthenticator.cpp11
-rw-r--r--tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp2
2 files changed, 10 insertions, 3 deletions
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index edbbbf5a75..f7b956651f 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -981,7 +981,7 @@ public:
QNtlmPhase1Block() {
qstrncpy(magic, "NTLMSSP", 8);
type = 1;
- flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_REQUEST_TARGET;
+ flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_ALWAYS_SIGN | NTLMSSP_NEGOTIATE_NTLM2;
}
// extracted
@@ -1423,9 +1423,16 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
ds.setByteOrder(QDataStream::LittleEndian);
QNtlmPhase3Block pb;
+ // set NTLMv2
+ if (ch.flags & NTLMSSP_NEGOTIATE_NTLM2)
+ pb.flags |= NTLMSSP_NEGOTIATE_NTLM2;
+
+ // set Always Sign
+ if (ch.flags & NTLMSSP_NEGOTIATE_ALWAYS_SIGN)
+ pb.flags |= NTLMSSP_NEGOTIATE_ALWAYS_SIGN;
+
bool unicode = ch.flags & NTLMSSP_NEGOTIATE_UNICODE;
- pb.flags = NTLMSSP_NEGOTIATE_NTLM;
if (unicode)
pb.flags |= NTLMSSP_NEGOTIATE_UNICODE;
else
diff --git a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp
index 6ba6781913..b61ec0883e 100644
--- a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp
+++ b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp
@@ -146,7 +146,7 @@ void tst_QAuthenticator::ntlmAuth()
if (sso)
QVERIFY(priv->calculateResponse("GET", "/").startsWith("NTLM "));
else
- QCOMPARE(priv->calculateResponse("GET", "/").constData(), "NTLM TlRMTVNTUAABAAAABQIAAAAAAAAAAAAAAAAAAAAAAAA=");
+ QCOMPARE(priv->calculateResponse("GET", "/").constData(), "NTLM TlRMTVNTUAABAAAABYIIAAAAAAAAAAAAAAAAAAAAAAA=");
// NTLM phase 2: challenge
headers.clear();