diff --git a/ChangeLog b/ChangeLog index 90a3f29..67bad0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2016-05-03 17:04:45 +0200 Bernhard Miklautz (f828595) + + * Merge pull request #3282 from akallabeth/input_arg_checks + +2016-05-03 16:27:15 +0200 Bernhard Miklautz (221a292) + + * Merge pull request #3263 from akallabeth/tofu + +2016-05-03 16:19:37 +0200 akallabeth (dd009af) + + * Merge pull request #3314 from bmiklautz/refactoringx + +2016-04-13 09:47:48 +0200 Armin Novak (115f59d) + + * Added argument checks for exported input functions. + +2016-05-03 14:47:53 +0200 Bernhard Miklautz (c52984f) + + * pkg/deb: update the package + +2016-05-03 14:16:11 +0200 Bernhard Miklautz (59fbfdb) + + * Add library libwinpr-tools + +2016-05-03 10:44:42 +0200 Bernhard Miklautz (8cb873b) + + * client/X11: fix build without client interface + 2016-05-02 18:44:40 +0200 Bernhard Miklautz (a7ca42e) * Merge pull request #3313 from bmiklautz/typos @@ -126,6 +154,10 @@ * Fix android rotation crash +2016-03-31 12:16:55 +0200 Armin Novak (5344576) + + * Added command line option /cert-tofu + 2016-03-31 11:43:38 +0200 Bernhard Miklautz (a0d9969) * Merge pull request #3254 from akallabeth/avc444_cmd_arg diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 046078d..82e7f2e 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -56,17 +56,18 @@ set(${MODULE_PREFIX}_SRCS if(WITH_CLIENT_INTERFACE) if(CLIENT_INTERFACE_SHARED) add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS}) + if (WITH_LIBRARY_VERSIONING) + set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) + endif() else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) endif() - if (WITH_LIBRARY_VERSIONING) - set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) - endif() else() - set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} cli/xfreerdp.c cli/xfreerdp.h) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} cli/xfreerdp.c xfreerdp.h) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "xfreerdp") + include_directories(..) endif() set(${MODULE_PREFIX}_LIBS diff --git a/client/X11/cli/CMakeLists.txt b/client/X11/cli/CMakeLists.txt index d90ff71..5f805c2 100644 --- a/client/X11/cli/CMakeLists.txt +++ b/client/X11/cli/CMakeLists.txt @@ -18,8 +18,6 @@ set(MODULE_NAME "xfreerdp-cli") set(MODULE_PREFIX "FREERDP_CLIENT_X11") -include_directories(..) - set(${MODULE_PREFIX}_SRCS xfreerdp.c) diff --git a/client/X11/cli/xfreerdp.c b/client/X11/cli/xfreerdp.c index 22ab3ce..663d49b 100644 --- a/client/X11/cli/xfreerdp.c +++ b/client/X11/cli/xfreerdp.c @@ -29,8 +29,8 @@ #include #include -#include "xf_client.h" -#include "xfreerdp.h" +#include "../xf_client.h" +#include "../xfreerdp.h" int main(int argc, char* argv[]) { diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 3de0d14..bf6639d 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -139,6 +139,7 @@ static COMMAND_LINE_ARGUMENT_A args[] = { "tls-ciphers", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Allowed TLS ciphers" }, { "cert-name", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "certificate name" }, { "cert-ignore", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "ignore certificate" }, + { "cert-tofu", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Automatically accept certificate on first connect" }, { "pcb", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Preconnection Blob" }, { "pcid", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Preconnection Id" }, { "spn-class", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "SPN authentication service class" }, @@ -2220,6 +2221,10 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, { settings->IgnoreCertificate = TRUE; } + CommandLineSwitchCase(arg, "cert-tofu") + { + settings->AutoAcceptCertificate = TRUE; + } CommandLineSwitchCase(arg, "authentication") { settings->Authentication = arg->Value ? TRUE : FALSE; diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index d73d5ec..06e0841 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -635,6 +635,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL; #define FreeRDP_CertificateContent 1416 #define FreeRDP_PrivateKeyContent 1417 #define FreeRDP_RdpKeyContent 1418 +#define FreeRDP_AutoAcceptCertificate 1419 #define FreeRDP_Workarea 1536 #define FreeRDP_Fullscreen 1537 @@ -1056,7 +1057,8 @@ struct rdp_settings ALIGN64 char *CertificateContent; /* 1416 */ ALIGN64 char *PrivateKeyContent; /* 1417 */ ALIGN64 char* RdpKeyContent; /* 1418 */ - UINT64 padding1472[1472 - 1419]; /* 1419 */ + ALIGN64 BOOL AutoAcceptCertificate; /* 1419 */ + UINT64 padding1472[1472 - 1420]; /* 1420 */ UINT64 padding1536[1536 - 1472]; /* 1472 */ /** diff --git a/libfreerdp/common/settings.c b/libfreerdp/common/settings.c index 271569c..228c04c 100644 --- a/libfreerdp/common/settings.c +++ b/libfreerdp/common/settings.c @@ -912,6 +912,9 @@ BOOL freerdp_get_param_bool(rdpSettings* settings, int id) case FreeRDP_IgnoreCertificate: return settings->IgnoreCertificate; + case FreeRDP_AutoAcceptCertificate: + return settings->AutoAcceptCertificate; + case FreeRDP_ExternalCertificateManagement: return settings->ExternalCertificateManagement; @@ -1363,6 +1366,10 @@ int freerdp_set_param_bool(rdpSettings* settings, int id, BOOL param) settings->IgnoreCertificate = param; break; + case FreeRDP_AutoAcceptCertificate: + settings->AutoAcceptCertificate = param; + break; + case FreeRDP_ExternalCertificateManagement: settings->ExternalCertificateManagement = param; break; diff --git a/libfreerdp/core/input.c b/libfreerdp/core/input.c index f52b0dc..d5f40b0 100644 --- a/libfreerdp/core/input.c +++ b/libfreerdp/core/input.c @@ -69,7 +69,12 @@ static void input_write_synchronize_event(wStream* s, UINT32 flags) BOOL input_send_synchronize_event(rdpInput* input, UINT32 flags) { wStream* s; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_SYNC); if (!s) @@ -88,7 +93,12 @@ static void input_write_keyboard_event(wStream* s, UINT16 flags, UINT16 code) BOOL input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { wStream* s; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_SCANCODE); if (!s) @@ -108,7 +118,12 @@ BOOL input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 cod { wStream* s; UINT16 keyboardFlags = 0; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; /* * According to the specification, the slow path Unicode Keyboard Event @@ -138,7 +153,12 @@ void input_write_mouse_event(wStream* s, UINT16 flags, UINT16 x, UINT16 y) BOOL input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { wStream* s; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_MOUSE); if (!s) @@ -157,7 +177,12 @@ static void input_write_extended_mouse_event(wStream* s, UINT16 flags, UINT16 x, BOOL input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { wStream* s; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_MOUSEX); if (!s) @@ -210,7 +235,12 @@ BOOL input_send_keyboard_pause_event(rdpInput* input) BOOL input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags) { wStream* s; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; /* The FastPath Synchronization eventFlags has identical values as SlowPath */ s = fastpath_input_pdu_init(rdp->fastpath, (BYTE) flags, FASTPATH_INPUT_EVENT_SYNC); @@ -223,7 +253,12 @@ BOOL input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 co { wStream* s; BYTE eventFlags = 0; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; eventFlags |= (flags & KBD_FLAGS_RELEASE) ? FASTPATH_INPUT_KBDFLAGS_RELEASE : 0; eventFlags |= (flags & KBD_FLAGS_EXTENDED) ? FASTPATH_INPUT_KBDFLAGS_EXTENDED : 0; @@ -238,7 +273,12 @@ BOOL input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, U { wStream* s; BYTE eventFlags = 0; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; eventFlags |= (flags & KBD_FLAGS_RELEASE) ? FASTPATH_INPUT_KBDFLAGS_RELEASE : 0; s = fastpath_input_pdu_init(rdp->fastpath, eventFlags, FASTPATH_INPUT_EVENT_UNICODE); @@ -251,7 +291,12 @@ BOOL input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, U BOOL input_send_fastpath_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { wStream* s; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; s = fastpath_input_pdu_init(rdp->fastpath, 0, FASTPATH_INPUT_EVENT_MOUSE); if (!s) @@ -263,7 +308,12 @@ BOOL input_send_fastpath_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UI BOOL input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { wStream* s; - rdpRdp* rdp = input->context->rdp; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; s = fastpath_input_pdu_init(rdp->fastpath, 0, FASTPATH_INPUT_EVENT_MOUSEX); if (!s) @@ -275,8 +325,13 @@ BOOL input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 flags, UIN BOOL input_send_fastpath_focus_in_event(rdpInput* input, UINT16 toggleStates) { wStream* s; - rdpRdp* rdp = input->context->rdp; BYTE eventFlags = 0; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; s = fastpath_input_pdu_init_header(rdp->fastpath); if (!s) @@ -305,10 +360,15 @@ BOOL input_send_fastpath_keyboard_pause_event(rdpInput* input) * it sending the following sequence: */ wStream* s; - rdpRdp* rdp = input->context->rdp; const BYTE keyDownEvent = FASTPATH_INPUT_EVENT_SCANCODE << 5; const BYTE keyUpEvent = (FASTPATH_INPUT_EVENT_SCANCODE << 5) | FASTPATH_INPUT_KBDFLAGS_RELEASE; + rdpRdp* rdp; + + if (!input || !input->context) + return FALSE; + + rdp = input->context->rdp; s = fastpath_input_pdu_init_header(rdp->fastpath); if (!s) @@ -479,6 +539,9 @@ BOOL input_recv(rdpInput* input, wStream* s) { UINT16 i, numberEvents; + if (!input || !s) + return FALSE; + if (Stream_GetRemainingLength(s) < 4) return FALSE; @@ -500,7 +563,15 @@ BOOL input_recv(rdpInput* input, wStream* s) BOOL input_register_client_callbacks(rdpInput* input) { - rdpSettings* settings = input->context->settings; + rdpSettings* settings; + + if (!input || !input->context) + return FALSE; + + settings = input->context->settings; + + if (!settings) + return FALSE; if (settings->FastPathInput) { @@ -536,11 +607,17 @@ BOOL input_register_client_callbacks(rdpInput* input) BOOL freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags) { + if (!input) + return FALSE; + return IFCALLRESULT(TRUE, input->SynchronizeEvent, input, flags); } BOOL freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { + if (!input) + return FALSE; + return IFCALLRESULT(TRUE, input->KeyboardEvent, input, flags, code); } @@ -554,31 +631,49 @@ BOOL freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, UINT32 rdp BOOL freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { + if (!input) + return FALSE; + return IFCALLRESULT(TRUE, input->UnicodeKeyboardEvent, input, flags, code); } BOOL freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { + if (!input) + return FALSE; + return IFCALLRESULT(TRUE, input->MouseEvent, input, flags, x, y); } BOOL freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { + if (!input) + return FALSE; + return IFCALLRESULT(TRUE, input->ExtendedMouseEvent, input, flags, x, y); } BOOL freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates) { + if (!input) + return FALSE; + return IFCALLRESULT(TRUE, input->FocusInEvent, input, toggleStates); } BOOL freerdp_input_send_keyboard_pause_event(rdpInput* input) { + if (!input) + return FALSE; + return IFCALLRESULT(TRUE, input->KeyboardPauseEvent, input); } int input_process_events(rdpInput* input) { + if (!input) + return FALSE; + return input_message_queue_process_pending_messages(input); } diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c index ba10e0d..e02577d 100644 --- a/libfreerdp/crypto/tls.c +++ b/libfreerdp/crypto/tls.c @@ -1273,9 +1273,19 @@ int tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname, int por common_name, alt_names, alt_names_count); - if (instance->VerifyCertificate) - accept_certificate = instance->VerifyCertificate(instance, common_name, - subject, issuer, fingerprint, !hostname_match); + /* Automatically accept certificate on first use */ + if (tls->settings->AutoAcceptCertificate) + { + WLog_INFO(TAG, "No certificate stored, automatically accepting."); + accept_certificate = 1; + } + else if (instance->VerifyCertificate) + { + accept_certificate = instance->VerifyCertificate( + instance, common_name, + subject, issuer, + fingerprint, !hostname_match); + } switch(accept_certificate) { diff --git a/packaging/deb/freerdp-nightly/freerdp-nightly-dev.install b/packaging/deb/freerdp-nightly/freerdp-nightly-dev.install index 8d14f4c..11d3295 100644 --- a/packaging/deb/freerdp-nightly/freerdp-nightly-dev.install +++ b/packaging/deb/freerdp-nightly/freerdp-nightly-dev.install @@ -1,4 +1,3 @@ -opt/freerdp-nightly/lib/*.a opt/freerdp-nightly/lib/*.so opt/freerdp-nightly/lib/pkgconfig opt/freerdp-nightly/lib/cmake diff --git a/server/shadow/CMakeLists.txt b/server/shadow/CMakeLists.txt index 73427d8..55597db 100644 --- a/server/shadow/CMakeLists.txt +++ b/server/shadow/CMakeLists.txt @@ -74,7 +74,7 @@ add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) list(APPEND ${MODULE_PREFIX}_LIBS freerdp) list(APPEND ${MODULE_PREFIX}_LIBS freerdp-server) list(APPEND ${MODULE_PREFIX}_LIBS winpr) -list(APPEND ${MODULE_PREFIX}_LIBS winpr-makecert-tool) +list(APPEND ${MODULE_PREFIX}_LIBS winpr-tools) list(APPEND ${MODULE_PREFIX}_LIBS rdtk) target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${${MODULE_PREFIX}_LIBS}) diff --git a/winpr/.gitignore b/winpr/.gitignore index c2fee8d..487041d 100644 --- a/winpr/.gitignore +++ b/winpr/.gitignore @@ -1,2 +1 @@ -tools/hash/winpr-hash tools/reg/winpr-reg diff --git a/winpr/tools/.gitignore b/winpr/tools/.gitignore new file mode 100644 index 0000000..daf1263 --- /dev/null +++ b/winpr/tools/.gitignore @@ -0,0 +1,2 @@ +makecert-cli/winpr-makecert +hash-cli/winpr-hash diff --git a/winpr/tools/CMakeLists.txt b/winpr/tools/CMakeLists.txt index f1aa6f6..f792a9b 100644 --- a/winpr/tools/CMakeLists.txt +++ b/winpr/tools/CMakeLists.txt @@ -2,6 +2,7 @@ # winpr cmake build script # # Copyright 2012 Marc-Andre Moreau +# Copyright 2016 Thincast Technologies GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +16,110 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_subdirectory(hash) +# Soname versioning - use winpr version +set(WINPR_TOOLS_VERSION_MAJOR "${WINPR_VERSION_MAJOR}") +set(WINPR_TOOLS_VERSION_MINOR "${WINPR_VERSION_MINOR}") +set(WINPR_TOOLS_VERSION_REVISION "${WINPR_VERSION_REVISION}") + +set(WINPR_TOOLS_API_VERSION "${WINPR_TOOLS_VERSION_MAJOR}") +set(WINPR_TOOLS_VERSION "${WINPR_TOOLS_VERSION_MAJOR}.${WINPR_TOOLS_VERSION_MINOR}.${WINPR_TOOLS_VERSION_REVISION}") +set(WINPR_TOOLS_VERSION_FULL "${WINPR_TOOLS_VERSION}") +set(WINPR_TOOLS_API_VERSION "${WINPR_TOOLS_VERSION_MAJOR}") + +set(WINPR_TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(WINPR_TOOLS_SRCS "") +set(WINPR_TOOLS_LIBS "") +set(WINPR_TOOLS_INCLUDES "") +set(WINPR_TOOLS_DEFINITIONS "") + +macro (winpr_tools_module_add) + file (RELATIVE_PATH _relPath "${WINPR_TOOLS_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach (_src ${ARGN}) + if (_relPath) + list (APPEND WINPR_TOOLS_SRCS "${_relPath}/${_src}") + else() + list (APPEND WINPR_TOOLS_SRCS "${_src}") + endif() + endforeach() + if (_relPath) + set (WINPR_TOOLS_SRCS ${WINPR_TOOLS_SRCS} PARENT_SCOPE) + endif() +endmacro() + +macro (winpr_tools_include_directory_add) + file (RELATIVE_PATH _relPath "${WINPR_TOOLS_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach (_inc ${ARGN}) + if (IS_ABSOLUTE ${_inc}) + list (APPEND WINPR_TOOLS_INCLUDES "${_inc}") + else() + if (_relPath) + list (APPEND WINPR_TOOLS_INCLUDES "${_relPath}/${_inc}") + else() + list (APPEND WINPR_TOOLS_INCLUDES "${_inc}") + endif() + endif() + endforeach() + if (_relPath) + set (WINPR_TOOLS_INCLUDES ${WINPR_TOOLS_INCLUDES} PARENT_SCOPE) + endif() +endmacro() + +macro (winpr_tools_library_add) + foreach (_lib ${ARGN}) + list (APPEND WINPR_TOOLS_LIBS "${_lib}") + endforeach() + set (WINPR_TOOLS_LIBS ${WINPR_TOOLS_LIBS} PARENT_SCOPE) +endmacro() + +macro (winpr_tools_definition_add) + foreach (_define ${ARGN}) + list (APPEND WINPR_TOOLS_DEFINITONS "${_define}") + endforeach() + set (WINPR_TOOLS_DEFINITONS ${WINPR_TOOLS_DEFINITONS} PARENT_SCOPE) +endmacro() + add_subdirectory(makecert) +set(MODULE_NAME winpr-tools) +list(REMOVE_DUPLICATES WINPR_TOOLS_DEFINITIONS) +list(REMOVE_DUPLICATES WINPR_TOOLS_LIBS) +list(REMOVE_DUPLICATES WINPR_TOOLS_INCLUDES) +include_directories(${WINPR_TOOLS_INCLUDES}) + +# On windows create dll version information. +# Vendor, product and year are already set in top level CMakeLists.txt +if (WIN32) + set (RC_VERSION_MAJOR ${WINPR_VERSION_MAJOR}) + set (RC_VERSION_MINOR ${WINPR_VERSION_MINOR}) + set (RC_VERSION_BUILD ${WINPR_VERSION_REVISION}) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + + configure_file( + ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/version.rc + @ONLY) + + set (WINPR_TOOLS_SRCS ${WINPR_TOOLS_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) +endif() + +add_library(${MODULE_NAME} ${WINPR_TOOLS_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) +if (WITH_LIBRARY_VERSIONING) + set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_TOOLS_VERSION} SOVERSION ${WINPR_TOOLS_API_VERSION}) +endif() + +add_definitions(${WINPR_DEFINITIONS}) +target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${WINPR_TOOLS_LIBS}) + +install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT WinPRTargets) +if (WITH_DEBUG_SYMBOLS AND MSVC AND BUILD_SHARED_LIBS) + install(FILES ${CMAKE_PDB_BINARY_DIR}/${MODULE_NAME}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols) +endif() +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Tools") + +# Add all command line utilities +add_subdirectory(makecert-cli) +add_subdirectory(hash-cli) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr-tools.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) diff --git a/winpr/tools/hash/CMakeLists.txt b/winpr/tools/hash-cli/CMakeLists.txt similarity index 100% rename from winpr/tools/hash/CMakeLists.txt rename to winpr/tools/hash-cli/CMakeLists.txt diff --git a/winpr/tools/hash/hash.c b/winpr/tools/hash-cli/hash.c similarity index 100% rename from winpr/tools/hash/hash.c rename to winpr/tools/hash-cli/hash.c diff --git a/winpr/tools/makecert/cli/CMakeLists.txt b/winpr/tools/makecert-cli/CMakeLists.txt similarity index 95% rename from winpr/tools/makecert/cli/CMakeLists.txt rename to winpr/tools/makecert-cli/CMakeLists.txt index f175e72..afc17da 100644 --- a/winpr/tools/makecert/cli/CMakeLists.txt +++ b/winpr/tools/makecert-cli/CMakeLists.txt @@ -2,6 +2,7 @@ # winpr-makecert cmake build script # # Copyright 2012 Marc-Andre Moreau +# Copyright 2016 Thincast Technologies GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,8 +19,6 @@ set(MODULE_NAME "winpr-makecert") set(MODULE_PREFIX "WINPR_MAKECERT") -include_directories(..) - set(${MODULE_PREFIX}_SRCS main.c) @@ -41,7 +40,7 @@ endif() add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -set(${MODULE_PREFIX}_LIBS winpr-makecert-tool) +set(${MODULE_PREFIX}_LIBS winpr-tools) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) @@ -51,4 +50,3 @@ install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT too if (WITH_DEBUG_SYMBOLS AND MSVC) install(FILES ${CMAKE_PDB_BINARY_DIR}/${MODULE_NAME}.pdb DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT symbols) endif() - diff --git a/winpr/tools/makecert/cli/main.c b/winpr/tools/makecert-cli/main.c similarity index 100% rename from winpr/tools/makecert/cli/main.c rename to winpr/tools/makecert-cli/main.c diff --git a/winpr/tools/makecert/.gitignore b/winpr/tools/makecert/.gitignore index e46d9e9..275ece2 100644 --- a/winpr/tools/makecert/.gitignore +++ b/winpr/tools/makecert/.gitignore @@ -1,4 +1,2 @@ -winpr-makecert *.key *.crt - diff --git a/winpr/tools/makecert/CMakeLists.txt b/winpr/tools/makecert/CMakeLists.txt index 3e021e0..89f7af9 100644 --- a/winpr/tools/makecert/CMakeLists.txt +++ b/winpr/tools/makecert/CMakeLists.txt @@ -21,16 +21,15 @@ set(MODULE_PREFIX "WINPR_MAKECERT_TOOL") set(${MODULE_PREFIX}_SRCS makecert.c) if(OPENSSL_FOUND) - include_directories(${OPENSSL_INCLUDE_DIR}) + winpr_tools_include_directory_add(${OPENSSL_INCLUDE_DIR}) endif() if(MBEDTLS_FOUND) - include_directories(${MBEDTLS_INCLUDE_DIR}) + winpr_tools_include_directory_add(${MBEDTLS_INCLUDE_DIR}) endif() -add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) -set(${MODULE_PREFIX}_LIBS winpr) +winpr_tools_module_add(${${MODULE_PREFIX}_SRCS}) if(OPENSSL_FOUND) if(WIN32) @@ -46,11 +45,5 @@ if(MBEDTLS_FOUND) list(APPEND ${MODULE_PREFIX}_LIBS ${MBEDTLS_LIBRARIES}) endif() -target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) -install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT WinPRTargets) - -add_subdirectory(cli) - -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Tools") -export_complex_library(LIBNAME ${MODULE_NAME}) +winpr_tools_library_add(${${MODULE_PREFIX}_LIBS} winpr) diff --git a/winpr/tools/winpr-tools.pc.in b/winpr/tools/winpr-tools.pc.in new file mode 100644 index 0000000..cd05c9a --- /dev/null +++ b/winpr/tools/winpr-tools.pc.in @@ -0,0 +1,15 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=${prefix}/@WINPR_INCLUDE_DIR@ +libs=-lwinpr-tools + +Name: WinPR +Description: WinPR: Windows Portable Runtime +URL: http://www.freerdp.com/ +Version: @WINPR_TOOLS_VERSION@ +Requires: +Requires.private: winpr@WINPR_VERSION_MAJOR@ libssl +Libs: -L${libdir} ${libs} +Libs.private: -lcrypto +Cflags: -I${includedir}