8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

Additional fix for #8256 : the case when server doesn't return error immediately after connect.

This commit is contained in:
Vlad Khorsun 2024-10-04 14:19:48 +03:00
parent aa167e2b36
commit 37079f1615
3 changed files with 38 additions and 1 deletions

View File

@ -7417,6 +7417,7 @@ static rem_port* analyze(ClntAuthBlock& cBlock, PathName& attach_name, unsigned
while (true)
{
authenticateStep0(cBlock);
const NoCaseString savePluginName(cBlock.plugins.name());
try
{
@ -7504,6 +7505,38 @@ static rem_port* analyze(ClntAuthBlock& cBlock, PathName& attach_name, unsigned
}
}
#ifdef TRUSTED_AUTH
if (port && !legacySSP)
{
const PACKET& const packet = port->port_context->rdb_packet;
if (port->port_protocol < PROTOCOL_VERSION13 && packet.p_operation == op_accept)
{
// old server supports legacy SSP only
legacySSP = true;
}
else if (port->port_protocol >= PROTOCOL_VERSION13 && packet.p_operation == op_accept_data)
{
// more recent server reports if it supports non-legacy SSP
legacySSP = !(packet.p_acpd.p_acpt_type & pflag_win_sspi_nego);
}
else
break;
Auth::setLegacySSP(legacySSP);
if (legacySSP && savePluginName == "WIN_SSPI")
{
// reinitialize Win_SSPI plugin and send new data
attach_name = save_attach_name;
cBlock.plugins.set(savePluginName.c_str());
disconnect(port, false);
continue;
}
}
#endif
break;
}
catch (const Exception&)

View File

@ -142,6 +142,7 @@ const USHORT ptype_MASK = 0xFF; // Mask - up to 255 types of protocol
//
// upper byte is used for protocol flags
const USHORT pflag_compress = 0x100; // Turn on compression if possible
const USHORT pflag_win_sspi_nego = 0x200; // Win_SSPI supports Negotiate security package
// Generic object id

View File

@ -1985,6 +1985,9 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
send->p_acpd.p_acpt_version = port->port_protocol = version;
send->p_acpd.p_acpt_architecture = architecture;
send->p_acpd.p_acpt_type = type | (compress ? pflag_compress : 0);
#ifdef TRUSTED_AUTH
send->p_acpd.p_acpt_type |= pflag_win_sspi_nego;
#endif
send->p_acpd.p_acpt_authenticated = 0;
send->p_acpt.p_acpt_version = port->port_protocol = version;