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

Fixed CORE-5047: mapUser() routine establish secondary attach using wrong provider

This commit is contained in:
alexpeshkoff 2015-12-29 14:39:00 +00:00
parent a19a555ad7
commit 0558b970fe
4 changed files with 20 additions and 24 deletions

View File

@ -976,25 +976,19 @@ bool mapUser(string& name, string& trusted_role, Firebird::string* auth_method,
if (db && !iDb)
{
const char* conf = "Providers=" CURRENT_ENGINE;
embeddedSysdba.insertString(isc_dpb_config, conf, fb_strlen(conf));
iDb = prov->attachDatabase(&st, alias,
embeddedSysdba.getBufferLength(), embeddedSysdba.getBuffer());
if (!iDb)
if (st->getState() & IStatus::STATE_ERRORS)
{
iDb = prov->attachDatabase(&st, alias,
embeddedSysdba.getBufferLength(), embeddedSysdba.getBuffer());
const ISC_STATUS* s = st->getErrors();
bool missing = fb_utils::containsErrorCode(s, isc_io_error);
dbDown = fb_utils::containsErrorCode(s, isc_shutdown);
if (!(missing || dbDown))
check("IProvider::attachDatabase", &st);
if (st->getState() & IStatus::STATE_ERRORS)
{
const ISC_STATUS* s = st->getErrors();
bool missing = fb_utils::containsErrorCode(s, isc_io_error);
dbDown = fb_utils::containsErrorCode(s, isc_shutdown);
if (!(missing || dbDown))
check("IProvider::attachDatabase", &st);
// down/missing DB is not a reason to fail mapping
iDb = NULL;
}
// down/missing DB is not a reason to fail mapping
iDb = NULL;
}
}
}

View File

@ -6084,11 +6084,10 @@ static bool get_new_dpb(ClumpletWriter& dpb, const ParametersSet& par)
* Analyze and prepare dpb for attachment to remote server.
*
**************************************/
if (!Config::getRedirection())
{
if (dpb.find(par.address_path)) {
status_exception::raise(Arg::Gds(isc_unavailable));
}
bool redirection = Config::getRedirection();
if (((!redirection) && dpb.find(par.address_path)) || dpb.find(par.map_attach))
{
status_exception::raise(Arg::Gds(isc_unavailable));
}
return dpb.find(par.user_name);

View File

@ -68,7 +68,8 @@ const ParametersSet dpbParam =
isc_dpb_host_name,
isc_dpb_os_user,
isc_dpb_config,
isc_dpb_utf8_filename
isc_dpb_utf8_filename,
isc_dpb_map_attach
};
const ParametersSet spbParam =
@ -91,7 +92,8 @@ const ParametersSet spbParam =
isc_spb_host_name,
isc_spb_os_user,
isc_spb_config,
isc_spb_utf8_filename
isc_spb_utf8_filename,
0
};
const ParametersSet connectParam =
@ -114,6 +116,7 @@ const ParametersSet connectParam =
CNCT_host,
CNCT_user,
0,
0,
0
};

View File

@ -142,7 +142,7 @@ struct ParametersSet
address_path, process_id, process_name,
encrypt_key, client_version, remote_protocol,
host_name, os_user, config_text,
utf8_filename;
utf8_filename, map_attach;
};
extern const ParametersSet dpbParam, spbParam, connectParam;