diff --git a/CMakeLists.txt b/CMakeLists.txt index c4334f5de..654aa5e26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,7 @@ include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) include(GNUInstallDirsWrapper) include(CMakePackageConfigHelpers) +include(InstallFreeRDPMan) # Soname versioning set(BUILD_NUMBER 0) diff --git a/client/.gitignore b/client/.gitignore index 9ad5b74c0..574a1de7b 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -10,3 +10,4 @@ !/Wayland !/CMakeLists.txt !*.in +Wayland/wlfreerdp.1 diff --git a/client/Wayland/CMakeLists.txt b/client/Wayland/CMakeLists.txt index 1b81d2e97..bc66f2843 100644 --- a/client/Wayland/CMakeLists.txt +++ b/client/Wayland/CMakeLists.txt @@ -39,3 +39,5 @@ target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Wayland") +configure_file(wlfreerdp.1.in ${CMAKE_CURRENT_BINARY_DIR}/wlfreerdp.1) +install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/wlfreerdp.1 1) diff --git a/client/Wayland/wlfreerdp.1.in b/client/Wayland/wlfreerdp.1.in new file mode 100644 index 000000000..d576a096a --- /dev/null +++ b/client/Wayland/wlfreerdp.1.in @@ -0,0 +1,38 @@ +.de URL +\\$2 \(laURL: \\$1 \(ra\\$3 +.. +.if \n[.g] .mso www.tmac)) +.TH wlfreerdp 1 2017-01-12 "@FREERDP_VERSION_FULL@" "FreeRDP" +.SH NAME +wlfreerdp \- FreeRDP wayland client +.SH SYNOPSIS +.B wlfreerdp +[file] +[\fIdefault_client_options\fP] +[\fB/v\fP:[:port]] +[\fB/version\fP] +[\fB/help\fP] +.SH DESCRIPTION +.B wlfreerdp +is a wayland Remote Desktop Protocol (RDP) client which is part of the FreeRDP project. A RDP server is built-in to many editions of Windows. Alternative servers included xrdp and VRDP (VirtualBox). +.SH OPTIONS +The wayland client also supports a lot of the \fIdefault client options\fP which are not described here. For details on those see the xfreerdp(1) man page. +.IP \fB/v:\fP\fI[:port]\fP +The server hostname or IP, and optionally the port, to connect to. +.IP /version +Print the version and exit. +.IP /help +Print the help and exit. +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B not 0 +On failure. + +.SH SEE ALSO +xfreerdp(1) wlog(7) + +.SH AUTHOR +FreeRDP diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 3bd5b0a5f..bde78f759 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -111,11 +111,7 @@ if(WITH_MANPAGES) add_custom_target(xfreerdp.manpage ALL DEPENDS xfreerdp.1) - if(OPENBSD) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1 DESTINATION man/man1) - else() - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1 DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/man/man1) - endif() + install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1 1) else() message(WARNING "WITH_MANPAGES was set, but xsltproc was not found. man-pages will not be installed") endif() diff --git a/client/common/CMakeLists.txt b/client/common/CMakeLists.txt index bf4480942..e4691ab4d 100644 --- a/client/common/CMakeLists.txt +++ b/client/common/CMakeLists.txt @@ -57,6 +57,7 @@ endif() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_API_VERSION}) include_directories(${OPENSSL_INCLUDE_DIR}) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 89723dc5f..476e445d7 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -179,8 +179,8 @@ static COMMAND_LINE_ARGUMENT_A args[] = { "encryption-methods", COMMAND_LINE_VALUE_REQUIRED, "<40,56,128,FIPS>", NULL, NULL, -1, NULL, "RDP standard security encryption methods" }, { "from-stdin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Read credentials from stdin, do not use defaults." }, { "buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG, NULL, NULL, NULL, -1, NULL, "print the build configuration" }, - { "log-level", COMMAND_LINE_VALUE_REQUIRED, "[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]", NULL, NULL, -1, NULL, "Set the default log level, see wLog(1) for details" }, - { "log-filters", COMMAND_LINE_VALUE_REQUIRED, ":[, :][, ...]]", NULL, NULL, -1, NULL, "Set logger filters, see wLog(1) for details" }, + { "log-level", COMMAND_LINE_VALUE_REQUIRED, "[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]", NULL, NULL, -1, NULL, "Set the default log level, see wLog(7) for details" }, + { "log-filters", COMMAND_LINE_VALUE_REQUIRED, ":[, :][, ...]]", NULL, NULL, -1, NULL, "Set logger filters, see wLog(7) for details" }, { "pwidth", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Physical width of display (in millimeters)" }, { "pheight", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Physical height of display (in millimeters)" }, { "orientation", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Orientation of display in degrees (0, 90, 180, 270)" }, diff --git a/client/freerdp-client.pc.in b/client/freerdp-client.pc.in index 54d40c5ff..92b334674 100644 --- a/client/freerdp-client.pc.in +++ b/client/freerdp-client.pc.in @@ -2,7 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/@FREERDP_INCLUDE_DIR@ -libs=-lfreerdp-client +libs=-lfreerdp-client@FREERDP_API_VERSION@ Name: FreeRDP client Description: FreeRDP: A Remote Desktop Protocol Implementation diff --git a/cmake/InstallFreeRDPMan.cmake b/cmake/InstallFreeRDPMan.cmake new file mode 100644 index 000000000..8190ea126 --- /dev/null +++ b/cmake/InstallFreeRDPMan.cmake @@ -0,0 +1,9 @@ +function(install_freerdp_man manpage section) + if(WITH_MANPAGES) + if(OPENBSD) + install(FILES ${manpage} DESTINATION man/man${section}) + else() + install(FILES ${manpage} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/man/man${section}) + endif() + endif() +endfunction() diff --git a/libfreerdp/CMakeLists.txt b/libfreerdp/CMakeLists.txt index 82c7ec3e5..ae6e6d3f2 100644 --- a/libfreerdp/CMakeLists.txt +++ b/libfreerdp/CMakeLists.txt @@ -291,6 +291,7 @@ add_library(${MODULE_NAME} ${LIBFREERDP_SRCS}) add_definitions(${LIBFREERDP_DEFINITIONS}) set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) +set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_VERSION_MAJOR}) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) diff --git a/libfreerdp/freerdp.pc.in b/libfreerdp/freerdp.pc.in index 456b284fd..a5d5c8bde 100644 --- a/libfreerdp/freerdp.pc.in +++ b/libfreerdp/freerdp.pc.in @@ -2,7 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/@FREERDP_INCLUDE_DIR@ -libs=-lfreerdp +libs=-lfreerdp@FREERDP_API_VERSION@ Name: FreeRDP Description: FreeRDP: A Remote Desktop Protocol Implementation diff --git a/libfreerdp/utils/signal.c b/libfreerdp/utils/signal.c index 66f5d0fbd..d8714a29f 100644 --- a/libfreerdp/utils/signal.c +++ b/libfreerdp/utils/signal.c @@ -109,7 +109,7 @@ int freerdp_handle_signals(void) sigset_t orig_set; struct sigaction orig_sigaction; struct sigaction fatal_sigaction; - WLog_INFO(TAG, "Registering signal hook..."); + WLog_DBG(TAG, "Registering signal hook..."); sigfillset(&(fatal_sigaction.sa_mask)); sigdelset(&(fatal_sigaction.sa_mask), SIGCONT); pthread_sigmask(SIG_BLOCK, &(fatal_sigaction.sa_mask), &orig_set); diff --git a/packaging/deb/freerdp-nightly/freerdp-nightly.install b/packaging/deb/freerdp-nightly/freerdp-nightly.install index b12d909a4..cd909794f 100644 --- a/packaging/deb/freerdp-nightly/freerdp-nightly.install +++ b/packaging/deb/freerdp-nightly/freerdp-nightly.install @@ -1,4 +1,8 @@ opt/freerdp-nightly/lib/*.so.* opt/freerdp-nightly/bin +opt/freerdp-master/share/man/man1/freerdp-shadow-cli.1* +opt/freerdp-master/share/man/man1/winpr-makecert.1* +opt/freerdp-master/share/man/man1/winpr-hash.1* +opt/freerdp-master/share/man/man1/wlfreerdp.1* opt/freerdp-nightly/share/man/man1/xfreerdp.1* opt/freerdp-nightly/share/man/man7/wlog.7* diff --git a/packaging/rpm/freerdp-nightly.spec b/packaging/rpm/freerdp-nightly.spec index 210197195..1cb3583d1 100644 --- a/packaging/rpm/freerdp-nightly.spec +++ b/packaging/rpm/freerdp-nightly.spec @@ -139,6 +139,10 @@ export NO_BRP_CHECK_RPATH true %{INSTALL_PREFIX}/%{_lib}/*.so.* %{INSTALL_PREFIX}/bin/ %{INSTALL_PREFIX}/share/man/man1/xfreerdp.1* +%{INSTALL_PREFIX}/share/man/man1/freerdp-shadow-cli.1* +%{INSTALL_PREFIX}/share/man/man1/winpr-makecert.1* +%{INSTALL_PREFIX}/share/man/man1/winpr-hash.1* +%{INSTALL_PREFIX}/share/man/man1/wlfreerdp.1* %{INSTALL_PREFIX}/share/man/man7/wlog.7* %files devel diff --git a/server/common/CMakeLists.txt b/server/common/CMakeLists.txt index 009d5662a..1580eb84f 100644 --- a/server/common/CMakeLists.txt +++ b/server/common/CMakeLists.txt @@ -54,6 +54,7 @@ if (WIN32) endif() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_API_VERSION}) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) diff --git a/server/freerdp-server.pc.in b/server/freerdp-server.pc.in index f9ef4c345..8d5fb4dbf 100644 --- a/server/freerdp-server.pc.in +++ b/server/freerdp-server.pc.in @@ -2,7 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/@FREERDP_INCLUDE_DIR@ -libs=-lfreerdp-server +libs=-lfreerdp-server@FREERDP_API_VERSION@ Name: FreeRDP server Description: FreeRDP: A Remote Desktop Protocol Implementation diff --git a/server/shadow/.gitignore b/server/shadow/.gitignore index d21ea72ef..7bef23da0 100644 --- a/server/shadow/.gitignore +++ b/server/shadow/.gitignore @@ -1,2 +1,2 @@ freerdp-shadow-cli - +freerdp-shadow-cli.1 diff --git a/server/shadow/CMakeLists.txt b/server/shadow/CMakeLists.txt index 8e4e8e119..e8bfdf71a 100644 --- a/server/shadow/CMakeLists.txt +++ b/server/shadow/CMakeLists.txt @@ -81,6 +81,7 @@ list(APPEND ${MODULE_PREFIX}_LIBS rdtk) target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${${MODULE_PREFIX}_LIBS}) +set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_VERSION_MAJOR}) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) endif() @@ -284,6 +285,7 @@ set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-shadow freerdp winpr) target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${${MODULE_PREFIX}_LIBS}) +set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_API_VERSION}) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) endif() @@ -336,6 +338,9 @@ endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-shadow.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc @ONLY) +configure_file(freerdp-shadow-cli.1.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow-cli.1) +install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow-cli.1 1) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) if(${CMAKE_VERSION} VERSION_GREATER "2.8.10") diff --git a/server/shadow/freerdp-shadow-cli.1.in b/server/shadow/freerdp-shadow-cli.1.in new file mode 100644 index 000000000..97cef815f --- /dev/null +++ b/server/shadow/freerdp-shadow-cli.1.in @@ -0,0 +1,85 @@ +.de URL +\\$2 \(laURL: \\$1 \(ra\\$3 +.. +.if \n[.g] .mso www.tmac)) +.TH freerdp\-shadow\-cli 1 2017-01-12 "@FREERDP_VERSION_FULL@" "FreeRDP" +.SH NAME +freerdp\-shadow\-cli \- A utility for sharing a X display via RDP. +.SH SYNOPSIS +.B freerdp\-shadow\-cli +[\fB/port:\fP\fI\fP] +[\fB/ipc-socket:\fP\fI\fP] +[\fB/monitors:\fP\fI<0,1,2,...>\fP] +[\fB/rect:\fP\fI\fP] +[\fB+auth\fP] +[\fB-may-view\fP] +[\fB-may-interact\fP] +[\fB/sec:\fP\fI\fP] +[\fB-sec-rdp\fP] +[\fB-sec-tls\fP] +[\fB-sec-nla\fP] +[\fB-sec-ext\fP] +[\fB/sam-file:\fP\fI\fP] +[\fB/version\fP] +[\fB/help\fP] +.SH DESCRIPTION +.B freerdp\-shadow\-cli +can be used to share a running X display like with VNC but by using the RDP +instead. It is also possibly to share only parts (rect) of the display. +.SH OPTIONS +.IP /ipc-socket: +If this option is set an ipc socket with the path \fIipc-socket\fP is used +instead of a TCP socket. +.IP /port: +Set the port to use. Default is 3389. +This option is ignored if ipc-socket is used. +.IP /monitors:<1,2,3,...> +Select the monitor(s) to share. +.IP /rect: +Select rectangle within monitor to share. +.IP -auth +Disable authentication. If authentication is enabled PAM is used with the +X11 subsystem. Running as root is not necessary, however if run as user only +the same user that started freerdp\-shadow\-cli can authenticate. +.br +\fBWarning\fP: If authentication is disabled \fIeveryone\fP can connect. +.IP -may-view +Clients may view without prompt. +.IP -may-interact +Clients may interact without prompt. +.IP /sec: +Force a specific protocol security +.IP -sec-rdp (default:on) +Disable RDP security +.IP -sec-tls (default:on) +Disable TLS protocol security +.IP -sec-nla (default:on) +Disable NLA protocol security +.IP +sec-ext (default:off) +Use NLA extended protocol security +.IP /sam-file: +NTLM SAM file for NLA authentication +.IP /version +Print the version and exit. +.IP /help +Print the help and exit. + +.SH EXAMPLES +freerdp-shadow-cli /port:12345 + +When run as user within a X session (for example from an xterm) a socket on +12345 is opened and the current display is shared via RDP. + +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Otherweise. + +.SH SEE ALSO +wlog(7) + +.SH AUTHOR +FreeRDP diff --git a/server/shadow/freerdp-shadow.pc.in b/server/shadow/freerdp-shadow.pc.in index 5c8c4629c..615ae7f6b 100644 --- a/server/shadow/freerdp-shadow.pc.in +++ b/server/shadow/freerdp-shadow.pc.in @@ -2,14 +2,14 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/@FREERDP_INCLUDE_DIR@ -libs=-lfreerdp-shadow -lfreerdp-shadow-subsystem +libs=-lfreerdp-shadow@FREERDP_API_VERSION@ -lfreerdp-shadow-subsystem@FREERDP_API_VERSION@ Name: FreeRDP shadow Description: FreeRDP: A Remote Desktop Protocol Implementation URL: http://www.freerdp.com/ Version: @FREERDP_VERSION@ Requires: -Requires.private: @WINPR_PKG_CONFIG_FILENAME@ freerdp@FREERDP_VERSION_MAJOR@ +Requires.private: @WINPR_PKG_CONFIG_FILENAME@ freerdp@FREERDP_API_VERSION@ Libs: -L${libdir} ${libs} Libs.private: -ldl -lpthread Cflags: -I${includedir} diff --git a/server/shadow/shadow.c b/server/shadow/shadow.c index 734f3a5ec..4daf55e47 100644 --- a/server/shadow/shadow.c +++ b/server/shadow/shadow.c @@ -36,6 +36,7 @@ static BOOL g_MessagePump = FALSE; #endif #include +#define TAG SERVER_TAG("shadow") int main(int argc, char** argv) { @@ -52,6 +53,7 @@ int main(int argc, char** argv) if (!server) { status = -1; + WLog_ERR(TAG, "Server new failed"); goto fail_server_new; } @@ -70,14 +72,21 @@ int main(int argc, char** argv) if ((status = shadow_server_parse_command_line(server, argc, argv)) < 0) { shadow_server_command_line_status_print(server, argc, argv, status); + WLog_ERR(TAG, "Problem parsing the command line."); goto fail_parse_command_line; } if ((status = shadow_server_init(server)) < 0) + { + WLog_ERR(TAG, "Server initialization failed."); goto fail_server_init; + } if ((status = shadow_server_start(server)) < 0) + { + WLog_ERR(TAG, "Failed to start server."); goto fail_server_start; + } if (g_MessagePump) { diff --git a/server/shadow/shadow_server.c b/server/shadow/shadow_server.c index 9a66e9c01..094f1bf0a 100644 --- a/server/shadow/shadow_server.c +++ b/server/shadow/shadow_server.c @@ -453,12 +453,18 @@ int shadow_server_start(rdpShadowServer* server) server->screen = shadow_screen_new(server); if (!server->screen) + { + WLog_ERR(TAG, "screen_new failed"); return -1; + } server->capture = shadow_capture_new(server); if (!server->capture) + { + WLog_ERR(TAG, "capture_new failed"); return -1; + } if (!server->ipcSocket) status = server->listener->Open(server->listener, NULL, (UINT16) server->port); @@ -466,7 +472,10 @@ int shadow_server_start(rdpShadowServer* server) status = server->listener->OpenLocal(server->listener, server->ipcSocket); if (!status) + { + WLog_ERR(TAG, "Problem creating listener. (Port already used or insufficient permissions?)"); return -1; + } if (!(server->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) shadow_server_thread, (void*) server, 0, NULL))) diff --git a/uwac/libuwac/CMakeLists.txt b/uwac/libuwac/CMakeLists.txt index d40970735..6a98077e1 100644 --- a/uwac/libuwac/CMakeLists.txt +++ b/uwac/libuwac/CMakeLists.txt @@ -64,6 +64,7 @@ set(${MODULE_PREFIX}_SRCS add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${UWAC_API_VERSION}) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${UWAC_VERSION} SOVERSION ${UWAC_API_VERSION}) endif() diff --git a/uwac/uwac.pc.in b/uwac/uwac.pc.in index 66b477e98..0885b0e60 100644 --- a/uwac/uwac.pc.in +++ b/uwac/uwac.pc.in @@ -2,7 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/@UWAC_INCLUDE_DIR@ -libs=-luwac +libs=-luwac@UWAC_VERSION_MAJOR@ Name: uwac Description: uwac: using wayland as a client diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index ae1fbc862..a14d59630 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -176,14 +176,7 @@ if(BUILD_TESTING) add_subdirectory(test) endif() -if(WITH_MANPAGES) - if(OPENBSD) - install(FILES wlog.7 DESTINATION man/man7) - else() - install(FILES wlog.7 DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/man/man7) - endif() -endif(WITH_MANPAGES) - +install_freerdp_man(wlog.7 7) # Exporting if(${CMAKE_VERSION} VERSION_GREATER "2.8.10") diff --git a/winpr/libwinpr/CMakeLists.txt b/winpr/libwinpr/CMakeLists.txt index 7e8fcc5e1..4b7aa86b8 100644 --- a/winpr/libwinpr/CMakeLists.txt +++ b/winpr/libwinpr/CMakeLists.txt @@ -120,6 +120,7 @@ endif() add_library(${MODULE_NAME} ${WINPR_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) +set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${WINPR_API_VERSION}) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION} SOVERSION ${WINPR_API_VERSION}) endif() diff --git a/winpr/tools/.gitignore b/winpr/tools/.gitignore index daf12636c..cca058d29 100644 --- a/winpr/tools/.gitignore +++ b/winpr/tools/.gitignore @@ -1,2 +1,4 @@ makecert-cli/winpr-makecert +makecert-cli/winpr-makecert.1 hash-cli/winpr-hash +hash-cli/winpr-hash.1 diff --git a/winpr/tools/CMakeLists.txt b/winpr/tools/CMakeLists.txt index f792a9b14..4cfe00d7d 100644 --- a/winpr/tools/CMakeLists.txt +++ b/winpr/tools/CMakeLists.txt @@ -104,6 +104,7 @@ endif() add_library(${MODULE_NAME} ${WINPR_TOOLS_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) +set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${WINPR_TOOLS_API_VERSION}) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_TOOLS_VERSION} SOVERSION ${WINPR_TOOLS_API_VERSION}) endif() diff --git a/winpr/tools/hash-cli/CMakeLists.txt b/winpr/tools/hash-cli/CMakeLists.txt index 7b9195a05..9f8c7a8a0 100644 --- a/winpr/tools/hash-cli/CMakeLists.txt +++ b/winpr/tools/hash-cli/CMakeLists.txt @@ -50,3 +50,5 @@ if (WITH_DEBUG_SYMBOLS AND MSVC) endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Tools") +configure_file(winpr-hash.1.in ${CMAKE_CURRENT_BINARY_DIR}/winpr-hash.1) +install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/winpr-hash.1 1) diff --git a/winpr/tools/hash-cli/hash.c b/winpr/tools/hash-cli/hash.c index d12c71ccc..e295a7cee 100644 --- a/winpr/tools/hash-cli/hash.c +++ b/winpr/tools/hash-cli/hash.c @@ -44,6 +44,13 @@ * */ +void usage_and_exit() +{ + printf("winpr-hash: NTLM hashing tool\n"); + printf("Usage: winpr-hash -u -p [-d ] [-f <_default_,sam>] [-v <_1_,2>]\n"); + exit(1); +} + int main(int argc, char* argv[]) { int index = 1; @@ -65,8 +72,8 @@ int main(int argc, char* argv[]) if (index == argc) { - printf("missing domain\n"); - exit(1); + printf("missing domain\n\n"); + usage_and_exit(); } Domain = argv[index]; @@ -77,8 +84,8 @@ int main(int argc, char* argv[]) if (index == argc) { - printf("missing username\n"); - exit(1); + printf("missing username\n\n"); + usage_and_exit(); } User = argv[index]; @@ -89,8 +96,8 @@ int main(int argc, char* argv[]) if (index == argc) { - printf("missing password\n"); - exit(1); + printf("missing password\n\n"); + usage_and_exit(); } Password = argv[index]; @@ -101,14 +108,17 @@ int main(int argc, char* argv[]) if (index == argc) { - printf("missing version\n"); - exit(1); + printf("missing version parameter\n\n"); + usage_and_exit(); } version = atoi(argv[index]); if ((version != 1) && (version != 2)) - version = 1; + { + printf("unkown version %d \n\n", version); + usage_and_exit(); + } } else if (strcmp("-f", argv[index]) == 0) { @@ -116,8 +126,8 @@ int main(int argc, char* argv[]) if (index == argc) { - printf("missing format\n"); - exit(1); + printf("missing format\n\n"); + usage_and_exit(); } if (strcmp("default", argv[index]) == 0) @@ -127,9 +137,7 @@ int main(int argc, char* argv[]) } else if (strcmp("-h", argv[index]) == 0) { - printf("winpr-hash: NTLM hashing tool\n"); - printf("Usage: winpr-hash -u -p [-d ] -f -v <1,2>\n"); - exit(1); + usage_and_exit(); } index++; @@ -137,8 +145,8 @@ int main(int argc, char* argv[]) if ((!User) || (!Password)) { - printf("missing username or password\n"); - exit(1); + printf("missing username or password\n\n"); + usage_and_exit(); } UserLength = strlen(User); @@ -149,8 +157,8 @@ int main(int argc, char* argv[]) { if (!Domain) { - printf("missing domain\n"); - exit(1); + printf("missing domain (version 2 requires a domain to specified)\n\n"); + usage_and_exit(); } NTOWFv2A(Password, PasswordLength, User, UserLength, Domain, DomainLength, NtHash); diff --git a/winpr/tools/hash-cli/winpr-hash.1.in b/winpr/tools/hash-cli/winpr-hash.1.in new file mode 100644 index 000000000..e1c964a1d --- /dev/null +++ b/winpr/tools/hash-cli/winpr-hash.1.in @@ -0,0 +1,42 @@ +.TH winpr-hash 1 2017-01-11 "@FREERDP_VERSION_FULL@" "FreeRDP" +.SH NAME +winpr-hash \- NTLM hashing tool +.SH SYNOPSIS +.B winpr-hash +\fB-u\fP username +\fB-p\fP password +[\fB-d\fP domain] +[\fB-f\fP { \fIdefault\fP | sam }] +[\fB-v\fP { \fI1\fP | 2 }] +.SH DESCRIPTION +.B winpr-hash +is a small utility that can be used to create a NTLM hash from a username and password pair. The created hash can be outputed as plain hash or in SAM format. +.SH OPTIONS +.IP "-u username" +The username to use. +.IP "-p password" +Password to use. +.IP "-d domain" +A optional parameter to specify the domain of the user. +.IP "-f format" +Specify the output format. The \fIdefault\fP outputs only the plain NTLM +hash. The second output format available is \fIsam\fP which outputs the +created hash in a format that it can be used in SAM file: + +user:domain::hash::: +.IP "-v version" +Version allows it to specify the NTLM version to use. The default is to use version 1. In case +version 2 is used a domain needs to be specified. +.SH EXAMPLES +winpr-hash -u \fIuser\fP -p \fIpassword\fP -d \fIdomain\fP -f \fIsam\fP -v \fI2\fP + +Create a version \fI2\fP NTLM hash for \fIuser\fP with \fIdomain\fP and \fIpassword\fP and output it in \fIsam\fP format. +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Missing or invalid arguments. +.SH AUTHOR +FreeRDP diff --git a/winpr/tools/makecert-cli/CMakeLists.txt b/winpr/tools/makecert-cli/CMakeLists.txt index afc17daca..74afa09ea 100644 --- a/winpr/tools/makecert-cli/CMakeLists.txt +++ b/winpr/tools/makecert-cli/CMakeLists.txt @@ -50,3 +50,6 @@ 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() + +configure_file(winpr-makecert.1.in ${CMAKE_CURRENT_BINARY_DIR}/winpr-makecert.1) +install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/winpr-makecert.1 1) diff --git a/winpr/tools/makecert-cli/winpr-makecert.1.in b/winpr/tools/makecert-cli/winpr-makecert.1.in new file mode 100644 index 000000000..302bc6a20 --- /dev/null +++ b/winpr/tools/makecert-cli/winpr-makecert.1.in @@ -0,0 +1,116 @@ +.de URL +\\$2 \(laURL: \\$1 \(ra\\$3 +.. +.if \n[.g] .mso www.tmac)) +.TH winpr\-makecert 1 2017-01-11 "@FREERDP_VERSION_FULL@" "FreeRDP" +.SH NAME +winpr\-makecert \- A tool to create X.509 certificates. +.SH SYNOPSIS +.B winpr\-makecert +[\fB-rdp\fP] +[\fB-silent\fP] +[\fB-live\fP] +[\fB-format\fP { \fIcrt\fP | \fIpem\fP | \fIpfx\fP }] +[\fB-p\fP password] +[\fB-n\fP common_name] +[\fB-y\fP years] +[\fB-m\fP months] +[\fB-len\fP lenth] +[\fB-#\fP serial] +[\fB-a\fP { \fImd5\fP | \fIsha1\fP | \fIsha256\fP | \fIs384\fP | \fIsha512\fP }] +[\fB-path\fP outputpath] +[outputname] +.SH DESCRIPTION +.B winpr-makecert +is a tool for generating X.509 certificates modeled after the Windows command +MakeCert. winpr-makecert aims to be command line compatible with MakeCert +however not all options are supported or implemented yet. + +Unimplemented features are not described here. They are marked as "Unsupported" +in winpr-makecerts help. + +In contrast to it's Windows counterpart winpr\-makecert does, unless the +\fB\-live\fP option is given, always creates and save a certificate. +If \fIoutputname\fP isn't set it is tried to determine the host name of the +computer the command is run on. +.br +\fBWarning:\fP if the file already exists it will be overwritten without asking. + +Without further options the generated certificates have the following properties: + +* 2048 bit long +.br +* sha256 as hash algorithm +.br +* the detected host name is used as common name +.br +* a time stamp is used as serial number +.br +* validity period of one year +.br +* saved in the current working directory in crt format +.SH OPTIONS +.IP "-rdp" +Dummy parameter. Can be used to quickly generate a certificate with default +properties without specifying any further parameters. +.IP "-silent" +Don't print the generated certificate to stdout. +.IP "-f format" +Three formats are supported: crt, pem and pfx. +.br +\fIcrt\fP outputs the key and the certificate in a separate file each with the file +endings .key and .crt. +.br +\fIpem\fP outputs the key and certificate into a single file with the file ending pem. +.br +And \fIpfx\fP outputs key and certificate into a pkcs12 file with the ending .pfx. +.IP "-p password" +Password to use if the pfx format is used as format. +.IP "-live" +Don't write the key/certificate to disk. When used from the command line this +can be thought as "dummy" mode. +.IP "-n common_name" +The common name to use in the certificate. +.IP "-m months" +Validity period in months. +.IP "-y years" +Validity period in years. If months and years are specified the specified +month parameter will take precedence. +.IP "-len length" +Key length in bits to use. +.IP "-a { \fImd5\fP | \fIsha1\fP | \fIsha256\fP | \fIs384\fP | \fIsha512\fP }" +The hashing algorithm to use. +.IP "-# serial" +The serial number to use for the certificate. +.IP "-path" +A directory where the certificate should be created in. +.IP "outputname" +The base name of the created file(s). A suffix, the format specific suffix is +appended to this name. +.SH EXAMPLES +winpr-makecert -rdp + +Creates a certificate with the default properties, saved to a file in the +current working directory in crt format named like the host. If the host is +named freerdp the created files are called freerdp.key and freerdp.crt. + + +winpr-makecert -len 4096 -a sha384 -path /tmp -# 22 -m 144 -y 1 -format crt mycert + +The command above creates the file /tmp/mycert.pem containing a key and a +certificate with a length of 4096. It will use sha384 as hash algorithm. +The certificate has the serial number 22 and is valid for 12 years (144 months). +.SH EXIT STATUS +.TP +.B 0 +Successful program execution. +.TP +.B 1 +Otherweise. + +.SH SEE ALSO + +.URL "https://msdn.microsoft.com/library/windows/desktop/aa386968.aspx" "MakeCert help page" + +.SH AUTHOR +FreeRDP diff --git a/winpr/tools/makecert/makecert.c b/winpr/tools/makecert/makecert.c index 6c4ed5e94..075dbcbfb 100644 --- a/winpr/tools/makecert/makecert.c +++ b/winpr/tools/makecert/makecert.c @@ -67,7 +67,7 @@ static COMMAND_LINE_ARGUMENT_A args[] = /* Custom Options */ { "rdp", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, - "Generate certificate with required options for RDP usage." + "Unsupported - Generate certificate with required options for RDP usage." }, { "silent", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Silently generate certificate without verbose output." @@ -92,82 +92,82 @@ static COMMAND_LINE_ARGUMENT_A args[] = "The simplest method is to specify the name in double quotes, preceded by CN=; for example, -n \"CN=myName\"." }, { "pe", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, - "Marks the generated private key as exportable. This allows the private key to be included in the certificate." + "Unsupported - Marks the generated private key as exportable. This allows the private key to be included in the certificate." }, { "sk", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the subject's key container location, which contains the private key. " + "Unsupported - Specifies the subject's key container location, which contains the private key. " "If a key container does not exist, it will be created." }, { "sr", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the subject's certificate store location. location can be either currentuser (the default) or localmachine." + "Unsupported - Specifies the subject's certificate store location. location can be either currentuser (the default) or localmachine." }, { "ss", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the subject's certificate store name that stores the output certificate." + "Unsupported - Specifies the subject's certificate store name that stores the output certificate." }, { "#", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Specifies a serial number from 1 to 2,147,483,647. The default is a unique value generated by Makecert.exe." }, { "$", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the signing authority of the certificate, which must be set to either commercial " + "Unsupported - Specifies the signing authority of the certificate, which must be set to either commercial " "(for certificates used by commercial software publishers) or individual (for certificates used by individual software publishers)." }, /* Extended Options */ { "a", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the signature algorithm. algorithm must be md5, sha1 (the default), sha256, sha384, or sha512." + "Specifies the signature algorithm. algorithm must be md5, sha1, sha256 (the default), sha384, or sha512." }, { "b", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the start of the validity period. Defaults to the current date." + "Unsupported - Specifies the start of the validity period. Defaults to the current date." }, { "crl", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, - "Generates a certificate relocation list (CRL) instead of a certificate." + "Unsupported - Generates a certificate relocation list (CRL) instead of a certificate." }, { "cy", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the certificate type. Valid values are end for end-entity and authority for certification authority." + "Unsupported - Specifies the certificate type. Valid values are end for end-entity and authority for certification authority." }, { "e", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the end of the validity period. Defaults to 12/31/2039 11:59:59 GMT." + "Unsupported - Specifies the end of the validity period. Defaults to 12/31/2039 11:59:59 GMT." }, { "eku", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Inserts a list of comma-separated, enhanced key usage object identifiers (OIDs) into the certificate." + "Unsupported - Inserts a list of comma-separated, enhanced key usage object identifiers (OIDs) into the certificate." }, { "h", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the maximum height of the tree below this certificate." + "Unsupported - Specifies the maximum height of the tree below this certificate." }, { "ic", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the issuer's certificate file." + "Unsupported - Specifies the issuer's certificate file." }, { "ik", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the issuer's key container name." + "Unsupported - Specifies the issuer's key container name." }, { "iky", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the issuer's key type, which must be one of the following: " + "Unsupported - Specifies the issuer's key type, which must be one of the following: " "signature (which indicates that the key is used for a digital signature), " "exchange (which indicates that the key is used for key encryption and key exchange), " "or an integer that represents a provider type. " "By default, you can pass 1 for an exchange key or 2 for a signature key." }, { "in", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the issuer's certificate common name." + "Unsupported - Specifies the issuer's certificate common name." }, { "ip", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the issuer's CryptoAPI provider name. For information about the CryptoAPI provider name, see the –sp option." + "Unsupported - Specifies the issuer's CryptoAPI provider name. For information about the CryptoAPI provider name, see the –sp option." }, { "ir", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the location of the issuer's certificate store. location can be either currentuser (the default) or localmachine." + "Unsupported - Specifies the location of the issuer's certificate store. location can be either currentuser (the default) or localmachine." }, { "is", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the issuer's certificate store name." + "Unsupported - Specifies the issuer's certificate store name." }, { "iv", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the issuer's .pvk private key file." + "Unsupported - Specifies the issuer's .pvk private key file." }, { "iy", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the issuer's CryptoAPI provider type. For information about the CryptoAPI provider type, see the –sy option." + "Unsupported - Specifies the issuer's CryptoAPI provider type. For information about the CryptoAPI provider type, see the –sy option." }, { "l", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Links to policy information (for example, to a URL)." + "Unsupported - Links to policy information (for example, to a URL)." }, { "len", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Specifies the generated key length, in bits." @@ -179,36 +179,36 @@ static COMMAND_LINE_ARGUMENT_A args[] = "Specifies the duration, in years, of the certificate validity period." }, { "nscp", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, - "Includes the Netscape client-authorization extension." + "Unsupported - Includes the Netscape client-authorization extension." }, { "r", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, - "Creates a self-signed certificate." + "Unsupported - Creates a self-signed certificate." }, { "sc", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the subject's certificate file." + "Unsupported - Specifies the subject's certificate file." }, { "sky", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the subject's key type, which must be one of the following: " + "Unsupported - Specifies the subject's key type, which must be one of the following: " "signature (which indicates that the key is used for a digital signature), " "exchange (which indicates that the key is used for key encryption and key exchange), " "or an integer that represents a provider type. " "By default, you can pass 1 for an exchange key or 2 for a signature key." }, { "sp", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the subject's CryptoAPI provider name, which must be defined in the registry subkeys of " + "Unsupported - Specifies the subject's CryptoAPI provider name, which must be defined in the registry subkeys of " "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\\Defaults\\Provider. If both –sp and –sy are present, " "the type of the CryptoAPI provider must correspond to the Type value of the provider's subkey." }, { "sv", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the subject's .pvk private key file. The file is created if none exists." + "Unsupported - Specifies the subject's .pvk private key file. The file is created if none exists." }, { "sy", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the subject's CryptoAPI provider type, which must be defined in the registry subkeys of " + "Unsupported - Specifies the subject's CryptoAPI provider type, which must be defined in the registry subkeys of " "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\\Defaults\\Provider Types. If both –sy and –sp are present, " "the name of the CryptoAPI provider must correspond to the Name value of the provider type subkey." }, { "tbs", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, - "Specifies the certificate or CRL file to be signed." + "Unsupported - Specifies the certificate or CRL file to be signed." }, /* Help */ @@ -354,9 +354,8 @@ int command_line_pre_filter(MAKECERT_CONTEXT* context, int index, int argc, LPCS context->output_file = _strdup(argv[index]); if (!context->output_file) return -1; + return 1; } - - return 1; } return 0; @@ -389,11 +388,10 @@ int makecert_context_parse_arguments(MAKECERT_CONTEXT* context, int argc, char** do { - if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT)) + if (!(arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)) continue; CommandLineSwitchStart(arg) - /* Basic Options */ CommandLineSwitchCase(arg, "silent") @@ -474,7 +472,6 @@ int makecert_context_parse_arguments(MAKECERT_CONTEXT* context, int argc, char** CommandLineSwitchDefault(arg) { - } CommandLineSwitchEnd(arg) @@ -579,7 +576,7 @@ int makecert_context_output_certificate_file(MAKECERT_CONTEXT* context, char* pa goto out_fail; status = BIO_read(bio, x509_str, length); - + if (status < 0) goto out_fail; @@ -634,7 +631,7 @@ int makecert_context_output_certificate_file(MAKECERT_CONTEXT* context, char* pa goto out_fail; status = BIO_read(bio, x509_str, length); - + if (status < 0) goto out_fail; @@ -692,7 +689,7 @@ int makecert_context_output_certificate_file(MAKECERT_CONTEXT* context, char* pa goto out_fail; status = BIO_read(bio, x509_str, length); - + if (status < 0) goto out_fail; @@ -880,7 +877,9 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv) ret = makecert_context_parse_arguments(context, argc, argv); if (ret < 1) + { return ret; + } if (!context->default_name && !context->common_name) { @@ -951,7 +950,7 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv) { X509_gmtime_adj(X509_get_notAfter(context->x509), (long) (60 * 60 * 24 * 365 * context->duration_years)); } - + X509_set_pubkey(context->x509, context->pkey); name = X509_get_subject_name(context->x509); @@ -1004,7 +1003,7 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv) arg = CommandLineFindArgumentA(args, "a"); - md = EVP_sha1(); + md = EVP_sha256(); if (arg->Flags & COMMAND_LINE_VALUE_PRESENT) { @@ -1051,14 +1050,14 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv) } status = BIO_read(bio, x509_str, length); - + if (status < 0) { BIO_free(bio); free(x509_str); return -1; } - + offset += status; while (offset >= length) @@ -1074,20 +1073,21 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv) break; } - length = new_len; x509_str = new_str; - status = BIO_read(bio, &x509_str[offset], length); + status = BIO_read(bio, &x509_str[offset], new_len); + if (status < 0) break; + length = length + new_len; offset += status; } if (status < 0) return -1; - + length = offset; x509_str[length] = '\0'; @@ -1106,7 +1106,7 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv) makecert_context_output_certificate_file(context, context->output_path); if (context->crtFormat) - { + { if (makecert_context_output_private_key_file(context, context->output_path) < 0) return -1; } diff --git a/winpr/tools/winpr-tools.pc.in b/winpr/tools/winpr-tools.pc.in index cd05c9a61..f406e9844 100644 --- a/winpr/tools/winpr-tools.pc.in +++ b/winpr/tools/winpr-tools.pc.in @@ -2,7 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/@WINPR_INCLUDE_DIR@ -libs=-lwinpr-tools +libs=-lwinpr-tools@WINPR_TOOLS_API_VERSION@ Name: WinPR Description: WinPR: Windows Portable Runtime diff --git a/winpr/winpr.pc.in b/winpr/winpr.pc.in index ac509c01c..6b0c950fb 100644 --- a/winpr/winpr.pc.in +++ b/winpr/winpr.pc.in @@ -2,7 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/@WINPR_INCLUDE_DIR@ -libs=-lwinpr +libs=-lwinpr@WINPR_API_VERSION@ Name: WinPR Description: WinPR: Windows Portable Runtime