office-gobmx/include/systools/opensslinit.hxx
Stephan Bergmann e180d2a8fd Emscripten: Enable the WebDAV UCP
*  Which also requires external/curl.  But implicitly use --without-gssapi,
checking for it in configure.ac would fail with

> configure: error: could not find function 'gss_init_sec_context' required for GSSAPI

And building ExternalProject_curl needs to see the -pthread from
gb_EMSCRIPTEN_CPPFLAGS, otherwise linking Executable_soffice_bin would fail with

> wasm-ld: error: --shared-memory is disallowed by libcurl_la-easy.o because it was not compiled with 'atomics' or 'bulk-memory' features.

*  By default, GetCABundleFile in include/systools/opensslinit.hxx will fail
now.  (But to make https work, applications could bring along their own such
file in the Emscripten FS, in one of the places where GetCABundleFile checks for
it.)  So, for Emscripten only, make failure of GetCABundleFile non-fatal in
InitCurl_easy.

*  Some code in sw was erroneously hidden behind !ENABLE_WASM_STRIP_EXTRA (off
by default for Emscripten), but is needed with HAVE_FEATURE_CURL.

*  See <https://emscripten.org/docs/porting/networking.html> for how to actually
use networking in an Emscripten application.

Change-Id: I2bbe9f3fd0e20143e18eb1e8104568b1c7a304de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172167
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-08-21 11:20:54 +02:00

43 lines
1.4 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <config_crypto.h>
// Also include/systools/curlinit.hxx needs GetCABundleFile() if
// !defined(SYSTEM_CURL) it defines LO_CURL_NEEDS_CA_BUNDLE.
#if !defined(_WIN32) && (!defined(SYSTEM_OPENSSL) || defined(LO_CURL_NEEDS_CA_BUNDLE))
#include <unistd.h>
static char const* GetCABundleFile()
{
// try system ones first; inspired by:
// https://www.happyassassin.net/posts/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/
auto const candidates = {
"/etc/pki/tls/certs/ca-bundle.crt",
"/etc/pki/tls/certs/ca-bundle.trust.crt",
"/etc/ssl/certs/ca-certificates.crt",
"/var/lib/ca-certificates/ca-bundle.pem",
"/etc/ssl/cert.pem", // macOS has one at this location
};
for (char const* const candidate : candidates)
{
if (access(candidate, R_OK) == 0)
{
return candidate;
}
}
return nullptr;
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */