URL profile import: disable profile download in case of certificate errors

Allow users to bypass HTTPS is not good, but may nevertheless be useful during development.

DEBUG macro is widely used in openvpn-gui code but was missing from CMakeLists.txt, so add it there.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
pull/446/head
Lev Stipakov 2021-08-23 16:00:56 +03:00 committed by Selva Nair
parent e3b06efcd2
commit 82d932a503
2 changed files with 4 additions and 1 deletions

View File

@ -28,6 +28,8 @@ add_executable(${PROJECT_NAME} WIN32
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
OpenSSL::SSL OpenSSL::SSL
Wtsapi32.lib Wtsapi32.lib

3
as.c
View File

@ -336,6 +336,7 @@ again:
/* handle cert errors */ /* handle cert errors */
/* https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/182888 */ /* https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/182888 */
if (!HttpSendRequestW(hRequest, NULL, 0, NULL, 0)) { if (!HttpSendRequestW(hRequest, NULL, 0, NULL, 0)) {
#ifdef DEBUG
DWORD err = GetLastError(); DWORD err = GetLastError();
if ((err == ERROR_INTERNET_INVALID_CA) || if ((err == ERROR_INTERNET_INVALID_CA) ||
(err == ERROR_INTERNET_SEC_CERT_CN_INVALID) || (err == ERROR_INTERNET_SEC_CERT_CN_INVALID) ||
@ -369,7 +370,7 @@ again:
else else
goto done; goto done;
} }
#endif
ShowWinInetError(hWnd); ShowWinInetError(hWnd);
goto done; goto done;
} }