Skip to content

Commit 1292b3e

Browse files
committed
add CONDA_SKIP_OPENSSL_DLL_CHECK; clean-ups
1 parent 1331ef6 commit 1292b3e

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

recipes/_openssl-syslib-check/activate.bat

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
@echo off
66

7+
:: early out for users who want to silence the warning
8+
if defined CONDA_SKIP_OPENSSL_DLL_CHECK (
9+
exit /b 0
10+
)
11+
712
set "LIBSSL_PATH=C:\Windows\System32\libssl-1_1-x64.dll"
813
set "LIBCRYPTO_PATH=C:\Windows\System32\libcrypto-1_1-x64.dll"
914

@@ -24,14 +29,7 @@ if "%HAS_SYS_LIBS%"=="F" (
2429
exit /b 0
2530
)
2631

27-
:: if we made it until here, we need to detect which combination
28-
:: of openssl/cryptography is installed
29-
openssl version >nul
30-
if %ERRORLEVEL% neq 0 (
31-
ECHO The package "_openssl-syslib-check" should only be used by openssl!
32-
exit /b 1
33-
)
34-
32+
:: if we made it until here, we need to detect if cryptography is installed
3533
python -c "import cryptography" 2>nul
3634
if %ERRORLEVEL% neq 0 (
3735
set "HAS_CRYPTOGRAPHY=F"
@@ -49,7 +47,9 @@ if "%HAS_CRYPTOGRAPHY%"=="F" (
4947
if "%HAS_SYS_SSL%"=="T" ECHO WARNING: %LIBSSL_PATH%
5048
if "%HAS_SYS_CRYPTO%"=="T" ECHO WARNING: %LIBCRYPTO_PATH%
5149
ECHO WARNING: These DLLs will be linked to before those in the conda
52-
ECHO WARNING: environment and might make your installation vulnerable!
50+
ECHO WARNING: environment and might make your installation vulnerable!!
51+
ECHO Info: ^(You can silence this warning by setting the environment
52+
ECHO Info: variable CONDA_SKIP_OPENSSL_DLL_CHECK to any value.^)
5353
exit /b 0
5454
)
5555

@@ -82,21 +82,20 @@ if "%LINKED_TO_OUTDATED_SYSLIB%"=="True" (
8282
ECHO WARNING: Your system contains outdated DLLs under:
8383
if "%HAS_SYS_SSL%"=="T" ECHO WARNING: %LIBSSL_PATH%
8484
if "%HAS_SYS_CRYPTO%"=="T" ECHO WARNING: %LIBCRYPTO_PATH%
85-
ECHO WARNING: using '%LINKED_VERSION_TEXT%' ^(instead of %ENV_VERSION% in the environment^).
86-
ECHO WARNING: These DLLs will be preferred over those in the conda environment ^(despite
85+
ECHO WARNING: using '%LINKED_VERSION_TEXT%' ^(instead of %ENV_VERSION% in the env^).
86+
ECHO WARNING: These DLLs will be preferred over those in the conda env ^(despite
8787
ECHO WARNING: our best tries^), and might make your installation vulnerable!
88-
ECHO WARNING: ^(Upgrading your python version should enable conda to work around this.^)
88+
ECHO Info: ^(Upgrading your python version should enable conda to work around
89+
ECHO Info: this; alternatively, you can silence this warning by setting the
90+
ECHO Info: environment variable CONDA_SKIP_OPENSSL_DLL_CHECK to any value.^)
8991
) else (
9092
REM Otherwise, we set CONDA_DLL_SEARCH_MODIFICATION_ENABLE and try again.
9193
ECHO Warning: Found outdated libssl/libcrypto DLLs on system;
9294
ECHO Warning: Attempting to re-activate with CONDA_DLL_SEARCH_MODIFICATION_ENABLE
9395
ECHO.
9496
set CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1
95-
REM now we want to re-exec ourselves, but don't have the same environment variables
96-
REM as during bld.bat; so we use some magic, see https://stackoverflow.com/a/3827582
97-
set FOLDER_CONTAINING_THIS_SCRIPT_WITH_TRAILING_BACKSLASH=%~dp0
98-
call %FOLDER_CONTAINING_THIS_SCRIPT_WITH_TRAILING_BACKSLASH%_openssl-syslib-check_activate.bat
99-
REM Check if recursive call errored, and set exit-code accordingly
97+
REM now we want to re-exec ourselves (cf. where activation is installed in bld.bat)
98+
call %PREFIX%\etc\conda\activate.d\_openssl-syslib-check_activate.bat
10099
if %ERRORLEVEL% neq 0 exit /b 1
101100
)
102101
) else (
@@ -110,6 +109,8 @@ if "%LINKED_TO_OUTDATED_SYSLIB%"=="True" (
110109
ECHO Warning: the openssl version of the environment, but be aware that anything
111110
ECHO Warning: *outside* of python that is trying to load libssl/libcrypto will
112111
ECHO Warning: load the DLLs above, which might make that application vulnerable!
112+
ECHO Info: ^(You can silence this warning by setting the environment
113+
ECHO Info: variable CONDA_SKIP_OPENSSL_DLL_CHECK to any value.^)
113114
)
114115
REM Otherwise, even though the system library will be preferred, its version is at least
115116
REM as up-to-date as the one in the conda environment, so no need to spam warnings.

0 commit comments

Comments
 (0)