From c5a1a8ac27891745c0548b65aebadbdd103f1212 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 5 Jun 2014 22:10:08 -0400 Subject: [PATCH] libwinpr-sspi: fix native sspi build --- winpr/include/winpr/crypto.h | 18 ++++++++++++++++-- winpr/include/winpr/sspi.h | 14 +------------- winpr/include/winpr/timezone.h | 2 +- winpr/libwinpr/sspi/CMakeLists.txt | 14 ++++++-------- winpr/libwinpr/sspi/CredSSP/credssp.c | 2 +- winpr/libwinpr/sspi/NTLM/ntlm.c | 4 ++-- winpr/libwinpr/sspi/NTLM/ntlm.h | 2 ++ winpr/libwinpr/sspi/NTLM/ntlm_av_pairs.c | 2 +- winpr/libwinpr/sspi/NTLM/ntlm_compute.c | 2 +- winpr/libwinpr/sspi/NTLM/ntlm_message.c | 2 +- winpr/libwinpr/sspi/Negotiate/negotiate.c | 2 +- winpr/libwinpr/sspi/Schannel/schannel.c | 2 +- winpr/libwinpr/sspi/Schannel/schannel_openssl.c | 12 ++++++------ winpr/libwinpr/sspi/sspi.c | 2 +- winpr/libwinpr/timezone/timezone.c | 2 +- winpr/libwinpr/utils/wlog/wlog.c | 2 +- 16 files changed, 43 insertions(+), 41 deletions(-) diff --git a/winpr/include/winpr/crypto.h b/winpr/include/winpr/crypto.h index 7548886..128a156 100644 --- a/winpr/include/winpr/crypto.h +++ b/winpr/include/winpr/crypto.h @@ -29,7 +29,22 @@ #include -#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) diff --git a/winpr/include/winpr/sspi.h b/winpr/include/winpr/sspi.h index 817a134..b576dc8 100644 --- a/winpr/include/winpr/sspi.h +++ b/winpr/include/winpr/sspi.h @@ -2,7 +2,7 @@ * WinPR: Windows Portable Runtime * Security Support Provider Interface (SSPI) * - * Copyright 2012 Marc-Andre Moreau + * Copyright 2012-2014 Marc-Andre Moreau * * 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 - -#include #include #include #include @@ -35,18 +32,9 @@ #include #include -#ifdef WITH_NATIVE_SSPI #define SECURITY_WIN32 #include #include -#else -#define WINPR_SSPI -#define SEC_ENTRY __stdcall -#endif - -#else - -#define WINPR_SSPI #endif diff --git a/winpr/include/winpr/timezone.h b/winpr/include/winpr/timezone.h index fac889c..e773751 100644 --- a/winpr/include/winpr/timezone.h +++ b/winpr/include/winpr/timezone.h @@ -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); diff --git a/winpr/libwinpr/sspi/CMakeLists.txt b/winpr/libwinpr/sspi/CMakeLists.txt index 95bbcec..d7b8f7b 100644 --- a/winpr/libwinpr/sspi/CMakeLists.txt +++ b/winpr/libwinpr/sspi/CMakeLists.txt @@ -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) diff --git a/winpr/libwinpr/sspi/CredSSP/credssp.c b/winpr/libwinpr/sspi/CredSSP/credssp.c index c0cceea..769e119 100644 --- a/winpr/libwinpr/sspi/CredSSP/credssp.c +++ b/winpr/libwinpr/sspi/CredSSP/credssp.c @@ -2,7 +2,7 @@ * WinPR: Windows Portable Runtime * Credential Security Support Provider (CredSSP) * - * Copyright 2010-2012 Marc-Andre Moreau + * Copyright 2010-2014 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/winpr/libwinpr/sspi/NTLM/ntlm.c b/winpr/libwinpr/sspi/NTLM/ntlm.c index 13f36bc..75276cd 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm.c +++ b/winpr/libwinpr/sspi/NTLM/ntlm.c @@ -2,7 +2,7 @@ * WinPR: Windows Portable Runtime * NTLM Security Package * - * Copyright 2011-2012 Marc-Andre Moreau + * Copyright 2011-2014 Marc-Andre Moreau * * 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++) { diff --git a/winpr/libwinpr/sspi/NTLM/ntlm.h b/winpr/libwinpr/sspi/NTLM/ntlm.h index 99e7bde..3985380 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm.h +++ b/winpr/libwinpr/sspi/NTLM/ntlm.h @@ -23,6 +23,8 @@ #include #include +#include + #include #include #include diff --git a/winpr/libwinpr/sspi/NTLM/ntlm_av_pairs.c b/winpr/libwinpr/sspi/NTLM/ntlm_av_pairs.c index a9dbf98..bd44dca 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm_av_pairs.c +++ b/winpr/libwinpr/sspi/NTLM/ntlm_av_pairs.c @@ -2,7 +2,7 @@ * WinPR: Windows Portable Runtime * NTLM Security Package (AV_PAIRs) * - * Copyright 2011-2012 Marc-Andre Moreau + * Copyright 2011-2014 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/winpr/libwinpr/sspi/NTLM/ntlm_compute.c b/winpr/libwinpr/sspi/NTLM/ntlm_compute.c index fb77c8c..751b270 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm_compute.c +++ b/winpr/libwinpr/sspi/NTLM/ntlm_compute.c @@ -2,7 +2,7 @@ * WinPR: Windows Portable Runtime * NTLM Security Package (Compute) * - * Copyright 2011-2012 Marc-Andre Moreau + * Copyright 2011-2014 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/winpr/libwinpr/sspi/NTLM/ntlm_message.c b/winpr/libwinpr/sspi/NTLM/ntlm_message.c index e1b733a..3629d8e 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm_message.c +++ b/winpr/libwinpr/sspi/NTLM/ntlm_message.c @@ -2,7 +2,7 @@ * WinPR: Windows Portable Runtime * NTLM Security Package (Message) * - * Copyright 2011-2012 Marc-Andre Moreau + * Copyright 2011-2014 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/winpr/libwinpr/sspi/Negotiate/negotiate.c b/winpr/libwinpr/sspi/Negotiate/negotiate.c index dab8599..d8af18b 100644 --- a/winpr/libwinpr/sspi/Negotiate/negotiate.c +++ b/winpr/libwinpr/sspi/Negotiate/negotiate.c @@ -2,7 +2,7 @@ * WinPR: Windows Portable Runtime * Negotiate Security Package * - * Copyright 2011-2012 Jiten Pathy + * Copyright 2011-2014 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/winpr/libwinpr/sspi/Schannel/schannel.c b/winpr/libwinpr/sspi/Schannel/schannel.c index d53f105..3410cc4 100644 --- a/winpr/libwinpr/sspi/Schannel/schannel.c +++ b/winpr/libwinpr/sspi/Schannel/schannel.c @@ -2,7 +2,7 @@ * WinPR: Windows Portable Runtime * Schannel Security Package * - * Copyright 2012 Marc-Andre Moreau + * Copyright 2012-2014 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/winpr/libwinpr/sspi/Schannel/schannel_openssl.c b/winpr/libwinpr/sspi/Schannel/schannel_openssl.c index cdee13a..5ad6e60 100644 --- a/winpr/libwinpr/sspi/Schannel/schannel_openssl.c +++ b/winpr/libwinpr/sspi/Schannel/schannel_openssl.c @@ -2,7 +2,7 @@ * WinPR: Windows Portable Runtime * Schannel Security Package (OpenSSL) * - * Copyright 2012 Marc-Andre Moreau + * Copyright 2012-2014 Marc-Andre Moreau * * 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; } diff --git a/winpr/libwinpr/sspi/sspi.c b/winpr/libwinpr/sspi/sspi.c index f9ec6a7..564df88 100644 --- a/winpr/libwinpr/sspi/sspi.c +++ b/winpr/libwinpr/sspi/sspi.c @@ -2,7 +2,7 @@ * FreeRDP: A Remote Desktop Protocol Implementation * Security Support Provider Interface (SSPI) * - * Copyright 2012 Marc-Andre Moreau + * Copyright 2012-2014 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/winpr/libwinpr/timezone/timezone.c b/winpr/libwinpr/timezone/timezone.c index 56db6b6..40c7bbc 100644 --- a/winpr/libwinpr/timezone/timezone.c +++ b/winpr/libwinpr/timezone/timezone.c @@ -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) { diff --git a/winpr/libwinpr/utils/wlog/wlog.c b/winpr/libwinpr/utils/wlog/wlog.c index 36e326a..366292d 100644 --- a/winpr/libwinpr/utils/wlog/wlog.c +++ b/winpr/libwinpr/utils/wlog/wlog.c @@ -319,7 +319,7 @@ int WLog_ParseFilters() { char* p; char* env; - int count; + DWORD count; DWORD nSize; int status; char** strs; -- 2.7.4