This commit is contained in:
C-o-r-E 2012-11-13 15:18:53 -05:00
commit 70101a7d75
20 changed files with 296 additions and 44 deletions

View File

@ -166,13 +166,10 @@ if(APPLE)
include_directories(/opt/local/include)
link_directories(/opt/local/lib)
endif()
if(WITH_CLANG)
set(CMAKE_C_COMPILER "clang")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.4")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl-framework,CoreFoundation")
endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
@ -277,10 +274,10 @@ find_feature(PCSC ${PCSC_FEATURE_TYPE} ${PCSC_FEATURE_PURPOSE} ${PCSC_FEATURE_DE
find_feature(FFmpeg ${FFMPEG_FEATURE_TYPE} ${FFMPEG_FEATURE_PURPOSE} ${FFMPEG_FEATURE_DESCRIPTION})
find_feature(Gstreamer ${GSTREAMER_FEATURE_TYPE} ${GSTREAMER_FEATURE_PURPOSE} ${GSTREAMER_FEATURE_DESCRIPTION})
# Installation Paths
if(WIN32)
set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX})
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX})
set(CMAKE_INSTALL_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX})
set(CMAKE_INSTALL_BINDIR ".")
set(CMAKE_INSTALL_LIBDIR ".")
endif()
# Path to put FreeRDP data
@ -289,12 +286,7 @@ set(FREERDP_KEYMAP_PATH "${FREERDP_DATA_PATH}/keymaps")
# Path to put plugins
if(WIN32)
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}")
else()
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/freerdp")
endif()
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/freerdp")
set(FREERDP_ADDIN_PATH "${FREERDP_PLUGIN_PATH}")
# Path to put extensions
@ -379,14 +371,13 @@ endif()
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;/\\\\.gitignore;/CMakeCache.txt")
set(CPACK_PACKAGE_EXECUTABLES "xfreerdp")
if(WITH_SERVER)
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "xfreerdp-server")
if(NOT WIN32)
set(CPACK_PACKAGE_EXECUTABLES "xfreerdp")
if(WITH_SERVER)
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "xfreerdp-server")
endif()
endif()
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FreeRDP: A Remote Desktop Protocol Implementation")
set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_TOPLEVEL_TAG "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
@ -400,9 +391,7 @@ set(CPACK_PACKAGE_VERSION ${FREERDP_VERSION_FULL})
set(CPACK_PACKAGE_VERSION_MAJOR ${FREERDP_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${FREERDP_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${FREERDP_VERSION_REVISION})
set(CPACK_SET_DESTDIR "on")
set(CPACK_PACKAGING_INSTALL_PREFIX "/tmp")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FreeRDP: A Remote Desktop Protocol Implementation")
set(CPACK_PACKAGE_CONTACT "Marc-Andre Moreau")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "marcandre.moreau@gmail.com")
@ -419,14 +408,30 @@ set(CPACK_NSIS_MUI_UNICON "${CMAKE_SOURCE_DIR}/resource\\\\FreeRDP_Icon_96px.ico
if(MSVC)
if(MSVC_RUNTIME STREQUAL "dynamic")
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include(InstallRequiredSystemLibraries)
install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT libraries)
endif()
endif()
set(CPACK_COMPONENTS_ALL client server libraries headers)
set(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client")
set(CPACK_COMPONENT_CLIENT_GROUP "Applications")
set(CPACK_COMPONENT_SERVER_DISPLAY_NAME "Server")
set(CPACK_COMPONENT_SERVER_GROUP "Applications")
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set(CPACK_COMPONENT_LIBRARIES_GROUP "Runtime")
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Headers")
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
set(CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "Runtime")
set(CPACK_COMPONENT_GROUP_APPLICATIONS_DESCRIPTION "Applications")
set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Development")
include(CPack)
cpack_add_component(headers DISPLAY_NAME "Headers")
cpack_add_component(libraries DISPLAY_NAME "Libraries")
cpack_add_component(clients DISPLAY_NAME "Clients")
set(CPACK_COMPONENTS_ALL clients libraries headers)

View File

@ -21,7 +21,7 @@ set(${MODULE_PREFIX}_SRCS
scard_main.c
scard_operations.c)
include_directories(${PCSC_INCLUDE_DIRS})
include_directories(${PCSC_INCLUDE_DIR})
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry")

View File

@ -45,6 +45,6 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clients)
install(TARGETS ${MODULE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Windows")

View File

@ -25,6 +25,9 @@
#include <winpr/windows.h>
#include <winpr/crt.h>
#include <winpr/credui.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@ -412,6 +415,59 @@ BOOL wf_post_connect(freerdp* instance)
return TRUE;
}
static const char wfTargetName[] = "TARGET";
static CREDUI_INFOA wfUiInfo =
{
sizeof(CREDUI_INFOA),
NULL,
"Enter your credentials",
"Remote Desktop Security",
NULL
};
BOOL wf_authenticate(freerdp* instance, char** username, char** password, char** domain)
{
BOOL fSave;
DWORD status;
DWORD dwFlags;
char UserName[CREDUI_MAX_USERNAME_LENGTH + 1];
char Password[CREDUI_MAX_PASSWORD_LENGTH + 1];
char User[CREDUI_MAX_USERNAME_LENGTH + 1];
char Domain[CREDUI_MAX_DOMAIN_TARGET_LENGTH + 1];
fSave = FALSE;
ZeroMemory(UserName, sizeof(UserName));
ZeroMemory(Password, sizeof(Password));
dwFlags = CREDUI_FLAGS_DO_NOT_PERSIST | CREDUI_FLAGS_EXCLUDE_CERTIFICATES;
status = CredUIPromptForCredentialsA(&wfUiInfo, wfTargetName, NULL, 0,
UserName, CREDUI_MAX_USERNAME_LENGTH + 1,
Password, CREDUI_MAX_PASSWORD_LENGTH + 1, &fSave, dwFlags);
if (status != NO_ERROR)
{
printf("CredUIPromptForCredentials unexpected status: 0x%08X\n", status);
return FALSE;
}
ZeroMemory(User, sizeof(User));
ZeroMemory(Domain, sizeof(Domain));
status = CredUIParseUserNameA(UserName, User, sizeof(User), Domain, sizeof(Domain));
//printf("User: %s Domain: %s Password: %s\n", User, Domain, Password);
*username = _strdup(User);
if (strlen(Domain) > 0)
*domain = _strdup(Domain);
*password = _strdup(Password);
return TRUE;
}
BOOL wf_verify_certificate(freerdp* instance, char* subject, char* issuer, char* fingerprint)
{
#if 0
@ -713,6 +769,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
instance = freerdp_new();
instance->PreConnect = wf_pre_connect;
instance->PostConnect = wf_post_connect;
instance->Authenticate = wf_authenticate;
instance->VerifyCertificate = wf_verify_certificate;
instance->ReceiveChannelData = wf_receive_channel_data;

View File

@ -372,10 +372,10 @@
</listitem>
</varlistentry>
<varlistentry>
<term>--gdi</term>
<term>--gdi <replaceable class="parameter">backend</replaceable></term>
<listitem>
<para>
GDI rendering backend. <replaceable class="parameter">backend</replaceable> can be either sw (software) or hw (hardware).
GDI (Graphics Device Interface) rendering backend. <replaceable class="parameter">backend</replaceable> can be either sw (software) or hw (hardware).
</para>
</listitem>
</varlistentry>
@ -459,10 +459,10 @@
</listitem>
</varlistentry>
<varlistentry>
<term>--plugin</term>
<term>--plugin <replaceable class="parameter">pluginname</replaceable></term>
<listitem>
<para>
load a plugin
load <replaceable class="parameter">pluginname</replaceable>
</para>
</listitem>
</varlistentry>

View File

@ -49,9 +49,7 @@ if(MONOLITHIC_BUILD)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT libraries)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp")

View File

@ -134,7 +134,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
"\n"
"Usage: %s [file] [options] server:port\n"
" -0: connect to console session\n"
" -a: set color depth in bit, default is 16\n"
" -a: set color depth in bits, default is 16\n"
" -c: shell working directory\n"
" -D: hide window decorations\n"
" -T: window title\n"

View File

@ -65,9 +65,9 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
if(WITH_SERVER_INTERFACE)
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
else()
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server)
endif()
if(WITH_SERVER_INTERFACE)

View File

@ -32,6 +32,6 @@ set(${MODULE_PREFIX}_LIBS wfreerdp-server)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Windows")

View File

@ -74,4 +74,3 @@ add_subdirectory(include)
add_subdirectory(libwinpr)
add_subdirectory(tools)

View File

@ -24,9 +24,14 @@
#include <winpr/wtypes.h>
#include <winpr/sspi.h>
#include <winpr/error.h>
#include <winpr/credentials.h>
#ifndef _WIN32
#ifdef _WIN32
#include <wincred.h>
#else
#define CREDUI_MAX_MESSAGE_LENGTH 32767
#define CREDUI_MAX_CAPTION_LENGTH 128

View File

@ -29,6 +29,10 @@
#else
#ifndef NO_ERROR
#define NO_ERROR 0
#endif
#define FACILITY_WINDOWSUPDATE 36
#define FACILITY_WINDOWS_CE 24
#define FACILITY_WINDOWS 8

View File

@ -54,7 +54,7 @@ if(MONOLITHIC_BUILD)
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
target_link_libraries(${MODULE_NAME} ${WINPR_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/libwinpr")
endif()

View File

@ -31,11 +31,19 @@ add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT"
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
if(MONOLITHIC_BUILD)
if(WIN32)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} credui)
endif()
if(MONOLITHIC_BUILD)
set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE)
else()
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")
if(BUILD_TESTING)
add_subdirectory(test)
endif()

