vcl/source/app/svmain.cxx |   26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

New commits:
commit 8234b6fe115627228fdb8a330a34c901f696c152
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Nov 9 17:13:30 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Nov 14 15:10:34 2023 +0100

    vcl: don't override user's SSL_CERT_FILE for bundled OpenSSL
    
    Change-Id: I5d61fe62c2e6814ea757a0b543f7dbf45e0db456
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159219
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit d45bd161a4750ca30639ce1c6ca6d6d070e6d2cb)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159417
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index aaf6a602cb14..0f9fcc17a49b 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -196,18 +196,22 @@ int ImplSVMain()
 #if defined(LINUX) && !defined(SYSTEM_OPENSSL)
     if (!bWasInitVCL)
     {
-        try // to point bundled OpenSSL to some system certificate file
-        {   // ... this only works if the client actually calls
-            // SSL_CTX_set_default_verify_paths() or similar; e.g. python ssl.
-            char const*const path = GetCABundleFile();
-            OUString const name("SSL_CERT_FILE");
-            OUString const filepath(::rtl::OStringToOUString(
-                ::std::string_view(path), osl_getThreadTextEncoding()));
-            osl_setEnvironment(name.pData, filepath.pData);
-        }
-        catch (uno::RuntimeException const& e)
+        const OUString name("SSL_CERT_FILE");
+        OUString temp;
+        if (osl_getEnvironment(name.pData, &temp.pData) == 
osl_Process_E_NotFound)
         {
-            SAL_WARN("vcl", e.Message);
+            try // to point bundled OpenSSL to some system certificate file
+            {   // ... this only works if the client actually calls
+                // SSL_CTX_set_default_verify_paths() or similar; e.g. python 
ssl.
+                char const*const path = GetCABundleFile();
+                OUString const filepath(::rtl::OStringToOUString(
+                    ::std::string_view(path), osl_getThreadTextEncoding()));
+                osl_setEnvironment(name.pData, filepath.pData);
+            }
+            catch (uno::RuntimeException const& e)
+            {
+                SAL_WARN("vcl", e.Message);
+            }
         }
     }
 #endif

Reply via email to