From 819afe46eeab2c7fa4738e4d77fa2a79a7bb8ebe Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 13 Jun 2012 15:53:51 +0200 Subject: schannel: remove version number and identify its use with 'schannel' literal Version number is removed in order to make this info consistent with how we do it with other MS and Linux system libraries for which we don't provide this info. Identifier changed from 'WinSSPI' to 'schannel' given that this is the actual provider of the SSL/TLS support. libcurl can still be built with SSPI and without SCHANNEL support. --- lib/Makefile.m32 | 1 - lib/Makefile.vc6 | 1 - lib/curl_schannel.c | 14 +++++------- lib/curl_schannel.h | 9 ++++---- lib/curl_sspi.c | 63 ----------------------------------------------------- lib/curl_sspi.h | 1 - lib/version.c | 18 --------------- 7 files changed, 9 insertions(+), 98 deletions(-) (limited to 'lib') diff --git a/lib/Makefile.m32 b/lib/Makefile.m32 index fd191c119..809612b82 100644 --- a/lib/Makefile.m32 +++ b/lib/Makefile.m32 @@ -185,7 +185,6 @@ endif endif ifdef SSPI CFLAGS += -DUSE_WINDOWS_SSPI - DLL_LIBS += -lversion ifdef SCHANNEL CFLAGS += -DUSE_SCHANNEL endif diff --git a/lib/Makefile.vc6 b/lib/Makefile.vc6 index 205b433a3..46c67b264 100644 --- a/lib/Makefile.vc6 +++ b/lib/Makefile.vc6 @@ -123,7 +123,6 @@ CFGSET = FALSE !IFDEF WINDOWS_SSPI CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include -WINLIBS = $(WINLIBS) version.lib !ENDIF !IFDEF USE_IPV6 diff --git a/lib/curl_schannel.c b/lib/curl_schannel.c index 3cac4e149..0f49e8d7d 100644 --- a/lib/curl_schannel.c +++ b/lib/curl_schannel.c @@ -54,9 +54,12 @@ #include "setup.h" -#ifdef USE_WINDOWS_SSPI #ifdef USE_SCHANNEL +#ifndef USE_WINDOWS_SSPI +# error "Can't compile SCHANNEL support without SSPI." +#endif + #include "curl_sspi.h" #include "curl_schannel.h" #include "sslgen.h" @@ -974,16 +977,9 @@ void Curl_schannel_cleanup() size_t Curl_schannel_version(char *buffer, size_t size) { - int sspi_major = 0, sspi_minor = 0, sspi_build = 0; - - if(!Curl_sspi_version(&sspi_major, &sspi_minor, &sspi_build, NULL)) - size = snprintf(buffer, size, "WinSSPI/%d.%d.%d", sspi_major, sspi_minor, - sspi_build); - else - size = snprintf(buffer, size, "WinSSPI/unknown"); + size = snprintf(buffer, size, "schannel"); return size; } #endif /* USE_SCHANNEL */ -#endif /* USE_WINDOWS_SSPI */ diff --git a/lib/curl_schannel.h b/lib/curl_schannel.h index fa19a02de..bac6e422b 100644 --- a/lib/curl_schannel.h +++ b/lib/curl_schannel.h @@ -1,5 +1,5 @@ -#ifndef HEADER_SCHANNEL_H -#define HEADER_SCHANNEL_H +#ifndef HEADER_CURL_SCHANNEL_H +#define HEADER_CURL_SCHANNEL_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | @@ -8,6 +8,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2012, Marc Hoersken, , et al. + * Copyright (C) 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -23,7 +24,6 @@ ***************************************************************************/ #include "setup.h" -#ifdef USE_WINDOWS_SSPI #ifdef USE_SCHANNEL #include "urldata.h" @@ -129,5 +129,4 @@ size_t Curl_schannel_version(char *buffer, size_t size); #define curlssl_data_pending Curl_schannel_data_pending #endif /* USE_SCHANNEL */ -#endif /* USE_WINDOWS_SSPI */ -#endif /* HEADER_SCHANNEL_H */ +#endif /* HEADER_CURL_SCHANNEL_H */ diff --git a/lib/curl_sspi.c b/lib/curl_sspi.c index 0d3feb642..cb83809b3 100644 --- a/lib/curl_sspi.c +++ b/lib/curl_sspi.c @@ -112,67 +112,4 @@ void Curl_sspi_global_cleanup(void) } } -/* - * Curl_sspi_version() - * - * This function returns the SSPI library version information. - */ -CURLcode Curl_sspi_version(int *major, int *minor, int *build, int *special) -{ - CURLcode result = CURLE_OK; - VS_FIXEDFILEINFO *version_info = NULL; - LPTSTR path = NULL; - LPVOID data = NULL; - DWORD size, handle; - UINT length; - - if(!s_hSecDll) - return CURLE_FAILED_INIT; - - path = (char *) malloc(MAX_PATH); - if(!path) - return CURLE_OUT_OF_MEMORY; - - 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, "\\", (LPVOID*) &version_info, &length)) - result = CURLE_OUT_OF_MEMORY; - } - else - result = CURLE_OUT_OF_MEMORY; - } - else - result = CURLE_OUT_OF_MEMORY; - } - else - result = CURLE_OUT_OF_MEMORY; - } - else - result = CURLE_OUT_OF_MEMORY; - - /* Set the out parameters */ - if(!result) { - if(major) - *major = (version_info->dwProductVersionMS >> 16) & 0xffff; - - if(minor) - *minor = (version_info->dwProductVersionMS >> 0) & 0xffff; - - if(build) - *build = (version_info->dwProductVersionLS >> 16) & 0xffff; - - if(special) - *special = (version_info->dwProductVersionLS >> 0) & 0xffff; - } - - Curl_safefree(data); - Curl_safefree(path); - - return result; -} - #endif /* USE_WINDOWS_SSPI */ diff --git a/lib/curl_sspi.h b/lib/curl_sspi.h index 7e8880346..4e7d4cfe6 100644 --- a/lib/curl_sspi.h +++ b/lib/curl_sspi.h @@ -42,7 +42,6 @@ CURLcode Curl_sspi_global_init(void); void Curl_sspi_global_cleanup(void); -CURLcode Curl_sspi_version(int *major, int *minor, int *build, int *special); /* Forward-declaration of global variables defined in curl_sspi.c */ diff --git a/lib/version.c b/lib/version.c index 9f9fc78b1..783732403 100644 --- a/lib/version.c +++ b/lib/version.c @@ -67,11 +67,6 @@ char *curl_version(void) char *ptr = version; size_t len; size_t left = sizeof(version); -#ifdef USE_WINDOWS_SSPI -#ifndef USE_SCHANNEL - int sspi_major = 0, sspi_minor = 0, sspi_build = 0; -#endif -#endif strcpy(ptr, LIBCURL_NAME "/" LIBCURL_VERSION); len = strlen(ptr); @@ -88,19 +83,6 @@ char *curl_version(void) } } -#ifdef USE_WINDOWS_SSPI -#ifndef USE_SCHANNEL - if(CURLE_OK == Curl_sspi_version(&sspi_major, &sspi_minor, &sspi_build, - NULL)) - len = snprintf(ptr, left, " WinSSPI/%d.%d.%d", sspi_major, sspi_minor, - sspi_build); - else - len = snprintf(ptr, left, " WinSSPI/unknown"); - - left -= len; - ptr += len; -#endif -#endif #ifdef HAVE_LIBZ len = snprintf(ptr, left, " zlib/%s", zlibVersion()); left -= len; -- cgit v1.2.3