3
winpr/libwinpr/credui/test/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
TestCredUI
TestCredUI.c

View File

@ -0,0 +1,34 @@
set(MODULE_NAME "TestCredUI")
set(MODULE_PREFIX "TEST_CREDUI")
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestCredUIParseUserName.c
TestCredUIConfirmCredentials.c
TestCredUIPromptForCredentials.c
TestCredUICmdLinePromptForCredentials.c)
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-crt winpr-credui)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${${MODULE_PREFIX}_TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
endforeach()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")

View File

@ -0,0 +1,37 @@
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/tchar.h>
#include <winpr/credui.h>
#include <winpr/windows.h>
static const TCHAR testTargetName[] = _T("TARGET");
int TestCredUICmdLinePromptForCredentials(int argc, char* argv[])
{
BOOL fSave;
DWORD status;
DWORD dwFlags;
TCHAR UserName[CREDUI_MAX_USERNAME_LENGTH];
TCHAR Password[CREDUI_MAX_PASSWORD_LENGTH];
fSave = FALSE;
ZeroMemory(UserName, sizeof(UserName));
ZeroMemory(Password, sizeof(Password));
dwFlags = CREDUI_FLAGS_DO_NOT_PERSIST | CREDUI_FLAGS_EXCLUDE_CERTIFICATES;
status = CredUICmdLinePromptForCredentials(testTargetName, NULL, 0,
UserName, CREDUI_MAX_USERNAME_LENGTH,
Password, CREDUI_MAX_PASSWORD_LENGTH, &fSave, dwFlags);
if (status != NO_ERROR)
{
printf("CredUIPromptForCredentials unexpected status: 0x%08X\n", status);
return -1;
}
_tprintf(_T("UserName: %s Password: %s\n"), UserName, Password);
return 0;
}

View File

@ -0,0 +1,13 @@
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/tchar.h>
#include <winpr/credui.h>
#include <winpr/windows.h>
int TestCredUIConfirmCredentials(int argc, char* argv[])
{
return 0;
}

View File

@ -0,0 +1,43 @@
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/tchar.h>
#include <winpr/credui.h>
#include <winpr/windows.h>
static const TCHAR testUserName1[] = _T("LAB1\\JohnDoe");
static const TCHAR testUserName2[] = _T("JohnDoe@LAB1");
int TestCredUIParseUserName(int argc, char* argv[])
{
DWORD status;
TCHAR User[CREDUI_MAX_USERNAME_LENGTH + 1];
TCHAR Domain[CREDUI_MAX_DOMAIN_TARGET_LENGTH + 1];
/* Test LAB1\JohnDoe */
ZeroMemory(User, sizeof(User));
ZeroMemory(Domain, sizeof(Domain));
status = CredUIParseUserName(testUserName1, User, sizeof(User) / sizeof(TCHAR),
Domain, sizeof(Domain) / sizeof(TCHAR));
printf("CredUIParseUserName status: 0x%08X\n", status);
_tprintf(_T("UserName: %s -> Domain: %s User: %s\n"), testUserName1, Domain, User);
/* Test JohnDoe@LAB1 */
ZeroMemory(User, sizeof(User));
ZeroMemory(Domain, sizeof(Domain));
status = CredUIParseUserName(testUserName2, User, sizeof(User) / sizeof(TCHAR),
Domain, sizeof(Domain) / sizeof(TCHAR));
printf("CredUIParseUserName status: 0x%08X\n", status);
_tprintf(_T("UserName: %s -> Domain: %s User: %s\n"), testUserName2, Domain, User);
return 0;
}

View File

@ -0,0 +1,46 @@
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/tchar.h>
#include <winpr/credui.h>
#include <winpr/windows.h>
static const TCHAR testTargetName[] = _T("TARGET");
static CREDUI_INFO testUiInfo =
{
sizeof(CREDUI_INFO),
NULL,
_T("Message Text"),
_T("Caption Text"),
NULL
};
int TestCredUIPromptForCredentials(int argc, char* argv[])
{
BOOL fSave;
DWORD status;
DWORD dwFlags;
TCHAR UserName[CREDUI_MAX_USERNAME_LENGTH];
TCHAR Password[CREDUI_MAX_PASSWORD_LENGTH];
fSave = FALSE;
ZeroMemory(UserName, sizeof(UserName));
ZeroMemory(Password, sizeof(Password));
dwFlags = CREDUI_FLAGS_DO_NOT_PERSIST | CREDUI_FLAGS_EXCLUDE_CERTIFICATES;
status = CredUIPromptForCredentials(&testUiInfo, testTargetName, NULL, 0,
UserName, CREDUI_MAX_USERNAME_LENGTH,
Password, CREDUI_MAX_PASSWORD_LENGTH, &fSave, dwFlags);
if (status != NO_ERROR)
{
printf("CredUIPromptForCredentials unexpected status: 0x%08X\n", status);
return -1;
}
_tprintf(_T("UserName: %s Password: %s\n"), UserName, Password);
return 0;
}