[client,common] allow forcing default callbacks

All clients can implement their own callbacks for
certificate/credential/smartcard/... but there is a common (default)
implementation for all clients.
with the new setting FreeRDP_UseCommonStdioCallbacks it is now possible
to force these over the client implementation provided ones
This commit is contained in:
Armin Novak 2023-07-19 08:41:19 +02:00 committed by akallabeth
parent 97415f0d52
commit 3d1bb4e1d9
8 changed files with 37 additions and 9 deletions

View File

@ -29,6 +29,7 @@ set(SRCS
client.c
client_rails.c
cmdline.c
cmdline.h
file.c
client_cliprdr_file.c
geometry.c

View File

@ -66,6 +66,17 @@
#include <freerdp/log.h>
#define TAG CLIENT_TAG("common")
static void set_default_callbacks(freerdp* instance)
{
WINPR_ASSERT(instance);
instance->AuthenticateEx = client_cli_authenticate_ex;
instance->ChooseSmartcard = client_cli_choose_smartcard;
instance->VerifyCertificateEx = client_cli_verify_certificate_ex;
instance->VerifyChangedCertificateEx = client_cli_verify_changed_certificate_ex;
instance->PresentGatewayMessage = client_cli_present_gateway_message;
instance->LogonErrorInfo = client_cli_logon_error_info;
}
static BOOL freerdp_client_common_new(freerdp* instance, rdpContext* context)
{
RDP_CLIENT_ENTRY_POINTS* pEntryPoints;
@ -74,12 +85,7 @@ static BOOL freerdp_client_common_new(freerdp* instance, rdpContext* context)
WINPR_ASSERT(context);
instance->LoadChannels = freerdp_client_load_channels;
instance->AuthenticateEx = client_cli_authenticate_ex;
instance->ChooseSmartcard = client_cli_choose_smartcard;
instance->VerifyCertificateEx = client_cli_verify_certificate_ex;
instance->VerifyChangedCertificateEx = client_cli_verify_changed_certificate_ex;
instance->PresentGatewayMessage = client_cli_present_gateway_message;
instance->LogonErrorInfo = client_cli_logon_error_info;
set_default_callbacks(instance);
pEntryPoints = instance->pClientEntryPoints;
WINPR_ASSERT(pEntryPoints);
@ -173,6 +179,9 @@ int freerdp_client_start(rdpContext* context)
if (!context || !context->instance || !context->instance->pClientEntryPoints)
return ERROR_BAD_ARGUMENTS;
if (freerdp_settings_get_bool(context->settings, FreeRDP_UseCommonStdioCallbacks))
set_default_callbacks(context->instance);
pEntryPoints = context->instance->pClientEntryPoints;
return IFCALLRESULT(CHANNEL_RC_OK, pEntryPoints->ClientStart, context);
}

View File

@ -4058,11 +4058,15 @@ static int freerdp_client_settings_parse_command_line_arguments_int(rdpSettings*
}
CommandLineSwitchCase(arg, "unmap-buttons")
{
settings->UnmapButtons = enable;
freerdp_settings_set_bool(settings, FreeRDP_UnmapButtons, enable);
}
CommandLineSwitchCase(arg, "toggle-fullscreen")
{
settings->ToggleFullscreen = enable;
freerdp_settings_set_bool(settings, FreeRDP_ToggleFullscreen, enable);
}
CommandLineSwitchCase(arg, "force-console-callbacks")
{
freerdp_settings_set_bool(settings, FreeRDP_UseCommonStdioCallbacks, enable);
}
CommandLineSwitchCase(arg, "floatbar")
{

View File

@ -163,6 +163,8 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
"floatbar is disabled by default (when enabled defaults to sticky in fullscreen mode)" },
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
"smooth fonts (ClearType)" },
{ "force-console-callbacks", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL,
"Use default callbacks (console) for certificate/credential/..." },
{ "frame-ack", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL,
"Number of frame acknowledgement" },
{ "args-from", COMMAND_LINE_VALUE_REQUIRED, "<file>|stdin|fd:<number>|env:<name>", NULL, NULL,

View File

@ -734,6 +734,7 @@ extern "C"
#define FreeRDP_UnmapButtons (1605)
#define FreeRDP_OldLicenseBehaviour (1606)
#define FreeRDP_MouseUseRelativeMove (1607)
#define FreeRDP_UseCommonStdioCallbacks (1608)
#define FreeRDP_ComputerName (1664)
#define FreeRDP_ConnectionFile (1728)
#define FreeRDP_AssistanceFile (1729)
@ -1293,7 +1294,8 @@ extern "C"
ALIGN64 BOOL UnmapButtons; /* 1605 */
ALIGN64 BOOL OldLicenseBehaviour; /* 1606 */
ALIGN64 BOOL MouseUseRelativeMove; /* 1607 */
UINT64 padding1664[1664 - 1608]; /* 1608 */
ALIGN64 BOOL UseCommonStdioCallbacks; /* 1608 */
UINT64 padding1664[1664 - 1609]; /* 1609 */
/* Names */
ALIGN64 char* ComputerName; /* 1664 */

View File

@ -582,6 +582,9 @@ BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id)
case FreeRDP_UnmapButtons:
return settings->UnmapButtons;
case FreeRDP_UseCommonStdioCallbacks:
return settings->UseCommonStdioCallbacks;
case FreeRDP_UseMultimon:
return settings->UseMultimon;
@ -1326,6 +1329,10 @@ BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL val)
settings->UnmapButtons = cnv.c;
break;
case FreeRDP_UseCommonStdioCallbacks:
settings->UseCommonStdioCallbacks = cnv.c;
break;
case FreeRDP_UseMultimon:
settings->UseMultimon = cnv.c;
break;

View File

@ -241,6 +241,8 @@ static const struct settings_str_entry settings_map[] = {
{ FreeRDP_TransportDumpReplay, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_TransportDumpReplay" },
{ FreeRDP_UnicodeInput, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UnicodeInput" },
{ FreeRDP_UnmapButtons, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UnmapButtons" },
{ FreeRDP_UseCommonStdioCallbacks, FREERDP_SETTINGS_TYPE_BOOL,
"FreeRDP_UseCommonStdioCallbacks" },
{ FreeRDP_UseMultimon, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UseMultimon" },
{ FreeRDP_UseRdpSecurityLayer, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UseRdpSecurityLayer" },
{ FreeRDP_UsingSavedCredentials, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_UsingSavedCredentials" },

View File

@ -178,6 +178,7 @@ static const size_t bool_list_indices[] = {
FreeRDP_TransportDumpReplay,
FreeRDP_UnicodeInput,
FreeRDP_UnmapButtons,
FreeRDP_UseCommonStdioCallbacks,
FreeRDP_UseMultimon,
FreeRDP_UseRdpSecurityLayer,
FreeRDP_UsingSavedCredentials,