diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-08-11 20:29:36 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-08-11 20:29:36 +0000 |
commit | f8a3aa91cd87a84ea1b5a0a643571bafda3968c8 (patch) | |
tree | d6d35119c2a085af6b1afa9e84438bb70eec4206 /lib/easy.c | |
parent | 019bde82ce8fd9d0a335edb30441088a96906d1b (diff) |
- Constantine Sapuntzakis filed bug report #2042430
(http://curl.haxx.se/bug/view.cgi?id=2042430) with a patch. "NTLM Windows
SSPI code is not thread safe". This was due to libcurl using static
variables to tell wether to load the necessary SSPI DLL, but now the loading
has been moved to the more suitable curl_global_init() call.
Diffstat (limited to 'lib/easy.c')
-rw-r--r-- | lib/easy.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/easy.c b/lib/easy.c index 216dfe7bf..9d9e948ce 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -83,6 +83,7 @@ #include "easyif.h" #include "select.h" #include "sendf.h" /* for failf function prototype */ +#include "http_ntlm.h" #include "connect.h" /* for Curl_getconnectinfo */ #define _MPRINTF_REPLACE /* use our functions only */ @@ -103,18 +104,23 @@ /* The last #include file should be: */ #include "memdebug.h" -#ifdef USE_WINSOCK /* win32_cleanup() is for win32 socket cleanup functionality, the opposite of win32_init() */ static void win32_cleanup(void) { +#ifdef USE_WINSOCK WSACleanup(); +#endif +#ifdef USE_WINDOWS_SSPI + Curl_ntlm_global_cleanup(); +#endif } /* win32_init() performs win32 socket initialization to properly setup the stack to allow networking */ static CURLcode win32_init(void) { +#ifdef USE_WINSOCK WORD wVersionRequested; WSADATA wsaData; int err; @@ -147,15 +153,19 @@ static CURLcode win32_init(void) return CURLE_FAILED_INIT; } /* The Windows Sockets DLL is acceptable. Proceed. */ - return CURLE_OK; -} +#endif -#else -/* These functions exist merely to prevent compiler warnings */ -static CURLcode win32_init(void) { return CURLE_OK; } -static void win32_cleanup(void) { } +#ifdef USE_WINDOWS_SSPI + { + CURLcode err = Curl_ntlm_global_init(); + if (err != CURLE_OK) + return err; + } #endif + return CURLE_OK; +} + #ifdef USE_LIBIDN /* * Initialise use of IDNA library. |