Skip to content

Commit

Permalink
schannel: remove version number and identify its use with 'schannel' …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
yangtse committed Jun 13, 2012
1 parent c13af84 commit 819afe4
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 133 deletions.
1 change: 0 additions & 1 deletion RELEASE-NOTES
Expand Up @@ -18,7 +18,6 @@ This release includes the following changes:
o pop3: Added support for sasl digest-md5 authentication
o pop3: Added support for apop authentication
o sspi: Added support for Schannel SSL/TLS encryption
o sspi: Changed curl version information output

This release includes the following bugfixes:

Expand Down
1 change: 0 additions & 1 deletion configure.ac
Expand Up @@ -3044,7 +3044,6 @@ AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
AC_SUBST(USE_WINDOWS_SSPI, [1])
curl_sspi_msg="enabled"
LIBS="$LIBS -lversion"
else
AC_MSG_RESULT(no)
AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
Expand Down
2 changes: 1 addition & 1 deletion docs/FEATURES
Expand Up @@ -125,7 +125,7 @@ FILE
FOOTNOTES
=========

*1 = requires OpenSSL, GnuTLS, NSS, yassl, axTLS, PolarSSL or Windows SSPI
*1 = requires OpenSSL, GnuTLS, NSS, yassl, axTLS, PolarSSL or schannel
*2 = requires OpenLDAP
*3 = requires a GSSAPI-compliant library, such as Heimdal or similar.
*4 = requires FBopenssl
Expand Down
1 change: 0 additions & 1 deletion lib/Makefile.m32
Expand Up @@ -185,7 +185,6 @@ endif
endif
ifdef SSPI
CFLAGS += -DUSE_WINDOWS_SSPI
DLL_LIBS += -lversion
ifdef SCHANNEL
CFLAGS += -DUSE_SCHANNEL
endif
Expand Down
1 change: 0 additions & 1 deletion lib/Makefile.vc6
Expand Up @@ -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
Expand Down
14 changes: 5 additions & 9 deletions lib/curl_schannel.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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 */
9 changes: 4 additions & 5 deletions 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 ___| | | | _ \| |
Expand All @@ -8,6 +8,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012, Marc Hoersken, <info@marc-hoersken.de>, et al.
* Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand All @@ -23,7 +24,6 @@
***************************************************************************/
#include "setup.h"

#ifdef USE_WINDOWS_SSPI
#ifdef USE_SCHANNEL

#include "urldata.h"
Expand Down Expand Up @@ -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 */
63 changes: 0 additions & 63 deletions lib/curl_sspi.c
Expand Up @@ -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 */
1 change: 0 additions & 1 deletion lib/curl_sspi.h
Expand Up @@ -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 */

Expand Down
18 changes: 0 additions & 18 deletions lib/version.c
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/Makefile.m32
Expand Up @@ -194,7 +194,6 @@ ifdef METALINK
endif
ifdef SSPI
CFLAGS += -DUSE_WINDOWS_SSPI
curl_LDADD += -lversion
ifdef SCHANNEL
CFLAGS += -DUSE_SCHANNEL
endif
Expand Down
27 changes: 2 additions & 25 deletions src/Makefile.vc6
Expand Up @@ -101,8 +101,6 @@ SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib advapi32.lib

WINLIBS = ws2_32.lib wldap32.lib

# Runtime library configuration
RTLIB = /MD
RTLIBD = /MDd
Expand Down Expand Up @@ -229,9 +227,6 @@ DEBUG_OBJS= \
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG)
!IFDEF WINDOWS_SSPI
WINLIBS = $(WINLIBS) version.lib
!ENDIF

#################################################
# release dynamic library
Expand All @@ -249,9 +244,6 @@ CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!IFDEF WINDOWS_SSPI
WINLIBS = $(WINLIBS) version.lib
!ENDIF
!ENDIF

#################################################
Expand All @@ -262,9 +254,6 @@ CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!IFDEF WINDOWS_SSPI
WINLIBS = $(WINLIBS) version.lib
!ENDIF
!ENDIF

#################################################
Expand All @@ -285,9 +274,6 @@ CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!IFDEF WINDOWS_SSPI
WINLIBS = $(WINLIBS) version.lib
!ENDIF
!ENDIF

#################################################
Expand All @@ -298,9 +284,6 @@ CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!IFDEF WINDOWS_SSPI
WINLIBS = $(WINLIBS) version.lib
!ENDIF
!ENDIF

#################################################
Expand All @@ -311,9 +294,6 @@ CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!IFDEF WINDOWS_SSPI
WINLIBS = $(WINLIBS) version.lib
!ENDIF
!ENDIF

#################################################
Expand All @@ -334,9 +314,6 @@ CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!IFDEF WINDOWS_SSPI
WINLIBS = $(WINLIBS) version.lib
!ENDIF
!ENDIF

#################################################
Expand All @@ -350,8 +327,8 @@ LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF


LINKLIBS = $(LINKLIBS) $(WINLIBS)
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) $(WINLIBS)
LINKLIBS = $(LINKLIBS) ws2_32.lib wldap32.lib
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) ws2_32.lib wldap32.lib

all : release

Expand Down
17 changes: 11 additions & 6 deletions winbuild/MakefileBuild.vc
Expand Up @@ -143,17 +143,19 @@ SSH2_CFLAGS = $(SSH2_CFLAGS) /I$(WITH_DEVEL)/include/libssh2
!ENDIF


!IFNDEF USE_SSL
CFLAGS_SSPI = /DUSE_SCHANNEL
USE_SCHANNEL = true
USE_SSPI = yes
!ENDIF

!IFNDEF USE_SSPI
USE_SSPI = yes
!ENDIF

!IF "$(USE_SSPI)"=="yes"
CFLAGS_SSPI = /DUSE_WINDOWS_SSPI
LFLAGS_SSPI = version.lib
CFLAGS_SSPI = $(CFLAGS_SSPI) /DUSE_WINDOWS_SSPI
USE_SSPI = true
!IFNDEF USE_SSL
CFLAGS_SSPI = $(CFLAGS_SSPI) /DUSE_SCHANNEL
!ENDIF
!ENDIF


Expand Down Expand Up @@ -296,9 +298,12 @@ CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-ipv6

!IF "$(USE_SSPI)"=="true"
CFLAGS = $(CFLAGS) $(CFLAGS_SSPI)
LFLAGS = $(LFLAGS) $(LFLAGS_SSPI)
!IF "$(USE_SCHANNEL)"=="true"
CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi-schannel
!ELSE
CONFIG_NAME_LIB = $(CONFIG_NAME_LIB)-sspi
!ENDIF
!ENDIF

!IF "$(GEN_PDB)"=="true"
CFLAGS = $(CFLAGS) $(CFLAGS_PDB)
Expand Down

0 comments on commit 819afe4

Please sign in to comment.