summaryrefslogtreecommitdiff
path: root/lib/curl_sspi.c
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2012-04-14 15:00:33 +0200
committerDaniel Stenberg <daniel@haxx.se>2012-06-11 19:00:35 +0200
commitc1311c2b8f34c352d771f1d5810e64141aa802b1 (patch)
treeba0b04fcc617e15274bc3c33871ef4f0a68d239d /lib/curl_sspi.c
parent0bb5ff5d1a13f51344cdc666d08db7aefc4dc5a9 (diff)
downloadcurl-c1311c2b8f34c352d771f1d5810e64141aa802b1.tar.gz
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.
Diffstat (limited to 'lib/curl_sspi.c')
-rw-r--r--lib/curl_sspi.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/curl_sspi.c b/lib/curl_sspi.c
index d915710f8..d3533a293 100644
--- a/lib/curl_sspi.c
+++ b/lib/curl_sspi.c
@@ -120,6 +120,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)
*
* This function returns a string representing an SSPI status.
@@ -219,6 +268,7 @@ Curl_sspi_status(SECURITY_STATUS status)
return curl_maprintf("%s (0x%08X)", status_const, status);
}
+
/*
* Curl_sspi_status_msg(SECURITY_STATUS status)
*