From 7047e2ed725d24f7fe4ce7c566ef0a9342e3be9c Mon Sep 17 00:00:00 2001 From: Marc Hoersken Date: Sun, 15 Apr 2012 04:12:26 +0200 Subject: schannel: Code cleanup and bug fixes curl_sspi.c: Fixed mingw32-gcc compiler warnings curl_sspi.c: Fixed length of error code hex output The hex value was printed as signed 64-bit value on 64-bit systems: SEC_E_WRONG_PRINCIPAL (0xFFFFFFFF80090322) It is now correctly printed as the following: SEC_E_WRONG_PRINCIPAL (0x80090322) curl_sspi.c: Fallback to security function table version number Instead of reporting an unknown version, the interface version is used. curl_sspi.c: Removed SSPI/ version prefix from Curl_sspi_version curl_schannel: Replaced static buffer sizes with defined names curl_schannel.c: First brace when declaring functions on column 0 curl_schannel.c: Put the pointer sign directly at variable name curl_schannel.c: Use structs directly instead of typedef'ed structs curl_schannel.c: Removed space before opening brace curl_schannel.c: Fixed lines being longer than 80 chars --- lib/curl_sspi.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/curl_sspi.c') diff --git a/lib/curl_sspi.c b/lib/curl_sspi.c index d3533a293..29f8a436d 100644 --- a/lib/curl_sspi.c +++ b/lib/curl_sspi.c @@ -133,6 +133,7 @@ Curl_sspi_version() LPTSTR path = NULL; LPVOID data = NULL; DWORD size, handle; + UINT length; if(s_hSecDll) { path = malloc(MAX_PATH); @@ -143,8 +144,8 @@ Curl_sspi_version() data = malloc(size); if(data) { if(GetFileVersionInfo(path, handle, size, data)) { - if(VerQueryValue(data, "\\", &version_info, &handle)) { - version = curl_maprintf("SSPI/%d.%d.%d.%d", + if(VerQueryValue(data, "\\", (LPVOID*)&version_info, &length)) { + version = curl_maprintf("%d.%d.%d.%d", (version_info->dwProductVersionMS>>16)&0xffff, (version_info->dwProductVersionMS>>0)&0xffff, (version_info->dwProductVersionLS>>16)&0xffff, @@ -158,7 +159,7 @@ Curl_sspi_version() free(path); } if(!version) - version = strdup("SSPI/Unknown"); + version = curl_maprintf("%d", s_pSecFn ? s_pSecFn->dwVersion : 0); } if(!version) @@ -265,7 +266,8 @@ Curl_sspi_status(SECURITY_STATUS status) status_const = "Unknown error"; } - return curl_maprintf("%s (0x%08X)", status_const, status); + return curl_maprintf("%s (0x%04X%04X)", status_const, + (status>>16)&0xffff, status&0xffff); } -- cgit v1.2.3