From b5041dae96b837c725731aaf5c5948ac52ceabc1 Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Mon, 28 Aug 2023 17:11:01 +0300 Subject: [PATCH] Fixed #7723: Wrong error message on login if the user doesn't exist and WireCrypt is disabled (cherry picked from commit f049b6fb7ef89a4af04a685d59a89b53bee8cf90) --- src/remote/server/server.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/remote/server/server.cpp b/src/remote/server/server.cpp index d69d76e657..c58200e83f 100644 --- a/src/remote/server/server.cpp +++ b/src/remote/server/server.cpp @@ -730,8 +730,13 @@ public: if (st.hasData()) { - if (st.getErrors()[1] == isc_missing_data_structures) + switch (st.getErrors()[1]) + { + case isc_missing_data_structures: + case isc_login: status_exception::raise(&st); + break; + } iscLogStatus("Authentication error", &st); Arg::Gds loginError(isc_login_error); @@ -2100,19 +2105,25 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send) HANDSHAKE_DEBUG(fprintf(stderr, "!accepted, sending reject\n")); if (status.getState() & Firebird::IStatus::STATE_ERRORS) { - if (status.getErrors()[1] != isc_missing_data_structures) + switch (status.getErrors()[1]) { - iscLogStatus("Authentication error", &status); - Arg::Gds loginError(isc_login_error); -#ifdef DEV_BUILD - loginError << Arg::StatusVector(&status); -#endif - LocalStatus tmp; - loginError.copyTo(&tmp); - port->send_response(send, 0, 0, &tmp, false); - } - else + case isc_missing_data_structures: + case isc_login: port->send_response(send, 0, 0, &status, false); + break; + + default: + { + iscLogStatus("Authentication error", &status); + Arg::Gds loginError(isc_login_error); +#ifdef DEV_BUILD + loginError << Arg::StatusVector(&status); +#endif + LocalStatus tmp; + loginError.copyTo(&tmp); + port->send_response(send, 0, 0, &tmp, false); + } + } } else port->send(send);