mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
parent
dde5e430e2
commit
332e8d6164
@ -72,6 +72,7 @@
|
|||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
#include "conncache.h"
|
#include "conncache.h"
|
||||||
#include "multihandle.h"
|
#include "multihandle.h"
|
||||||
|
#include "system_win32.h"
|
||||||
|
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
@ -945,44 +946,15 @@ void Curl_sndbufset(curl_socket_t sockfd)
|
|||||||
int val = CURL_MAX_WRITE_SIZE + 32;
|
int val = CURL_MAX_WRITE_SIZE + 32;
|
||||||
int curval = 0;
|
int curval = 0;
|
||||||
int curlen = sizeof(curval);
|
int curlen = sizeof(curval);
|
||||||
DWORD majorVersion = 6;
|
|
||||||
|
|
||||||
static int detectOsState = DETECT_OS_NONE;
|
static int detectOsState = DETECT_OS_NONE;
|
||||||
|
|
||||||
if(detectOsState == DETECT_OS_NONE) {
|
if(detectOsState == DETECT_OS_NONE)
|
||||||
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \
|
if(Curl_verify_windows_version(6, 0, PLATFORM_WINNT,
|
||||||
(_WIN32_WINNT < _WIN32_WINNT_WIN2K)
|
VERSION_GREATER_THAN_EQUAL))
|
||||||
OSVERSIONINFO osver;
|
|
||||||
|
|
||||||
memset(&osver, 0, sizeof(osver));
|
|
||||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
|
||||||
|
|
||||||
detectOsState = DETECT_OS_PREVISTA;
|
|
||||||
if(GetVersionEx(&osver)) {
|
|
||||||
if(osver.dwMajorVersion >= majorVersion)
|
|
||||||
detectOsState = DETECT_OS_VISTA_OR_LATER;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ULONGLONG cm;
|
|
||||||
OSVERSIONINFOEX osver;
|
|
||||||
|
|
||||||
memset(&osver, 0, sizeof(osver));
|
|
||||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
|
||||||
osver.dwMajorVersion = majorVersion;
|
|
||||||
|
|
||||||
cm = VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_MINORVERSION, VER_GREATER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_SERVICEPACKMINOR, VER_GREATER_EQUAL);
|
|
||||||
|
|
||||||
if(VerifyVersionInfo(&osver, (VER_MAJORVERSION | VER_MINORVERSION |
|
|
||||||
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR),
|
|
||||||
cm))
|
|
||||||
detectOsState = DETECT_OS_VISTA_OR_LATER;
|
detectOsState = DETECT_OS_VISTA_OR_LATER;
|
||||||
else
|
else
|
||||||
detectOsState = DETECT_OS_PREVISTA;
|
detectOsState = DETECT_OS_PREVISTA;
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if(detectOsState == DETECT_OS_VISTA_OR_LATER)
|
if(detectOsState == DETECT_OS_VISTA_OR_LATER)
|
||||||
return;
|
return;
|
||||||
|
@ -67,7 +67,6 @@ PSecurityFunctionTable s_pSecFn = NULL;
|
|||||||
*/
|
*/
|
||||||
CURLcode Curl_sspi_global_init(void)
|
CURLcode Curl_sspi_global_init(void)
|
||||||
{
|
{
|
||||||
bool securityDll = FALSE;
|
|
||||||
INITSECURITYINTERFACE_FN pInitSecurityInterface;
|
INITSECURITYINTERFACE_FN pInitSecurityInterface;
|
||||||
|
|
||||||
/* If security interface is not yet initialized try to do this */
|
/* If security interface is not yet initialized try to do this */
|
||||||
@ -75,49 +74,9 @@ CURLcode Curl_sspi_global_init(void)
|
|||||||
/* Security Service Provider Interface (SSPI) functions are located in
|
/* Security Service Provider Interface (SSPI) functions are located in
|
||||||
* security.dll on WinNT 4.0 and in secur32.dll on Win9x. Win2K and XP
|
* security.dll on WinNT 4.0 and in secur32.dll on Win9x. Win2K and XP
|
||||||
* have both these DLLs (security.dll forwards calls to secur32.dll) */
|
* have both these DLLs (security.dll forwards calls to secur32.dll) */
|
||||||
DWORD majorVersion = 4;
|
|
||||||
DWORD platformId = VER_PLATFORM_WIN32_NT;
|
|
||||||
|
|
||||||
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \
|
|
||||||
(_WIN32_WINNT < _WIN32_WINNT_WIN2K)
|
|
||||||
OSVERSIONINFO osver;
|
|
||||||
|
|
||||||
memset(&osver, 0, sizeof(osver));
|
|
||||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
|
||||||
|
|
||||||
/* Find out Windows version */
|
|
||||||
if(!GetVersionEx(&osver))
|
|
||||||
return CURLE_FAILED_INIT;
|
|
||||||
|
|
||||||
/* Verify the major version number == 4 and platform id == WIN_NT */
|
|
||||||
if(osver.dwMajorVersion == majorVersion &&
|
|
||||||
osver.dwPlatformId == platformId)
|
|
||||||
securityDll = TRUE;
|
|
||||||
#else
|
|
||||||
ULONGLONG cm;
|
|
||||||
OSVERSIONINFOEX osver;
|
|
||||||
|
|
||||||
memset(&osver, 0, sizeof(osver));
|
|
||||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
|
||||||
osver.dwMajorVersion = majorVersion;
|
|
||||||
osver.dwPlatformId = platformId;
|
|
||||||
|
|
||||||
cm = VerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_MINORVERSION, VER_GREATER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_SERVICEPACKMINOR, VER_GREATER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_PLATFORMID, VER_EQUAL);
|
|
||||||
|
|
||||||
/* Verify the major version number == 4 and platform id == WIN_NT */
|
|
||||||
if(VerifyVersionInfo(&osver, (VER_MAJORVERSION | VER_MINORVERSION |
|
|
||||||
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR |
|
|
||||||
VER_PLATFORMID),
|
|
||||||
cm))
|
|
||||||
securityDll = TRUE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Load SSPI dll into the address space of the calling process */
|
/* Load SSPI dll into the address space of the calling process */
|
||||||
if(securityDll)
|
if(Curl_verify_windows_version(4, 0, PLATFORM_WINNT, VERSION_EQUAL))
|
||||||
s_hSecDll = Curl_load_library(TEXT("security.dll"));
|
s_hSecDll = Curl_load_library(TEXT("security.dll"));
|
||||||
else
|
else
|
||||||
s_hSecDll = Curl_load_library(TEXT("secur32.dll"));
|
s_hSecDll = Curl_load_library(TEXT("secur32.dll"));
|
||||||
|
@ -58,8 +58,10 @@
|
|||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
#include "x509asn1.h"
|
#include "x509asn1.h"
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
|
#include "system_win32.h"
|
||||||
|
|
||||||
|
/* The last #include file should be: */
|
||||||
#include "curl_memory.h"
|
#include "curl_memory.h"
|
||||||
/* The last #include file should be: */
|
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
|
|
||||||
/* ALPN requires version 8.1 of the Windows SDK, which was
|
/* ALPN requires version 8.1 of the Windows SDK, which was
|
||||||
@ -1261,39 +1263,8 @@ cleanup:
|
|||||||
*/
|
*/
|
||||||
if(len && !connssl->decdata_offset && connssl->recv_connection_closed &&
|
if(len && !connssl->decdata_offset && connssl->recv_connection_closed &&
|
||||||
!connssl->recv_sspi_close_notify) {
|
!connssl->recv_sspi_close_notify) {
|
||||||
bool isWin2k = FALSE;
|
bool isWin2k = Curl_verify_windows_version(5, 0, PLATFORM_WINNT,
|
||||||
|
VERSION_EQUAL);
|
||||||
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \
|
|
||||||
(_WIN32_WINNT < _WIN32_WINNT_WIN2K)
|
|
||||||
OSVERSIONINFO osver;
|
|
||||||
|
|
||||||
memset(&osver, 0, sizeof(osver));
|
|
||||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
|
||||||
|
|
||||||
/* Find out the Windows version */
|
|
||||||
if(GetVersionEx(&osver)) {
|
|
||||||
/* Verify the version number is 5.0 */
|
|
||||||
if(osver.dwMajorVersion == 5 && osver.dwMinorVersion == 0)
|
|
||||||
isWin2k = TRUE;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ULONGLONG cm;
|
|
||||||
OSVERSIONINFOEX osver;
|
|
||||||
|
|
||||||
memset(&osver, 0, sizeof(osver));
|
|
||||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
|
||||||
osver.dwMajorVersion = 5;
|
|
||||||
|
|
||||||
cm = VerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_MINORVERSION, VER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
|
||||||
cm = VerSetConditionMask(cm, VER_SERVICEPACKMINOR, VER_GREATER_EQUAL);
|
|
||||||
|
|
||||||
if(VerifyVersionInfo(&osver, (VER_MAJORVERSION | VER_MINORVERSION |
|
|
||||||
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR),
|
|
||||||
cm))
|
|
||||||
isWin2k = TRUE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(isWin2k && sspi_status == SEC_E_OK)
|
if(isWin2k && sspi_status == SEC_E_OK)
|
||||||
connssl->recv_sspi_close_notify = true;
|
connssl->recv_sspi_close_notify = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user