From 8dc01cebb0a98d4c0e9dae5b1e438663d14960bb Mon Sep 17 00:00:00 2001 From: st0ne77 <951251531@qq.com> Date: Fri, 15 Dec 2023 10:09:04 +0800 Subject: [PATCH] [client,sdl] propagate error from auth dialog --- client/SDL/dialogs/sdl_dialogs.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/client/SDL/dialogs/sdl_dialogs.cpp b/client/SDL/dialogs/sdl_dialogs.cpp index 54f6f9ff8..3e91a6d0b 100644 --- a/client/SDL/dialogs/sdl_dialogs.cpp +++ b/client/SDL/dialogs/sdl_dialogs.cpp @@ -116,7 +116,7 @@ BOOL sdl_authenticate_ex(freerdp* instance, char** username, char** password, ch { SDL_UserAuthArg* arg = reinterpret_cast(event.padding); - res = arg->result != 0 ? TRUE : FALSE; + res = arg->result > 0 ? TRUE : FALSE; free(*username); free(*domain); @@ -516,11 +516,19 @@ BOOL sdl_auth_dialog_show(const SDL_UserAuthArg* args) rc = ilist.run(result); } - if ((rc <= 0) || (result.size() < prompt.size())) - return FALSE; + if ((result.size() < prompt.size())) + rc = -1; - return sdl_push_user_event(SDL_USEREVENT_AUTH_RESULT, _strdup(result[0].c_str()), - _strdup(result[1].c_str()), _strdup(result[2].c_str()), rc); + char* user = nullptr; + char* domain = nullptr; + char* pwd = nullptr; + if (rc > 0) + { + user = _strdup(result[0].c_str()); + domain = _strdup(result[1].c_str()); + pwd = _strdup(result[2].c_str()); + } + return sdl_push_user_event(SDL_USEREVENT_AUTH_RESULT, user, domain, pwd, rc); } BOOL sdl_scard_dialog_show(const char* title, Sint32 count, const char** list)