mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 09:21:50 -05:00
sspi: Added version information
Added version information for Windows SSPI to curl's main version string and removed SSPI from the features string.
This commit is contained in:
parent
560cd62272
commit
2976de4808
@ -169,6 +169,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
|
||||||
|
@ -123,6 +123,7 @@ CFGSET = FALSE
|
|||||||
|
|
||||||
!IFDEF WINDOWS_SSPI
|
!IFDEF WINDOWS_SSPI
|
||||||
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
|
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
|
||||||
|
WINLIBS = $(WINLIBS) version.lib
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
!IFDEF USE_IPV6
|
!IFDEF USE_IPV6
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -101,6 +101,68 @@ Curl_sspi_global_init(void)
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 version = NULL;
|
||||||
|
LPTSTR path = NULL;
|
||||||
|
LPVOID data = NULL;
|
||||||
|
DWORD size, handle;
|
||||||
|
|
||||||
|
if(!s_hSecDll)
|
||||||
|
return CURLE_FAILED_INIT;
|
||||||
|
|
||||||
|
path = 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, "\\", &version_info, &handle))
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_sspi_global_cleanup()
|
* Curl_sspi_global_cleanup()
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -62,6 +62,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
CURLcode Curl_sspi_global_init(void);
|
CURLcode Curl_sspi_global_init(void);
|
||||||
|
CURLcode Curl_sspi_version(int *major, int *minor, int *build, int *special);
|
||||||
void Curl_sspi_global_cleanup(void);
|
void Curl_sspi_global_cleanup(void);
|
||||||
|
|
||||||
/* Forward-declaration of global variables defined in curl_sspi.c */
|
/* Forward-declaration of global variables defined in curl_sspi.c */
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -64,10 +64,16 @@
|
|||||||
char *curl_version(void)
|
char *curl_version(void)
|
||||||
{
|
{
|
||||||
static char version[200];
|
static char version[200];
|
||||||
char *ptr=version;
|
char *ptr = version;
|
||||||
size_t len;
|
size_t len;
|
||||||
size_t left = sizeof(version);
|
size_t left = sizeof(version);
|
||||||
strcpy(ptr, LIBCURL_NAME "/" LIBCURL_VERSION );
|
#ifdef USE_WINDOWS_SSPI
|
||||||
|
int sspi_major = 0;
|
||||||
|
int sspi_minor = 0;
|
||||||
|
int sspi_build = 0;
|
||||||
|
#endif;
|
||||||
|
|
||||||
|
strcpy(ptr, LIBCURL_NAME "/" LIBCURL_VERSION);
|
||||||
len = strlen(ptr);
|
len = strlen(ptr);
|
||||||
left -= len;
|
left -= len;
|
||||||
ptr += len;
|
ptr += len;
|
||||||
@ -82,6 +88,17 @@ char *curl_version(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_WINDOWS_SSPI
|
||||||
|
if(CURLE_OK == Curl_sspi_version(&sspi_major, &sspi_minor, &sspi_build,
|
||||||
|
NULL))
|
||||||
|
len = snprintf(ptr, left, " sspi/%d.%d.%d", sspi_major, sspi_minor,
|
||||||
|
sspi_build);
|
||||||
|
else
|
||||||
|
len = snprintf(ptr, left, " sspi/unknown");
|
||||||
|
|
||||||
|
left -= len;
|
||||||
|
ptr += len;
|
||||||
|
#endif
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
len = snprintf(ptr, left, " zlib/%s", zlibVersion());
|
len = snprintf(ptr, left, " zlib/%s", zlibVersion());
|
||||||
left -= len;
|
left -= len;
|
||||||
@ -243,9 +260,6 @@ static curl_version_info_data version_info = {
|
|||||||
#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)
|
#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)
|
||||||
| CURL_VERSION_NTLM_WB
|
| CURL_VERSION_NTLM_WB
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WINDOWS_SSPI
|
|
||||||
| CURL_VERSION_SSPI
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
| CURL_VERSION_LIBZ
|
| CURL_VERSION_LIBZ
|
||||||
#endif
|
#endif
|
||||||
|
@ -168,6 +168,7 @@ endif
|
|||||||
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
|
||||||
|
@ -275,7 +275,6 @@ static const struct feat feats[] = {
|
|||||||
{"NTLM_WB", CURL_VERSION_NTLM_WB},
|
{"NTLM_WB", CURL_VERSION_NTLM_WB},
|
||||||
{"SPNEGO", CURL_VERSION_SPNEGO},
|
{"SPNEGO", CURL_VERSION_SPNEGO},
|
||||||
{"SSL", CURL_VERSION_SSL},
|
{"SSL", CURL_VERSION_SSL},
|
||||||
{"SSPI", CURL_VERSION_SSPI},
|
|
||||||
{"krb4", CURL_VERSION_KERBEROS4},
|
{"krb4", CURL_VERSION_KERBEROS4},
|
||||||
{"libz", CURL_VERSION_LIBZ},
|
{"libz", CURL_VERSION_LIBZ},
|
||||||
{"CharConv", CURL_VERSION_CONV},
|
{"CharConv", CURL_VERSION_CONV},
|
||||||
|
@ -145,6 +145,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
|
||||||
|
|
||||||
@ -283,6 +284,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…
x
Reference in New Issue
Block a user