From 0c8a08817c0c86aad2455aab34f0dad639956d84 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sat, 11 Mar 2023 11:37:30 +0100 Subject: [PATCH] [core,utils] do not abort on auth fail Authenticate and GatewayAuthenticate return FALSE when there are no credentials supplied. AuthenticateEx indicates connection termination with that return value. Handle this accordingly --- libfreerdp/core/utils.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/libfreerdp/core/utils.c b/libfreerdp/core/utils.c index 25cdcab97..4a77d34d8 100644 --- a/libfreerdp/core/utils.c +++ b/libfreerdp/core/utils.c @@ -90,16 +90,21 @@ auth_status utils_authenticate_gateway(freerdp* instance, rdp_auth_reason reason return AUTH_NO_CREDENTIALS; if (!instance->GatewayAuthenticate) + { proceed = instance->AuthenticateEx(instance, &settings->GatewayUsername, &settings->GatewayPassword, &settings->GatewayDomain, reason); + if (!proceed) + return AUTH_CANCELLED; + } else + { proceed = instance->GatewayAuthenticate(instance, &settings->GatewayUsername, &settings->GatewayPassword, &settings->GatewayDomain); - - if (!proceed) - return AUTH_CANCELLED; + if (!proceed) + return AUTH_NO_CREDENTIALS; + } if (utils_str_is_empty(settings->GatewayUsername) || utils_str_is_empty(settings->GatewayPassword)) @@ -178,14 +183,19 @@ auth_status utils_authenticate(freerdp* instance, rdp_auth_reason reason, BOOL o return AUTH_NO_CREDENTIALS; if (!instance->Authenticate) + { proceed = instance->AuthenticateEx(instance, &settings->Username, &settings->Password, &settings->Domain, reason); + if (!proceed) + return AUTH_CANCELLED; + } else + { proceed = instance->Authenticate(instance, &settings->Username, &settings->Password, &settings->Domain); - - if (!proceed) - return AUTH_CANCELLED; + if (!proceed) + return AUTH_NO_CREDENTIALS; + } if (utils_str_is_empty(settings->Username) || utils_str_is_empty(settings->Password)) return AUTH_NO_CREDENTIALS;