mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:51:53 +03:00
windows: tidy up includes, macros, document dependencies
- define `SECURITY_WIN32` globally in `curl_setup.h`. To make sure it applies to all includes. - document which Windows headers require `SECURITY_WIN32`. - stop suppressing MSVC warning: `C4201 is: nonstandard extension used : nameless struct/union` The warning is no longer seen in supported build envs with the current codebase. Follow-up to8beff43559#8419 - document why `SCHANNEL_USE_BLACKLISTS` is needed. - just define `SCHANNEL_USE_BLACKLISTS`, drop the unnecessary value `1`. - stop defining unused `SCH_CRED_MAX_SUPPORTED*` fallback macros. Follow-up to8beff43559#8419 - document why `subauth.h` is included (where missing). - move and de-dupe `subauth.h` include into `curl_setup.h`, limit to Schannel builds. - stop include `schnlsp.h`. It is a 1-to-1 compatibility wrapper for `schannel.h`. - curl_sspi.h: clarify comment about `SP_NAME_` macros. They are local macros, their SDK names are different and curl does not use them. - curl_sspi.h: drop superfluous includes `security.h` and `rpc.h`. Cherry-picked from #20556 Closes #20564
This commit is contained in:
parent
982ab7b53f
commit
c220674ac4
5 changed files with 11 additions and 35 deletions
|
|
@ -106,6 +106,7 @@
|
||||||
# ifndef NOGDI
|
# ifndef NOGDI
|
||||||
# define NOGDI
|
# define NOGDI
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Detect Windows App environment which has a restricted access
|
/* Detect Windows App environment which has a restricted access
|
||||||
* to the Win32 APIs. */
|
* to the Win32 APIs. */
|
||||||
# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
|
# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
|
||||||
|
|
@ -116,6 +117,12 @@
|
||||||
# define CURL_WINDOWS_UWP
|
# define CURL_WINDOWS_UWP
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
/* Mandatory to define SECURITY_WIN32 or SECURITY_KERNEL to indicating who is
|
||||||
|
compiling the code. */
|
||||||
|
#undef SECURITY_KERNEL
|
||||||
|
#undef SECURITY_WIN32
|
||||||
|
#define SECURITY_WIN32 /* for <sspi.h> */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Compatibility */
|
/* Compatibility */
|
||||||
|
|
@ -837,7 +844,8 @@
|
||||||
#ifdef USE_SCHANNEL
|
#ifdef USE_SCHANNEL
|
||||||
/* Must set this before <schannel.h> is included directly or indirectly by
|
/* Must set this before <schannel.h> is included directly or indirectly by
|
||||||
another Windows header. */
|
another Windows header. */
|
||||||
# define SCHANNEL_USE_BLACKLISTS 1
|
# define SCHANNEL_USE_BLACKLISTS /* for SCH_CREDENTIALS */
|
||||||
|
# include <subauth.h> /* for [P]UNICODE_STRING in SCH_CREDENTIALS */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __hpux
|
#ifdef __hpux
|
||||||
|
|
|
||||||
|
|
@ -27,17 +27,7 @@
|
||||||
|
|
||||||
#ifdef USE_WINDOWS_SSPI
|
#ifdef USE_WINDOWS_SSPI
|
||||||
|
|
||||||
/*
|
|
||||||
* When including the following three headers, it is mandatory to define either
|
|
||||||
* SECURITY_WIN32 or SECURITY_KERNEL, indicating who is compiling the code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef SECURITY_WIN32
|
|
||||||
#undef SECURITY_KERNEL
|
|
||||||
#define SECURITY_WIN32 1
|
|
||||||
#include <security.h>
|
|
||||||
#include <sspi.h>
|
#include <sspi.h>
|
||||||
#include <rpc.h>
|
|
||||||
|
|
||||||
CURLcode Curl_sspi_global_init(void);
|
CURLcode Curl_sspi_global_init(void);
|
||||||
void Curl_sspi_global_cleanup(void);
|
void Curl_sspi_global_cleanup(void);
|
||||||
|
|
@ -56,7 +46,7 @@ void Curl_sspi_free_identity(SEC_WINNT_AUTH_IDENTITY *identity);
|
||||||
/* Forward-declaration of global variables defined in curl_sspi.c */
|
/* Forward-declaration of global variables defined in curl_sspi.c */
|
||||||
extern PSecurityFunctionTable Curl_pSecFn;
|
extern PSecurityFunctionTable Curl_pSecFn;
|
||||||
|
|
||||||
/* Provide some definitions missing in old headers */
|
/* Provide Service Principal names as macros */
|
||||||
#define SP_NAME_DIGEST "WDigest"
|
#define SP_NAME_DIGEST "WDigest"
|
||||||
#define SP_NAME_NTLM "NTLM"
|
#define SP_NAME_NTLM "NTLM"
|
||||||
#define SP_NAME_NEGOTIATE "Negotiate"
|
#define SP_NAME_NEGOTIATE "Negotiate"
|
||||||
|
|
|
||||||
|
|
@ -56,14 +56,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_WIN32_LDAP /* Use Windows LDAP implementation. */
|
#ifdef USE_WIN32_LDAP /* Use Windows LDAP implementation. */
|
||||||
# ifdef _MSC_VER
|
|
||||||
# pragma warning(push)
|
|
||||||
# pragma warning(disable:4201)
|
|
||||||
# endif
|
|
||||||
# include <subauth.h> /* for [P]UNICODE_STRING */
|
|
||||||
# ifdef _MSC_VER
|
|
||||||
# pragma warning(pop)
|
|
||||||
# endif
|
|
||||||
# include <winldap.h>
|
# include <winldap.h>
|
||||||
# include <winber.h>
|
# include <winber.h>
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,6 @@
|
||||||
|
|
||||||
#ifdef USE_SCHANNEL
|
#ifdef USE_SCHANNEL
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable:4201)
|
|
||||||
#endif
|
|
||||||
#include <subauth.h>
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
/* Wincrypt must be included before anything that could include OpenSSL. */
|
/* Wincrypt must be included before anything that could include OpenSSL. */
|
||||||
#ifdef USE_WIN32_CRYPTO
|
#ifdef USE_WIN32_CRYPTO
|
||||||
#include <wincrypt.h>
|
#include <wincrypt.h>
|
||||||
|
|
@ -48,14 +40,13 @@
|
||||||
#undef OCSP_RESPONSE
|
#undef OCSP_RESPONSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <schnlsp.h>
|
|
||||||
#include <schannel.h>
|
#include <schannel.h>
|
||||||
#include "../curl_sspi.h"
|
#include "../curl_sspi.h"
|
||||||
|
|
||||||
#include "../cfilters.h"
|
#include "../cfilters.h"
|
||||||
#include "../urldata.h"
|
#include "../urldata.h"
|
||||||
|
|
||||||
/* <wincrypt.h> has been included via the above <schnlsp.h>.
|
/* <wincrypt.h> has been included via the above <schannel.h>.
|
||||||
* Or in case of ldap.c, it was included via <winldap.h>.
|
* Or in case of ldap.c, it was included via <winldap.h>.
|
||||||
* And since <wincrypt.h> has this:
|
* And since <wincrypt.h> has this:
|
||||||
* #define X509_NAME ((LPCSTR)7)
|
* #define X509_NAME ((LPCSTR)7)
|
||||||
|
|
|
||||||
|
|
@ -91,11 +91,6 @@ typedef struct _SCH_CREDENTIALS {
|
||||||
PTLS_PARAMETERS pTlsParameters;
|
PTLS_PARAMETERS pTlsParameters;
|
||||||
} SCH_CREDENTIALS, * PSCH_CREDENTIALS;
|
} SCH_CREDENTIALS, * PSCH_CREDENTIALS;
|
||||||
|
|
||||||
#define SCH_CRED_MAX_SUPPORTED_PARAMETERS 16
|
|
||||||
#define SCH_CRED_MAX_SUPPORTED_ALPN_IDS 16
|
|
||||||
#define SCH_CRED_MAX_SUPPORTED_CRYPTO_SETTINGS 16
|
|
||||||
#define SCH_CRED_MAX_SUPPORTED_CHAINING_MODES 16
|
|
||||||
|
|
||||||
#endif /* SCH_CREDENTIALS_VERSION */
|
#endif /* SCH_CREDENTIALS_VERSION */
|
||||||
|
|
||||||
struct Curl_schannel_cred {
|
struct Curl_schannel_cred {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue