Make cert revocation check fails non-fatal on Win

Instead of erroring out completely when it can't determine if the
certificate is valid, proceed anyway.  This matches how web browsers
treat failed cert revocation checks.  schannel just has somewhat
paranoid defaults.
This commit is contained in:
Richard Stanway 2020-03-13 07:47:29 -07:00 committed by jp9000
parent 59351b27ae
commit 49bd76755b
5 changed files with 45 additions and 3 deletions

View File

@ -15,7 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include <curl/curl.h>
#include <util/curl/curl-helper.h>
#include "obs-app.hpp"
#include "qt-wrappers.hpp"
#include "remote-text.hpp"
@ -70,6 +70,7 @@ void RemoteTextThread::run()
curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
string_write);
curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, &str);
curl_obs_set_revoke_setting(curl.get());
if (timeoutSec)
curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT,
@ -155,6 +156,8 @@ bool GetRemoteFile(const char *url, std::string &str, std::string &error,
curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
string_write);
curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, &str);
curl_obs_set_revoke_setting(curl.get());
if (signature) {
curl_easy_setopt(curl.get(), CURLOPT_HEADERFUNCTION,
header_write);

View File

@ -1,9 +1,9 @@
#include <util/curl/curl-helper.h>
#include <util/threading.h>
#include <util/platform.h>
#include <util/darray.h>
#include <util/dstr.h>
#include <obs-data.h>
#include <curl/curl.h>
#include "file-updater.h"
#define warn(msg, ...) \
@ -118,6 +118,7 @@ static bool do_http_request(struct update_info *info, const char *url,
curl_easy_setopt(info->curl, CURLOPT_FAILONERROR, true);
curl_easy_setopt(info->curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(info->curl, CURLOPT_ACCEPT_ENCODING, "");
curl_obs_set_revoke_setting(info->curl);
if (!info->remote_url) {
// We only care about headers from the main package file

View File

@ -350,6 +350,7 @@ set(libobs_util_SOURCES
util/cf-parser.c
util/profiler.c)
set(libobs_util_HEADERS
util/curl/curl-helper.h
util/sse-intrin.h
util/array-serializer.h
util/file-serializer.h

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2020 Hugh Bailey <obs.jim@gmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include <curl/curl.h>
#if defined(_WIN32) && LIBCURL_VERSION_NUM >= 0x072c00
#ifdef CURLSSLOPT_REMOVE_BEST_EFFORT
#define CURL_OBS_REVOKE_SETTING CURLSSLOPT_REVOKE_BEST_EFFORT
#else
#define CURL_OBS_REVOKE_SETTING CURLSSLOPT_NO_REVOKE
#endif
#define curl_obs_set_revoke_setting(handle) \
curl_easy_setopt(handle, CURLOPT_SSL_OPTIONS, CURL_OBS_REVOKE_SETTING)
#else
#define curl_obs_set_revoke_setting(handle)
#endif

View File

@ -1,4 +1,4 @@
#include <curl/curl.h>
#include <util/curl/curl-helper.h>
#include <stdlib.h>
#include <string.h>
@ -63,6 +63,7 @@ const char *younow_get_ingest(const char *server, const char *key)
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 3L);
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, younow_write_cb);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
curl_obs_set_revoke_setting(curl_handle);
#if LIBCURL_VERSION_NUM >= 0x072400
// A lot of servers don't yet support ALPN