diff options
author | Yang Tse <yangsita@gmail.com> | 2009-01-29 20:32:27 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-01-29 20:32:27 +0000 |
commit | e813bf31d7b4ea4b39e227a66fec068f5fcd1a50 (patch) | |
tree | ac39d05380b17ae07b032105c1b7f53a256af05c /lib/http_ntlm.c | |
parent | 1bd0be0361f8ccf183ebd9682d848e6902e5dfc0 (diff) |
Introduced curl_sspi.c and curl_sspi.h for the implementation of functions
Curl_sspi_global_init() and Curl_sspi_global_cleanup() which previously were
named Curl_ntlm_global_init() and Curl_ntlm_global_cleanup() in http_ntlm.c
Also adjusted socks_sspi.c to remove the link-time dependency on the Windows
SSPI library using it now in the same way as it was done in http_ntlm.c.
Diffstat (limited to 'lib/http_ntlm.c')
-rw-r--r-- | lib/http_ntlm.c | 53 |
1 files changed, 3 insertions, 50 deletions
diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c index 869a247a0..d89cd0e0d 100644 --- a/lib/http_ntlm.c +++ b/lib/http_ntlm.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -106,12 +106,7 @@ #else -#include <rpc.h> - -/* Handle of security.dll or secur32.dll, depending on Windows version */ -static HMODULE s_hSecDll = NULL; -/* Pointer to SSPI dispatch table */ -static PSecurityFunctionTable s_pSecFn = NULL; +#include "curl_sspi.h" #endif @@ -552,7 +547,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, #ifdef USE_WINDOWS_SSPI if (s_hSecDll == NULL) { /* not thread safe and leaks - use curl_global_init() to avoid */ - CURLcode err = Curl_ntlm_global_init(); + CURLcode err = Curl_sspi_global_init(); if (s_hSecDll == NULL) return err; } @@ -1103,48 +1098,6 @@ Curl_ntlm_cleanup(struct connectdata *conn) #endif } -#ifdef USE_WINDOWS_SSPI -CURLcode Curl_ntlm_global_init(void) -{ - /* If security interface is not yet initialized try to do this */ - if(s_hSecDll == NULL) { - /* Determine Windows version. Security functions are located in - * security.dll on WinNT 4.0 and in secur32.dll on Win9x. Win2K and XP - * contain both these DLLs (security.dll just forwards calls to - * secur32.dll) - */ - OSVERSIONINFO osver; - osver.dwOSVersionInfoSize = sizeof(osver); - GetVersionEx(&osver); - if(osver.dwPlatformId == VER_PLATFORM_WIN32_NT - && osver.dwMajorVersion == 4) - s_hSecDll = LoadLibrary("security.dll"); - else - s_hSecDll = LoadLibrary("secur32.dll"); - if(s_hSecDll != NULL) { - INIT_SECURITY_INTERFACE pInitSecurityInterface; - pInitSecurityInterface = - (INIT_SECURITY_INTERFACE)GetProcAddress(s_hSecDll, - "InitSecurityInterfaceA"); - if(pInitSecurityInterface != NULL) - s_pSecFn = pInitSecurityInterface(); - } - } - if(s_pSecFn == NULL) - return CURLE_RECV_ERROR; - - return CURLE_OK; -} - -void Curl_ntlm_global_cleanup(void) -{ - if(s_hSecDll != NULL) { - FreeLibrary(s_hSecDll); - s_hSecDll = NULL; - s_pSecFn = NULL; - } -} -#endif #endif /* USE_NTLM */ #endif /* !CURL_DISABLE_HTTP */ |