From f5423caace0aeda79c26eaba9f2926328af1c191 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 8 Mar 2023 14:25:57 +0100 Subject: [PATCH] [auth,aad] add freerdp* argument to callback --- client/common/client.c | 3 ++- include/freerdp/client.h | 3 ++- include/freerdp/freerdp.h | 2 +- libfreerdp/core/aad.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/common/client.c b/client/common/client.c index a8730ff20..0459566d6 100644 --- a/client/common/client.c +++ b/client/common/client.c @@ -937,11 +937,12 @@ BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, BOOL isD return TRUE; } -BOOL client_cli_get_aad_auth_code(const char* hostname, char** code) +BOOL client_cli_get_aad_auth_code(freerdp* instance, const char* hostname, char** code) { size_t len = 0; char* p = NULL; + WINPR_ASSERT(instance); WINPR_ASSERT(hostname); WINPR_ASSERT(code); *code = NULL; diff --git a/include/freerdp/client.h b/include/freerdp/client.h index 88f5fd794..3761b4634 100644 --- a/include/freerdp/client.h +++ b/include/freerdp/client.h @@ -155,7 +155,8 @@ extern "C" FREERDP_API int client_cli_logon_error_info(freerdp* instance, UINT32 data, UINT32 type); - FREERDP_API BOOL client_cli_get_aad_auth_code(const char* hostname, char** code); + FREERDP_API BOOL client_cli_get_aad_auth_code(freerdp* instance, const char* hostname, + char** code); FREERDP_API void freerdp_client_OnChannelConnectedEventHandler(void* context, diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index f47b302f2..4e518b77e 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -139,7 +139,7 @@ extern "C" char** domain, rdp_auth_reason reason); typedef BOOL (*pChooseSmartcard)(freerdp* instance, SmartcardCertInfo** cert_list, DWORD count, DWORD* choice, BOOL gateway); - typedef BOOL (*pGetAadAuthCode)(const char* hostname, char** code); + typedef BOOL (*pGetAadAuthCode)(freerdp* instance, const char* hostname, char** code); /** @brief Callback used if user interaction is required to accept * an unknown certificate. diff --git a/libfreerdp/core/aad.c b/libfreerdp/core/aad.c index 529ac364c..501474f78 100644 --- a/libfreerdp/core/aad.c +++ b/libfreerdp/core/aad.c @@ -159,7 +159,7 @@ int aad_client_begin(rdpAad* aad) LOG_ERROR_AND_GOTO(fail, "Unable to generate pop key"); /* Obtain an oauth authorization code */ - if (!instance->GetAadAuthCode || !instance->GetAadAuthCode(aad->hostname, &auth_code)) + if (!instance->GetAadAuthCode || !instance->GetAadAuthCode(instance, aad->hostname, &auth_code)) LOG_ERROR_AND_GOTO(fail, "Unable to obtain authorization code"); /* Set up an ssl connection to the authorization server */