libwinpr-sspi: fix native sspi build
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 6 Jun 2014 02:10:08 +0000 (22:10 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 6 Jun 2014 02:10:08 +0000 (22:10 -0400)
16 files changed:
winpr/include/winpr/crypto.h
winpr/include/winpr/sspi.h
winpr/include/winpr/timezone.h
winpr/libwinpr/sspi/CMakeLists.txt
winpr/libwinpr/sspi/CredSSP/credssp.c
winpr/libwinpr/sspi/NTLM/ntlm.c
winpr/libwinpr/sspi/NTLM/ntlm.h
winpr/libwinpr/sspi/NTLM/ntlm_av_pairs.c
winpr/libwinpr/sspi/NTLM/ntlm_compute.c
winpr/libwinpr/sspi/NTLM/ntlm_message.c
winpr/libwinpr/sspi/Negotiate/negotiate.c
winpr/libwinpr/sspi/Schannel/schannel.c
winpr/libwinpr/sspi/Schannel/schannel_openssl.c
winpr/libwinpr/sspi/sspi.c
winpr/libwinpr/timezone/timezone.c
winpr/libwinpr/utils/wlog/wlog.c

index 7548886..128a156 100644 (file)
 
 #include <wincrypt.h>
 
-#else
+#endif
+
+#ifndef ALG_TYPE_RESERVED7
+#define ALG_TYPE_RESERVED7             (7 << 9)
+#endif
+
+#if (NTDDI_VERSION <= 0x05010200)
+#define ALG_SID_SHA_256                        12
+#define ALG_SID_SHA_384                        13
+#define ALG_SID_SHA_512                        14
+#define CALG_SHA_256                   (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256)
+#define CALG_SHA_384                   (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_384)
+#define CALG_SHA_512                   (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_512)
+#endif
+
+#ifndef _WIN32
 
 /* ncrypt.h */
 
@@ -60,7 +75,6 @@ typedef ULONG_PTR NCRYPT_SECRET_HANDLE;
 #define ALG_TYPE_STREAM                        (4 << 9)
 #define ALG_TYPE_DH                    (5 << 9)
 #define ALG_TYPE_SECURECHANNEL         (6 << 9)
-#define ALG_TYPE_RESERVED7             (7 << 9)
 
 #define ALG_SID_ANY                    (0)
 
index 817a134..b576dc8 100644 (file)
@@ -2,7 +2,7 @@
  * WinPR: Windows Portable Runtime
  * Security Support Provider Interface (SSPI)
  *
- * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ * Copyright 2012-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,9 +20,6 @@
 #ifndef WINPR_SSPI_H
 #define WINPR_SSPI_H
 
-#include <winpr/config.h>
-
-#include <wchar.h>
 #include <winpr/winpr.h>
 #include <winpr/wtypes.h>
 #include <winpr/windows.h>
 #include <tchar.h>
 #include <winerror.h>
 
-#ifdef WITH_NATIVE_SSPI
 #define SECURITY_WIN32
 #include <sspi.h>
 #include <security.h>
-#else
-#define WINPR_SSPI
-#define SEC_ENTRY __stdcall
-#endif
-
-#else
-
-#define WINPR_SSPI
 
 #endif
 
index fac889c..e773751 100644 (file)
@@ -62,7 +62,7 @@ WINPR_API BOOL TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZon
 
 #endif
 
-#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600)) /* Windows Vista */
+#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0501)) /* Windows Vista */
 
 WINPR_API DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation);
 WINPR_API BOOL SetDynamicTimeZoneInformation(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation);
index 95bbcec..d7b8f7b 100644 (file)
@@ -46,14 +46,12 @@ set(${MODULE_PREFIX}_SRCS
        sspi.c
        sspi.h)
 
-if(NOT WITH_NATIVE_SSPI)
-       set(${MODULE_PREFIX}_SRCS
-               ${${MODULE_PREFIX}_NTLM_SRCS}
-               ${${MODULE_PREFIX}_KERBEROS_SRCS}
-               ${${MODULE_PREFIX}_NEGOTIATE_SRCS}
-               ${${MODULE_PREFIX}_SCHANNEL_SRCS}
-               ${${MODULE_PREFIX}_SRCS})
-endif()
+set(${MODULE_PREFIX}_SRCS
+       ${${MODULE_PREFIX}_NTLM_SRCS}
+       ${${MODULE_PREFIX}_KERBEROS_SRCS}
+       ${${MODULE_PREFIX}_NEGOTIATE_SRCS}
+       ${${MODULE_PREFIX}_SCHANNEL_SRCS}
+       ${${MODULE_PREFIX}_SRCS})
 
 if(MSVC AND (NOT MONOLITHIC_BUILD))
        set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
index c0cceea..769e119 100644 (file)
@@ -2,7 +2,7 @@
  * WinPR: Windows Portable Runtime
  * Credential Security Support Provider (CredSSP)
  *
- * Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ * Copyright 2010-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 13f36bc..75276cd 100644 (file)
@@ -2,7 +2,7 @@
  * WinPR: Windows Portable Runtime
  * NTLM Security Package
  *
- * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ * Copyright 2011-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -414,7 +414,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_AcceptSecurityContext(PCredHandle phCredential, P
 
                if (pOutput)
                {
-                       int i;
+                       unsigned long i;
 
                        for (i = 0; i < pOutput->cBuffers; i++)
                        {
index 99e7bde..3985380 100644 (file)
@@ -23,6 +23,8 @@
 #include <winpr/sspi.h>
 #include <winpr/windows.h>
 
+#include <winpr/nt.h>
+
 #include <time.h>
 #include <openssl/des.h>
 #include <openssl/md4.h>
index a9dbf98..bd44dca 100644 (file)
@@ -2,7 +2,7 @@
  * WinPR: Windows Portable Runtime
  * NTLM Security Package (AV_PAIRs)
  *
- * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ * Copyright 2011-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index fb77c8c..751b270 100644 (file)
@@ -2,7 +2,7 @@
  * WinPR: Windows Portable Runtime
  * NTLM Security Package (Compute)
  *
- * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ * Copyright 2011-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index e1b733a..3629d8e 100644 (file)
@@ -2,7 +2,7 @@
  * WinPR: Windows Portable Runtime
  * NTLM Security Package (Message)
  *
- * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ * Copyright 2011-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index dab8599..d8af18b 100644 (file)
@@ -2,7 +2,7 @@
  * WinPR: Windows Portable Runtime
  * Negotiate Security Package
  *
- * Copyright 2011-2012 Jiten Pathy 
+ * Copyright 2011-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index d53f105..3410cc4 100644 (file)
@@ -2,7 +2,7 @@
  * WinPR: Windows Portable Runtime
  * Schannel Security Package
  *
- * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ * Copyright 2012-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index cdee13a..5ad6e60 100644 (file)
@@ -2,7 +2,7 @@
  * WinPR: Windows Portable Runtime
  * Schannel Security Package (OpenSSL)
  *
- * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ * Copyright 2012-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -280,7 +280,7 @@ SECURITY_STATUS schannel_openssl_client_process_tokens(SCHANNEL_OPENSSL* context
 
                if (status > 0)
                {
-                       if (pBuffer->cbBuffer < status)
+                       if (pBuffer->cbBuffer < (unsigned long) status)
                                return SEC_E_INSUFFICIENT_MEMORY;
 
                        CopyMemory(pBuffer->pvBuffer, context->ReadBuffer, status);
@@ -339,7 +339,7 @@ SECURITY_STATUS schannel_openssl_server_process_tokens(SCHANNEL_OPENSSL* context
 
                if (status > 0)
                {
-                       if (pBuffer->cbBuffer < status)
+                       if (pBuffer->cbBuffer < (unsigned long) status)
                                return SEC_E_INSUFFICIENT_MEMORY;
 
                        CopyMemory(pBuffer->pvBuffer, context->ReadBuffer, status);
@@ -387,17 +387,17 @@ SECURITY_STATUS schannel_openssl_encrypt_message(SCHANNEL_OPENSSL* context, PSec
        if (status > 0)
        {
                offset = 0;
-               length = (pStreamHeaderBuffer->cbBuffer > status) ? status : pStreamHeaderBuffer->cbBuffer;
+               length = (pStreamHeaderBuffer->cbBuffer > (unsigned long) status) ? status : pStreamHeaderBuffer->cbBuffer;
                CopyMemory(pStreamHeaderBuffer->pvBuffer, &context->ReadBuffer[offset], length);
                status -= length;
 
                offset += length;
-               length = (pStreamBodyBuffer->cbBuffer > status) ? status : pStreamBodyBuffer->cbBuffer;
+               length = (pStreamBodyBuffer->cbBuffer > (unsigned long) status) ? status : pStreamBodyBuffer->cbBuffer;
                CopyMemory(pStreamBodyBuffer->pvBuffer, &context->ReadBuffer[offset], length);
                status -= length;
 
                offset += length;
-               length = (pStreamTrailerBuffer->cbBuffer > status) ? status : pStreamTrailerBuffer->cbBuffer;
+               length = (pStreamTrailerBuffer->cbBuffer > (unsigned long) status) ? status : pStreamTrailerBuffer->cbBuffer;
                CopyMemory(pStreamTrailerBuffer->pvBuffer, &context->ReadBuffer[offset], length);
                status -= length;
        }
index f9ec6a7..564df88 100644 (file)
@@ -2,7 +2,7 @@
  * FreeRDP: A Remote Desktop Protocol Implementation
  * Security Support Provider Interface (SSPI)
  *
- * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ * Copyright 2012-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 56db6b6..40c7bbc 100644 (file)
@@ -59,7 +59,7 @@ BOOL TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformati
 
 #endif
 
-#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600)) /* Windows Vista */
+#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0501)) /* Windows Vista */
 
 DWORD GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation)
 {
index 36e326a..366292d 100644 (file)
@@ -319,7 +319,7 @@ int WLog_ParseFilters()
 {
        char* p;
        char* env;
-       int count;
+       DWORD count;
        DWORD nSize;
        int status;
        char** strs;