summaryrefslogtreecommitdiff
path: root/lib/curl_sspi.c
diff options
context:
space:
mode:
authorMark Salisbury <mark.salisbury@hp.com>2012-06-15 18:05:11 +0200
committerYang Tse <yangsita@gmail.com>2012-06-15 18:41:49 +0200
commit46480bb9a1569eaf156012f33e3e7e8c3de18f87 (patch)
tree28c6ee9e5b39119260f0691ecb765e771f7fed72 /lib/curl_sspi.c
parent16c725dbc77b408d5b3c2b2d213063f7c2398c06 (diff)
downloadcurl-46480bb9a1569eaf156012f33e3e7e8c3de18f87.tar.gz
SSPI related code: Unicode support for WinCE
SSPI related code now compiles with ANSI and WCHAR versions of security methods (WinCE requires WCHAR versions of methods). Pulled UTF8 to WCHAR conversion methods out of idn_win32.c into their own file. curl_sasl.c - include curl_memory.h to use correct memory functions. getenv.c and telnet.c - WinCE compatibility fix With some committer adjustments
Diffstat (limited to 'lib/curl_sspi.c')
-rw-r--r--lib/curl_sspi.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/curl_sspi.c b/lib/curl_sspi.c
index cb83809b3..c3c41ec2f 100644
--- a/lib/curl_sspi.c
+++ b/lib/curl_sspi.c
@@ -36,13 +36,24 @@
#include "memdebug.h"
/* We use our own typedef here since some headers might lack these */
-typedef PSecurityFunctionTableA (APIENTRY *INITSECURITYINTERFACE_FN_A)(VOID);
+typedef PSecurityFunctionTable (APIENTRY *INITSECURITYINTERFACE_FN)(VOID);
+
+/* See definition of SECURITY_ENTRYPOINT in sspi.h */
+#ifdef UNICODE
+# ifdef _WIN32_WCE
+# define SECURITYENTRYPOINT L"InitSecurityInterfaceW"
+# else
+# define SECURITYENTRYPOINT "InitSecurityInterfaceW"
+# endif
+#else
+# define SECURITYENTRYPOINT "InitSecurityInterfaceA"
+#endif
/* Handle of security.dll or secur32.dll, depending on Windows version */
HMODULE s_hSecDll = NULL;
/* Pointer to SSPI dispatch table */
-PSecurityFunctionTableA s_pSecFn = NULL;
+PSecurityFunctionTable s_pSecFn = NULL;
/*
* Curl_sspi_global_init()
@@ -58,7 +69,7 @@ PSecurityFunctionTableA s_pSecFn = NULL;
CURLcode Curl_sspi_global_init(void)
{
OSVERSIONINFO osver;
- INITSECURITYINTERFACE_FN_A pInitSecurityInterface;
+ INITSECURITYINTERFACE_FN pInitSecurityInterface;
/* If security interface is not yet initialized try to do this */
if(!s_hSecDll) {
@@ -76,15 +87,15 @@ CURLcode Curl_sspi_global_init(void)
/* Load SSPI dll into the address space of the calling process */
if(osver.dwPlatformId == VER_PLATFORM_WIN32_NT
&& osver.dwMajorVersion == 4)
- s_hSecDll = LoadLibrary("security.dll");
+ s_hSecDll = LoadLibrary(TEXT("security.dll"));
else
- s_hSecDll = LoadLibrary("secur32.dll");
+ s_hSecDll = LoadLibrary(TEXT("secur32.dll"));
if(!s_hSecDll)
return CURLE_FAILED_INIT;
/* Get address of the InitSecurityInterfaceA function from the SSPI dll */
- pInitSecurityInterface = (INITSECURITYINTERFACE_FN_A)
- GetProcAddress(s_hSecDll, "InitSecurityInterfaceA");
+ pInitSecurityInterface = (INITSECURITYINTERFACE_FN)
+ GetProcAddress(s_hSecDll, SECURITYENTRYPOINT);
if(!pInitSecurityInterface)
return CURLE_FAILED_INIT;