diff options
author | Janne Anttila <janne.anttila@digia.com> | 2012-05-24 15:51:48 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-01 15:19:10 +0200 |
commit | 6ddd8f6bd9beec1e408ed5dff5d8cb988f0fbd40 (patch) | |
tree | 1133030b65744acc21f9cbdca70199e1ad48ddeb /src/network | |
parent | 79194978cdb8770a06648a85eddbefe9acad7b77 (diff) |
Put Windows NTLM stuff inside consistent preprocessor directives.
QNtlmWindowsHandles was placed inside Q_OS_WIN in some places and in
other places inside Q_OS_WIN32. It seems that Q_OS_WIN is correct
define everywhere.
In addition placed "InitSecurityInterfaceW" inside L macro to convert
argument to wide characters in WinCE. WinCE GetProcAddress takes
LPCWSTR instead of LPCSTR.
This fixes the QtNetwork build for WEC7, where Q_OS_WIN32 apparently
is not defined. Should it be defined, is another story...
Change-Id: Id309d20c46b66139e2cb2e62349067848d8ebb4e
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/kernel/qauthenticator.cpp | 24 | ||||
-rw-r--r-- | src/network/kernel/qauthenticator_p.h | 2 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 9d3159407a..b52e5c0da9 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -51,7 +51,7 @@ #include <qstring.h> #include <qdatetime.h> -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN #include <qmutex.h> #include <private/qmutexpool_p.h> #include <rpc.h> @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE static QByteArray qNtlmPhase1(); static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phase2data); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN static QByteArray qNtlmPhase1_SSPI(QAuthenticatorPrivate *ctx); static QByteArray qNtlmPhase3_SSPI(QAuthenticatorPrivate *ctx, const QByteArray& phase2data); #endif @@ -327,7 +327,7 @@ bool QAuthenticator::isNull() const return !d; } -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN class QNtlmWindowsHandles { public: @@ -353,7 +353,7 @@ QAuthenticatorPrivate::QAuthenticatorPrivate() QAuthenticatorPrivate::~QAuthenticatorPrivate() { -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN if (ntlmWindowsHandles) delete ntlmWindowsHandles; #endif @@ -484,7 +484,7 @@ QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMet case QAuthenticatorPrivate::Ntlm: methodString = "NTLM "; if (challenge.isEmpty()) { -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN QByteArray phase1Token; if (user.isEmpty()) // Only pull from system if no user was specified in authenticator phase1Token = qNtlmPhase1_SSPI(this); @@ -501,7 +501,7 @@ QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMet phase = Phase2; } } else { -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN QByteArray phase3Token; if (ntlmWindowsHandles) phase3Token = qNtlmPhase3_SSPI(this, QByteArray::fromBase64(challenge)); @@ -1475,7 +1475,7 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas return rc; } -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN // See http://davenport.sourceforge.net/ntlm.html // and libcurl http_ntlm.c @@ -1493,9 +1493,15 @@ static bool q_NTLM_SSPI_library_load() if (pSecurityFunctionTable == NULL) { securityDLLHandle = LoadLibrary(L"secur32.dll"); if (securityDLLHandle != NULL) { +#if defined(Q_OS_WINCE) + INIT_SECURITY_INTERFACE pInitSecurityInterface = + (INIT_SECURITY_INTERFACE)GetProcAddress(securityDLLHandle, + L"InitSecurityInterfaceW"); +#else INIT_SECURITY_INTERFACE pInitSecurityInterface = (INIT_SECURITY_INTERFACE)GetProcAddress(securityDLLHandle, "InitSecurityInterfaceW"); +#endif if (pInitSecurityInterface != NULL) pSecurityFunctionTable = pInitSecurityInterface(); } @@ -1507,7 +1513,7 @@ static bool q_NTLM_SSPI_library_load() return true; } - +#ifdef Q_OS_WIN // Phase 1: static QByteArray qNtlmPhase1_SSPI(QAuthenticatorPrivate *ctx) { @@ -1631,6 +1637,8 @@ static QByteArray qNtlmPhase3_SSPI(QAuthenticatorPrivate *ctx, const QByteArray& return result; } +#endif // Q_OS_WIN + #endif QT_END_NAMESPACE diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h index 491e004737..f4736de3e7 100644 --- a/src/network/kernel/qauthenticator_p.h +++ b/src/network/kernel/qauthenticator_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QHttpResponseHeader; -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN class QNtlmWindowsHandles; #endif |