Add policy to alter curl revoke settings on windows

This commit is contained in:
Mark Roszko 2023-07-14 00:06:42 +00:00
parent d73f96e3d8
commit b2f72020bd
2 changed files with 28 additions and 4 deletions

View File

@ -41,6 +41,8 @@
#include <kiplatform/environment.h>
#include <pgm_base.h>
#include <kiplatform/policy.h>
#include <policy_keys.h>
struct CURL_PROGRESS
{
@ -127,9 +129,21 @@ KICAD_CURL_EASY::KICAD_CURL_EASY() :
curl_easy_setopt( m_CURL, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
#endif
#ifdef _WIN32
#ifdef _WIN32
// We need this to use the Windows Certificate store
curl_easy_setopt( m_CURL, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA );
long sslOpts = CURLSSLOPT_NATIVE_CA;
POLICY_CURL_SSL_REVOKE policyState = KIPLATFORM::POLICY::GetPolicyEnum<POLICY_CURL_SSL_REVOKE>( POLICY_KEY_REQUESTS_CURL_REVOKE );
if( policyState == POLICY_CURL_SSL_REVOKE::BEST_EFFORT )
{
sslOpts |= CURLSSLOPT_REVOKE_BEST_EFFORT;
}
else if( policyState == POLICY_CURL_SSL_REVOKE::NONE )
{
sslOpts |= CURLSSLOPT_NO_REVOKE;
}
curl_easy_setopt( m_CURL, CURLOPT_SSL_OPTIONS, sslOpts );
#endif
if( wxGetEnv( wxT( "KICAD_CURL_VERBOSE" ), nullptr ) )

View File

@ -25,7 +25,17 @@
#ifndef POLICY_KEYS_H_
#define POLICY_KEYS_H_
#define POLICY_KEY_DATACOLLECTION wxT( "DataCollection" )
#define POLICY_KEY_PCM wxT( "PluginAndContentManager" )
#include <cstdint>
#define POLICY_KEY_DATACOLLECTION wxT( "DataCollection" )
#define POLICY_KEY_PCM wxT( "PluginAndContentManager" )
#define POLICY_KEY_REQUESTS_CURL_REVOKE wxT( "curl\\SslRevoke" )
enum class POLICY_CURL_SSL_REVOKE : std::uint32_t
{
DEFAULT = 0,
BEST_EFFORT = 1,
NONE = 2
};
#endif // POLICY_KEYS_H_