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
This commit is contained in:

committed by
Daniel Stenberg

parent
c1311c2b8f
commit
7047e2ed72
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user