From: <ale...@us...> - 2014-12-03 14:27:14
|
Revision: 60334 http://sourceforge.net/p/firebird/code/60334 Author: alexpeshkoff Date: 2014-12-03 14:27:11 +0000 (Wed, 03 Dec 2014) Log Message: ----------- Fixed CORE-4471: Legacy_Auth plugin does not connect from FB3 to FB2.5 server when tried after Win_Sspi Modified Paths: -------------- firebird/trunk/src/remote/client/interface.cpp firebird/trunk/src/remote/remot_proto.h firebird/trunk/src/remote/remote.cpp Modified: firebird/trunk/src/remote/client/interface.cpp =================================================================== --- firebird/trunk/src/remote/client/interface.cpp 2014-12-03 14:19:43 UTC (rev 60333) +++ firebird/trunk/src/remote/client/interface.cpp 2014-12-03 14:27:11 UTC (rev 60334) @@ -6116,6 +6116,16 @@ response->p_resp_data = temp; } +static bool useLegacyAuth(const char* nm, int protocol, ClumpletWriter& dpb) +{ + LegacyPlugin legacyAuth = REMOTE_legacy_auth(nm, protocol); + if (!legacyAuth) + return false; + + int requestedAuth = dpb.find(isc_dpb_user_name) ? PLUGIN_LEGACY : PLUGIN_TRUSTED; + return legacyAuth == requestedAuth; +} + // Let plugins try to add data to DPB in order to avoid extra network roundtrip static void authFillParametersBlock(ClntAuthBlock& cBlock, ClumpletWriter& dpb, const ParametersSet* tags, rem_port* port) @@ -6130,7 +6140,7 @@ for (; cBlock.plugins.hasData(); cBlock.plugins.next()) { if (port->port_protocol >= PROTOCOL_VERSION13 || - REMOTE_legacy_auth(cBlock.plugins.name(), port->port_protocol)) + useLegacyAuth(cBlock.plugins.name(), port->port_protocol, dpb)) { // OK to use plugin cBlock.resetDataFromPlugin(); Modified: firebird/trunk/src/remote/remot_proto.h =================================================================== --- firebird/trunk/src/remote/remot_proto.h 2014-12-03 14:19:43 UTC (rev 60333) +++ firebird/trunk/src/remote/remot_proto.h 2014-12-03 14:27:11 UTC (rev 60334) @@ -47,6 +47,7 @@ typedef bool PacketReceive(rem_port*, UCHAR*, SSHORT, SSHORT*); typedef bool PacketSend(rem_port*, const SCHAR*, SSHORT); typedef bool ProtoWrite(XDR*); +enum LegacyPlugin {PLUGIN_NEW = 0, PLUGIN_LEGACY, PLUGIN_TRUSTED}; void REMOTE_cleanup_transaction (struct Rtr *); USHORT REMOTE_compute_batch_size (rem_port*, USHORT, P_OP, const rem_fmt*); @@ -60,7 +61,7 @@ void REMOTE_reset_statement (struct Rsr *); void REMOTE_save_status_strings (ISC_STATUS *); bool_t REMOTE_getbytes (XDR*, SCHAR*, u_int); -bool REMOTE_legacy_auth(const char* nm, int protocol); +LegacyPlugin REMOTE_legacy_auth(const char* nm, int protocol); Firebird::RefPtr<Config> REMOTE_get_config(const Firebird::PathName* dbName, const Firebird::string* dpb_config = NULL); void REMOTE_parseList(Remote::ParsedList&, Firebird::PathName); Modified: firebird/trunk/src/remote/remote.cpp =================================================================== --- firebird/trunk/src/remote/remote.cpp 2014-12-03 14:19:43 UTC (rev 60333) +++ firebird/trunk/src/remote/remote.cpp 2014-12-03 14:27:11 UTC (rev 60334) @@ -884,22 +884,22 @@ return id; } -bool REMOTE_legacy_auth(const char* nm, int p) +LegacyPlugin REMOTE_legacy_auth(const char* nm, int p) { const char* legacyTrusted = "WIN_SSPI"; if (fb_utils::stricmp(legacyTrusted, nm) == 0 && (p == PROTOCOL_VERSION11 || p == PROTOCOL_VERSION12)) { - return true; + return PLUGIN_TRUSTED; } const char* legacyAuth = "LEGACY_AUTH"; if (fb_utils::stricmp(legacyAuth, nm) == 0 && p < PROTOCOL_VERSION13) { - return true; + return PLUGIN_LEGACY; } - return false; + return PLUGIN_NEW; } Firebird::PathName ClntAuthBlock::getPluginName() @@ -1183,6 +1183,8 @@ return; } + HANDSHAKE_DEBUG(fprintf(stderr, "Raising exception %d in checkResponse\n", vector[1] ? vector[1] : isc_net_read_err)); + if (!vector[1]) { Firebird::Arg::Gds(isc_net_read_err).raise(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |