[winpr,schannel] add compile option WITH_DEBUG_SCHANNEL

This commit is contained in:
Armin Novak 2023-04-24 15:25:57 +02:00 committed by Martin Fleisz
parent 55a8695cfe
commit f8ac8f1773
2 changed files with 8 additions and 1 deletions

View File

@ -60,6 +60,11 @@ if (NOT WIN32 AND NOT ANDROID AND NOT IOS AND NOT APPLE)
set(KRB5_DEFAULT ON) set(KRB5_DEFAULT ON)
endif() endif()
option(WITH_DEBUG_SCHANNEL "Compile support for SCHANNEL debug" OFF)
if (WITH_DEBUG_SCHANNEL)
winpr_definition_add("-DWITH_DEBUG_SCHANNEL")
endif()
option(WITH_KRB5 "Compile support for kerberos authentication." ${KRB5_DEFAULT}) option(WITH_KRB5 "Compile support for kerberos authentication." ${KRB5_DEFAULT})
if (WITH_KRB5) if (WITH_KRB5)
find_package(KRB5 REQUIRED) find_package(KRB5 REQUIRED)

View File

@ -194,7 +194,7 @@ out_ssl_new_failed:
int schannel_openssl_server_init(SCHANNEL_OPENSSL* context) int schannel_openssl_server_init(SCHANNEL_OPENSSL* context)
{ {
int status; int status;
long options = 0; unsigned long options = 0;
context->ctx = SSL_CTX_new(SSLv23_server_method()); context->ctx = SSL_CTX_new(SSLv23_server_method());
if (!context->ctx) if (!context->ctx)
@ -238,11 +238,13 @@ int schannel_openssl_server_init(SCHANNEL_OPENSSL* context)
options |= SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS; options |= SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
SSL_CTX_set_options(context->ctx, options); SSL_CTX_set_options(context->ctx, options);
#if defined(WITH_DEBUG_SCHANNEL)
if (SSL_CTX_use_RSAPrivateKey_file(context->ctx, "/tmp/localhost.key", SSL_FILETYPE_PEM) <= 0) if (SSL_CTX_use_RSAPrivateKey_file(context->ctx, "/tmp/localhost.key", SSL_FILETYPE_PEM) <= 0)
{ {
WLog_ERR(TAG, "SSL_CTX_use_RSAPrivateKey_file failed"); WLog_ERR(TAG, "SSL_CTX_use_RSAPrivateKey_file failed");
goto out_rsa_key; goto out_rsa_key;
} }
#endif
context->ssl = SSL_new(context->ctx); context->ssl = SSL_new(context->ctx);