mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
curl_sspi: Added Curl_sspi_version function
Added new function to get SSPI version as string. Added required library version.lib to makefiles. Changed curl_schannel.c to use Curl_sspi_version.
This commit is contained in:
parent
0bb5ff5d1a
commit
c1311c2b8f
@ -190,6 +190,7 @@ endif
|
|||||||
endif
|
endif
|
||||||
ifdef SSPI
|
ifdef SSPI
|
||||||
CFLAGS += -DUSE_WINDOWS_SSPI
|
CFLAGS += -DUSE_WINDOWS_SSPI
|
||||||
|
DLL_LIBS += -lversion
|
||||||
endif
|
endif
|
||||||
ifdef SPNEGO
|
ifdef SPNEGO
|
||||||
CFLAGS += -DHAVE_SPNEGO
|
CFLAGS += -DHAVE_SPNEGO
|
||||||
|
@ -957,10 +957,10 @@ void Curl_schannel_cleanup() {
|
|||||||
|
|
||||||
size_t Curl_schannel_version(char *buffer, size_t size)
|
size_t Curl_schannel_version(char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
unsigned long version = s_pSecFn ? s_pSecFn->dwVersion : 0;
|
char* version = Curl_sspi_version();
|
||||||
return snprintf(buffer, size, "Schannel/%d.%d.%d.%d",
|
size = snprintf(buffer, size, "Schannel-%s", version);
|
||||||
(version>>0)&0xff, (version>>8)&0xff,
|
free(version);
|
||||||
(version>>16)&0xff, (version>>24)&0xff);
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* USE_SCHANNEL */
|
#endif /* USE_SCHANNEL */
|
||||||
|
@ -119,6 +119,55 @@ Curl_sspi_global_cleanup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Curl_sspi_version()
|
||||||
|
*
|
||||||
|
* This function returns a string representing the SSPI library version.
|
||||||
|
* It will in any case return a usable string pointer which needs to be freed.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
Curl_sspi_version()
|
||||||
|
{
|
||||||
|
VS_FIXEDFILEINFO *version_info = NULL;
|
||||||
|
LPTSTR version = NULL;
|
||||||
|
LPTSTR path = NULL;
|
||||||
|
LPVOID data = NULL;
|
||||||
|
DWORD size, handle;
|
||||||
|
|
||||||
|
if(s_hSecDll) {
|
||||||
|
path = malloc(MAX_PATH);
|
||||||
|
if(path) {
|
||||||
|
if(GetModuleFileName(s_hSecDll, path, MAX_PATH)) {
|
||||||
|
size = GetFileVersionInfoSize(path, &handle);
|
||||||
|
if(size) {
|
||||||
|
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",
|
||||||
|
(version_info->dwProductVersionMS>>16)&0xffff,
|
||||||
|
(version_info->dwProductVersionMS>>0)&0xffff,
|
||||||
|
(version_info->dwProductVersionLS>>16)&0xffff,
|
||||||
|
(version_info->dwProductVersionLS>>0)&0xffff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
if(!version)
|
||||||
|
version = strdup("SSPI/Unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!version)
|
||||||
|
version = strdup("");
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_sspi_status(SECURIY_STATUS status)
|
* Curl_sspi_status(SECURIY_STATUS status)
|
||||||
*
|
*
|
||||||
@ -219,6 +268,7 @@ Curl_sspi_status(SECURITY_STATUS status)
|
|||||||
return curl_maprintf("%s (0x%08X)", status_const, status);
|
return curl_maprintf("%s (0x%08X)", status_const, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_sspi_status_msg(SECURITY_STATUS status)
|
* Curl_sspi_status_msg(SECURITY_STATUS status)
|
||||||
*
|
*
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
|
|
||||||
CURLcode Curl_sspi_global_init(void);
|
CURLcode Curl_sspi_global_init(void);
|
||||||
void Curl_sspi_global_cleanup(void);
|
void Curl_sspi_global_cleanup(void);
|
||||||
|
char* Curl_sspi_version();
|
||||||
char* Curl_sspi_status(SECURITY_STATUS status);
|
char* Curl_sspi_status(SECURITY_STATUS status);
|
||||||
char* Curl_sspi_status_msg(SECURITY_STATUS status);
|
char* Curl_sspi_status_msg(SECURITY_STATUS status);
|
||||||
|
|
||||||
|
@ -199,6 +199,7 @@ ifdef METALINK
|
|||||||
endif
|
endif
|
||||||
ifdef SSPI
|
ifdef SSPI
|
||||||
CFLAGS += -DUSE_WINDOWS_SSPI
|
CFLAGS += -DUSE_WINDOWS_SSPI
|
||||||
|
curl_LDADD += -lversion
|
||||||
endif
|
endif
|
||||||
ifdef SPNEGO
|
ifdef SPNEGO
|
||||||
CFLAGS += -DHAVE_SPNEGO
|
CFLAGS += -DHAVE_SPNEGO
|
||||||
|
@ -149,6 +149,7 @@ USE_SSPI = yes
|
|||||||
|
|
||||||
!IF "$(USE_SSPI)"=="yes"
|
!IF "$(USE_SSPI)"=="yes"
|
||||||
CFLAGS_SSPI = /DUSE_WINDOWS_SSPI
|
CFLAGS_SSPI = /DUSE_WINDOWS_SSPI
|
||||||
|
LFLAGS_SSPI = version.lib
|
||||||
USE_SSPI = true
|
USE_SSPI = true
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
@ -292,6 +293,7 @@ CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6
|
|||||||
|
|
||||||
!IF "$(USE_SSPI)"=="true"
|
!IF "$(USE_SSPI)"=="true"
|
||||||
CFLAGS = $(CFLAGS) $(CFLAGS_SSPI)
|
CFLAGS = $(CFLAGS) $(CFLAGS_SSPI)
|
||||||
|
LFLAGS = $(LFLAGS) $(LFLAGS_SSPI)
|
||||||
CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
|
CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user