diff --git a/CMakeLists.txt b/CMakeLists.txt index 17873e5eb..0b33edc0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,10 @@ check_include_files(netdb.h HAVE_NETDB_H) check_include_files(fcntl.h HAVE_FCNTL_H) check_include_files(unistd.h HAVE_UNISTD_H) +# Libraries that we have a hard dependency on +find_package(OpenSSL REQUIRED) +find_package(ZLIB REQUIRED) + # Endian test_big_endian(BIG_ENDIAN) diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake index 44b0624ec..35ce59554 100644 --- a/cmake/ConfigOptions.cmake +++ b/cmake/ConfigOptions.cmake @@ -1,4 +1,10 @@ -option(WITH_DEBUG_TRANSPORT "Print transport debug message." OFF) -option(WITH_DEBUG_CHANMAN "Print channel manager debug message." OFF) -option(WITH_DEBUG_SVC "Print static virtual channel debug message." OFF) -option(WITH_DEBUG_DVC "Print dynamic virtual channel debug message." OFF) +option(WITH_DEBUG_TRANSPORT "Print transport debug messages." OFF) +option(WITH_DEBUG_CHANMAN "Print channel manager debug messages." OFF) +option(WITH_DEBUG_SVC "Print static virtual channel debug messages." OFF) +option(WITH_DEBUG_DVC "Print dynamic virtual channel debug messages." OFF) +option(WITH_DEBUG_KBD "Print keyboard related debug messages." OFF) +option(WITH_DEBUG_NLA "Print authentication related debug messages." OFF) +option(WITH_DEBUG_NEGO "Print negotiation related debug messages." OFF) +option(WITH_DEBUG_CERTIFICATE "Print certificate related debug messages." OFF) +option(WITH_DEBUG_LICENSE "Print license debug messages." OFF) +option(WITH_DEBUG_GDI "Print graphics debug messages." OFF) diff --git a/config.h.in b/config.h.in index 2051c47c0..164a42a03 100644 --- a/config.h.in +++ b/config.h.in @@ -18,5 +18,12 @@ #cmakedefine WITH_DEBUG_CHANMAN #cmakedefine WITH_DEBUG_SVC #cmakedefine WITH_DEBUG_DVC +#cmakedefine WITH_DEBUG_KBD +#cmakedefine WITH_DEBUG_NLA +#cmakedefine WITH_DEBUG_NEGO +#cmakedefine WITH_DEBUG_CERTIFICATE +#cmakedefine WITH_DEBUG_LICENSE +#cmakedefine WITH_DEBUG_GDI +#cmakedefine WITH_DEBUG_ASSERT #endif diff --git a/cunit/test_libgdi.c b/cunit/test_libgdi.c index 3a56200b9..96a0e439d 100644 --- a/cunit/test_libgdi.c +++ b/cunit/test_libgdi.c @@ -33,6 +33,7 @@ #include "gdi_palette.h" #include "gdi_drawing.h" #include "gdi_clipping.h" +#include "gdi_32bpp.h" #include "test_libgdi.h" diff --git a/include/freerdp/utils/debug.h b/include/freerdp/utils/debug.h index c59efafe7..55fc2895e 100644 --- a/include/freerdp/utils/debug.h +++ b/include/freerdp/utils/debug.h @@ -22,13 +22,6 @@ #include "config.h" -#ifdef WITH_DEBUG_ASSERT -#include -#define ASSERT(a) assert(a) -#else -#define ASSERT(a) do { } while (0) -#endif - #include #define DEBUG_NULL(fmt, ...) do { } while (0) diff --git a/libfreerdp-core/CMakeLists.txt b/libfreerdp-core/CMakeLists.txt index 3608d4e8c..a49584ded 100644 --- a/libfreerdp-core/CMakeLists.txt +++ b/libfreerdp-core/CMakeLists.txt @@ -18,6 +18,8 @@ # limitations under the License. add_definitions(-DEXT_PATH="/usr/lib/freerdp/extensions") +include_directories(${OPENSSL_INCLUDE_DIR}) +include_directories(${ZLIB_INCLUDE_DIRS}) set(LIBFREERDP_CORE_SRCS activation.c @@ -80,9 +82,8 @@ set(LIBFREERDP_CORE_SRCS add_library(freerdp-core SHARED ${LIBFREERDP_CORE_SRCS}) -target_link_libraries(freerdp-core z) -target_link_libraries(freerdp-core ssl) -target_link_libraries(freerdp-core crypto) +target_link_libraries(freerdp-core ${ZLIB_LIBRARIES}) +target_link_libraries(freerdp-core ${OPENSSL_LIBRARIES}) target_link_libraries(freerdp-core freerdp-utils) install(TARGETS freerdp-core DESTINATION lib) diff --git a/libfreerdp-core/certificate.h b/libfreerdp-core/certificate.h index 41ed770d7..df47e4748 100644 --- a/libfreerdp-core/certificate.h +++ b/libfreerdp-core/certificate.h @@ -74,8 +74,6 @@ void certificate_read_server_certificate(rdpCertificate* certificate, uint8* ser rdpCertificate* certificate_new(rdpRdp* rdp); void certificate_free(rdpCertificate* certificate); -//#define WITH_DEBUG_CERTIFICATE 1 - #ifdef WITH_DEBUG_CERTIFICATE #define DEBUG_CERTIFICATE(fmt, ...) DEBUG_CLASS(CERTIFICATE, fmt, ## __VA_ARGS__) #else diff --git a/libfreerdp-core/connection.c b/libfreerdp-core/connection.c index e8934077f..4a0d9490b 100644 --- a/libfreerdp-core/connection.c +++ b/libfreerdp-core/connection.c @@ -63,7 +63,9 @@ boolean rdp_client_connect(rdpRdp* rdp) nego_init(rdp->nego); nego_set_target(rdp->nego, rdp->settings->hostname, 3389); nego_set_cookie(rdp->nego, rdp->settings->username); - nego_set_protocols(rdp->nego, 1, 1, 1); + nego_enable_rdp(rdp->nego, rdp->settings->rdp_security); + nego_enable_nla(rdp->nego, rdp->settings->nla_security); + nego_enable_tls(rdp->nego, rdp->settings->tls_security); if (nego_connect(rdp->nego) != True) { diff --git a/libfreerdp-core/license.h b/libfreerdp-core/license.h index 16d164db5..bdea85c84 100644 --- a/libfreerdp-core/license.h +++ b/libfreerdp-core/license.h @@ -196,8 +196,6 @@ void license_send_platform_challenge_response_packet(rdpLicense* license); rdpLicense* license_new(rdpRdp* rdp); void license_free(rdpLicense* license); -#define WITH_DEBUG_LICENSE 1 - #ifdef WITH_DEBUG_LICENSE #define DEBUG_LICENSE(fmt, ...) DEBUG_CLASS(LICENSE, fmt, ## __VA_ARGS__) #else diff --git a/libfreerdp-core/nego.c b/libfreerdp-core/nego.c index f94748c72..5ef36f892 100644 --- a/libfreerdp-core/nego.c +++ b/libfreerdp-core/nego.c @@ -443,18 +443,39 @@ void nego_set_target(rdpNego* nego, char* hostname, int port) } /** - * Set enabled security protocols. - * @param nego - * @param rdp - * @param tls - * @param nla + * Enable RDP security protocol. + * @param nego pointer to the negotiation structure + * @param enable_rdp whether to enable normal RDP protocol (True for enabled, False for disabled) */ -void nego_set_protocols(rdpNego* nego, int rdp, int tls, int nla) +void nego_enable_rdp(rdpNego* nego, boolean enable_rdp) { - nego->enabled_protocols[PROTOCOL_RDP] = rdp; - nego->enabled_protocols[PROTOCOL_TLS] = tls; - nego->enabled_protocols[PROTOCOL_NLA] = nla; + DEBUG_NEGO("Enabling RDP security: %s", enable_rdp ? "True" : "False"); + nego->enabled_protocols[PROTOCOL_RDP] = enable_rdp; +} + +/** + * Enable TLS security protocol. + * @param nego pointer to the negotiation structure + * @param enable_tls whether to enable TLS + RDP protocol (True for enabled, False for disabled) + */ +void nego_enable_tls(rdpNego* nego, boolean enable_tls) +{ + DEBUG_NEGO("Enabling TLS security: %s", enable_tls ? "True" : "False"); + nego->enabled_protocols[PROTOCOL_TLS] = enable_tls; +} + + +/** + * Enable NLA security protocol. + * @param nego pointer to the negotiation structure + * @param enable_nla whether to enable network level authentication protocol (True for enabled, False for disabled) + */ + +void nego_enable_nla(rdpNego* nego, boolean enable_nla) +{ + DEBUG_NEGO("Enabling NLA security: %s", enable_nla ? "True" : "False"); + nego->enabled_protocols[PROTOCOL_NLA] = enable_nla; } /** diff --git a/libfreerdp-core/nego.h b/libfreerdp-core/nego.h index 9eb6a7532..fcafbd0d0 100644 --- a/libfreerdp-core/nego.h +++ b/libfreerdp-core/nego.h @@ -101,7 +101,9 @@ rdpNego* nego_new(struct rdp_transport * transport); void nego_free(rdpNego* nego); void nego_init(rdpNego* nego); void nego_set_target(rdpNego* nego, char* hostname, int port); -void nego_set_protocols(rdpNego* nego, int rdp, int tls, int nla); +void nego_enable_rdp(rdpNego* nego, boolean enable_rdp); +void nego_enable_nla(rdpNego* nego, boolean enable_nla); +void nego_enable_tls(rdpNego* nego, boolean enable_tls); void nego_set_routing_token(rdpNego* nego, char* routing_token); void nego_set_cookie(rdpNego* nego, char* cookie); diff --git a/libfreerdp-core/settings.c b/libfreerdp-core/settings.c index 2da6b3da7..feeba5028 100644 --- a/libfreerdp-core/settings.c +++ b/libfreerdp-core/settings.c @@ -41,9 +41,9 @@ rdpSettings* settings_new() settings->height = 768; settings->rdp_version = 7; settings->color_depth = 16; - settings->nla_security = 1; - settings->tls_security = 1; - settings->rdp_security = 1; + settings->nla_security = True; + settings->tls_security = True; + settings->rdp_security = True; settings->client_build = 2600; settings->kbd_type = 0; settings->kbd_subtype = 0; diff --git a/libfreerdp-kbd/libkbd.c b/libfreerdp-kbd/libkbd.c index 86d9c0847..679700832 100644 --- a/libfreerdp-kbd/libkbd.c +++ b/libfreerdp-kbd/libkbd.c @@ -24,13 +24,13 @@ #include #include +#include "libkbd.h" + #include "locales.h" #include "layout_ids.h" #include "layouts_xkb.h" #include "keyboard.h" -#include "libkbd.h" - /* * The actual mapping from X keycodes to RDP keycodes, initialized from xkb keycodes or similar. * Used directly by freerdp_kbd_get_scancode_by_keycode. The mapping is a global variable, diff --git a/libfreerdp-utils/CMakeLists.txt b/libfreerdp-utils/CMakeLists.txt index d1c08a159..23e5e6352 100644 --- a/libfreerdp-utils/CMakeLists.txt +++ b/libfreerdp-utils/CMakeLists.txt @@ -17,6 +17,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(CMAKE_THREAD_PREFER_PTHREAD) +find_package(Threads REQUIRED) + set(FREERDP_UTILS_SRCS args.c blob.c @@ -37,6 +40,6 @@ add_library(freerdp-utils SHARED ${FREERDP_UTILS_SRCS}) set_target_properties(freerdp-utils PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION}) -target_link_libraries(freerdp-utils pthread) +target_link_libraries(freerdp-utils ${CMAKE_THREAD_LIBS_INIT}) install(TARGETS freerdp-utils DESTINATION lib) diff --git a/libfreerdp-utils/args.c b/libfreerdp-utils/args.c index 0a51fbc47..b76f4c0d4 100644 --- a/libfreerdp-utils/args.c +++ b/libfreerdp-utils/args.c @@ -227,15 +227,15 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("--no-rdp", argv[index]) == 0) { - settings->rdp_security = 0; + settings->rdp_security = False; } else if (strcmp("--no-tls", argv[index]) == 0) { - settings->tls_security = 0; + settings->tls_security = False; } else if (strcmp("--no-nla", argv[index]) == 0) { - settings->nla_security = 0; + settings->nla_security = False; } else if (strcmp("--sec", argv[index]) == 0) { @@ -247,21 +247,21 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } if (strncmp("rdp", argv[index], 1) == 0) /* Standard RDP */ { - settings->rdp_security = 1; - settings->tls_security = 0; - settings->nla_security = 0; + settings->rdp_security = True; + settings->tls_security = False; + settings->nla_security = False; } else if (strncmp("tls", argv[index], 1) == 0) /* TLS */ { - settings->rdp_security = 0; - settings->tls_security = 1; - settings->nla_security = 0; + settings->rdp_security = False; + settings->tls_security = True; + settings->nla_security = False; } else if (strncmp("nla", argv[index], 1) == 0) /* NLA */ { - settings->rdp_security = 0; - settings->tls_security = 0; - settings->nla_security = 1; + settings->rdp_security = False; + settings->tls_security = False; + settings->nla_security = True; } else {