[client] auto intialize callbacks

initialize all message/user query callbacks with client_cli_*
This commit is contained in:
Armin Novak 2023-02-14 19:44:18 +01:00 committed by Martin Fleisz
parent caaf4edffa
commit 5d97a03bf4
6 changed files with 26 additions and 21 deletions

View File

@ -323,9 +323,6 @@ static BOOL tf_client_new(freerdp* instance, rdpContext* context)
instance->PreConnect = tf_pre_connect;
instance->PostConnect = tf_post_connect;
instance->PostDisconnect = tf_post_disconnect;
instance->AuthenticateEx = client_cli_authenticate_ex;
instance->VerifyCertificateEx = client_cli_verify_certificate_ex;
instance->VerifyChangedCertificateEx = client_cli_verify_changed_certificate_ex;
instance->LogonErrorInfo = tf_logon_error_info;
/* TODO: Client display set up */
WINPR_UNUSED(tf);

View File

@ -622,11 +622,6 @@ static BOOL wlf_client_new(freerdp* instance, rdpContext* context)
instance->PreConnect = wl_pre_connect;
instance->PostConnect = wl_post_connect;
instance->PostDisconnect = wl_post_disconnect;
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 = wlf_logon_error_info;
wfl->log = WLog_Get(TAG);
wfl->display = UwacOpenDisplay(NULL, &status);

View File

@ -1312,13 +1312,7 @@ static BOOL wfreerdp_client_new(freerdp* instance, rdpContext* context)
freerdp_settings_set_bool(context->settings, FreeRDP_CertificateCallbackPreferPEM, TRUE);
#endif
if (wfc->isConsole)
{
instance->VerifyCertificateEx = wf_cli_verify_certificate_ex;
instance->VerifyChangedCertificateEx = client_cli_verify_changed_certificate_ex;
instance->PresentGatewayMessage = client_cli_present_gateway_message;
}
else
if (!wfc->isConsole)
{
instance->VerifyCertificateEx = wf_verify_certificate_ex;
instance->VerifyChangedCertificateEx = wf_verify_changed_certificate_ex;

View File

@ -1875,11 +1875,6 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
instance->PostConnect = xf_post_connect;
instance->PostDisconnect = xf_post_disconnect;
instance->PostFinalDisconnect = xf_post_final_disconnect;
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 = xf_logon_error_info;
PubSub_SubscribeTerminate(context->pubSub, xf_TerminateEventHandler);
#ifdef WITH_XRENDER

View File

@ -71,7 +71,17 @@ static BOOL freerdp_client_common_new(freerdp* instance, rdpContext* context)
pEntryPoints = instance->pClientEntryPoints;
WINPR_ASSERT(pEntryPoints);
return IFCALLRESULT(TRUE, pEntryPoints->ClientNew, instance, context);
const BOOL rc = IFCALLRESULT(TRUE, pEntryPoints->ClientNew, instance, context);
if (rc)
{
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;
}
return rc;
}
static void freerdp_client_common_free(freerdp* instance, rdpContext* context)
@ -1558,3 +1568,15 @@ BOOL freerdp_client_load_channels(freerdp* instance)
}
return TRUE;
}
int client_cli_logon_error_info(freerdp* instance, UINT32 data, UINT32 type)
{
const char* str_data = freerdp_get_logon_error_info_data(data);
const char* str_type = freerdp_get_logon_error_info_type(type);
if (!instance || !instance->context)
return -1;
WLog_INFO(TAG, "Logon Error Info %s [%s]", str_data, str_type);
return 1;
}

View File

@ -153,6 +153,8 @@ extern "C"
FREERDP_API BOOL client_cli_choose_smartcard(SmartcardCertInfo** cert_list, DWORD count,
DWORD* choice, BOOL gateway);
FREERDP_API int client_cli_logon_error_info(freerdp* instance, UINT32 data, UINT32 type);
FREERDP_API void
freerdp_client_OnChannelConnectedEventHandler(void* context,
const ChannelConnectedEventArgs* e);