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

Fixed CORE-5793: Error returned from DbCryptPlugin::setKey() is not shown

This commit is contained in:
Alex Peshkoff 2018-08-29 18:52:10 +03:00
parent b2c0b443e4
commit f97bb71781
13 changed files with 57 additions and 4 deletions

View File

@ -1830,6 +1830,8 @@ C --
PARAMETER (GDS__ses_reset_warn = 335545208)
INTEGER*4 GDS__ses_reset_tran_rollback
PARAMETER (GDS__ses_reset_tran_rollback = 335545209)
INTEGER*4 GDS__plugin_name
PARAMETER (GDS__plugin_name = 335545210)
INTEGER*4 GDS__gfix_db_name
PARAMETER (GDS__gfix_db_name = 335740929)
INTEGER*4 GDS__gfix_invalid_sw

View File

@ -1825,6 +1825,8 @@ const
gds_ses_reset_warn = 335545208;
isc_ses_reset_tran_rollback = 335545209;
gds_ses_reset_tran_rollback = 335545209;
isc_plugin_name = 335545210;
gds_plugin_name = 335545210;
isc_gfix_db_name = 335740929;
gds_gfix_db_name = 335740929;
isc_gfix_invalid_sw = 335740930;

View File

@ -298,6 +298,32 @@ void StatusVector::ImplStatusVector::copyTo(IStatus* dest) const throw()
}
}
void StatusVector::ImplStatusVector::appendTo(IStatus* dest) const throw()
{
if (hasData())
{
ImplStatusVector tmpVector(dest);
ImplStatusVector newVector(getKind(), getCode());
if (newVector.appendErrors(&tmpVector))
{
if (newVector.appendErrors(this))
{
if (newVector.appendWarnings(&tmpVector))
newVector.appendWarnings(this);
}
}
// take special care about strings safety
// that's why tmpStatus is needed here
AutoPtr<IStatus, SimpleDispose> tmpStatus(dest->clone());
newVector.copyTo(tmpStatus);
dest->setErrors(tmpStatus->getErrors());
dest->setWarnings(tmpStatus->getWarnings());
}
}
Gds::Gds(ISC_STATUS s) throw() :
StatusVector(isc_arg_gds, s) { }

View File

@ -73,6 +73,7 @@ protected:
virtual void assign(const Exception& ex) throw() { }
virtual ISC_STATUS copyTo(ISC_STATUS*) const throw() { return 0; }
virtual void copyTo(IStatus*) const throw() { }
virtual void appendTo(IStatus*) const throw() { }
virtual void shiftLeft(const Base&) throw() { }
virtual void shiftLeft(const Warning&) throw() { }
@ -123,6 +124,7 @@ protected:
virtual void assign(const Exception& ex) throw();
virtual ISC_STATUS copyTo(ISC_STATUS* dest) const throw();
virtual void copyTo(IStatus* dest) const throw();
virtual void appendTo(IStatus* dest) const throw();
virtual void shiftLeft(const Base& arg) throw();
virtual void shiftLeft(const Warning& arg) throw();
virtual void shiftLeft(const char* text) throw();
@ -164,6 +166,7 @@ public:
void raise() const;
ISC_STATUS copyTo(ISC_STATUS* dest) const throw() { return implementation->copyTo(dest); }
void copyTo(IStatus* dest) const throw() { implementation->copyTo(dest); }
void appendTo(IStatus* dest) const throw() { implementation->appendTo(dest); }
// generic argument insert
StatusVector& operator<<(const Base& arg) throw()

View File

@ -911,6 +911,7 @@ static const struct {
{"ses_reset_open_trans", 335545207},
{"ses_reset_warn", 335545208},
{"ses_reset_tran_rollback", 335545209},
{"plugin_name", 335545210},
{"gfix_db_name", 335740929},
{"gfix_invalid_sw", 335740930},
{"gfix_incmp_sw", 335740932},

View File

@ -945,6 +945,7 @@ const ISC_STATUS isc_ses_reset_err = 335545206L;
const ISC_STATUS isc_ses_reset_open_trans = 335545207L;
const ISC_STATUS isc_ses_reset_warn = 335545208L;
const ISC_STATUS isc_ses_reset_tran_rollback = 335545209L;
const ISC_STATUS isc_plugin_name = 335545210L;
const ISC_STATUS isc_gfix_db_name = 335740929L;
const ISC_STATUS isc_gfix_invalid_sw = 335740930L;
const ISC_STATUS isc_gfix_incmp_sw = 335740932L;
@ -1419,7 +1420,7 @@ const ISC_STATUS isc_trace_switch_user_only = 337182757L;
const ISC_STATUS isc_trace_switch_param_miss = 337182758L;
const ISC_STATUS isc_trace_param_act_notcompat = 337182759L;
const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L;
const ISC_STATUS isc_err_max = 1363;
const ISC_STATUS isc_err_max = 1364;
#else /* c definitions */
@ -2334,6 +2335,7 @@ const ISC_STATUS isc_err_max = 1363;
#define isc_ses_reset_open_trans 335545207L
#define isc_ses_reset_warn 335545208L
#define isc_ses_reset_tran_rollback 335545209L
#define isc_plugin_name 335545210L
#define isc_gfix_db_name 335740929L
#define isc_gfix_invalid_sw 335740930L
#define isc_gfix_incmp_sw 335740932L
@ -2808,7 +2810,7 @@ const ISC_STATUS isc_err_max = 1363;
#define isc_trace_switch_param_miss 337182758L
#define isc_trace_param_act_notcompat 337182759L
#define isc_trace_mandatory_switch_miss 337182760L
#define isc_err_max 1363
#define isc_err_max 1364
#endif

View File

@ -914,6 +914,7 @@ Data source : @4"}, /* eds_statement */
{335545207, "There are open transactions (@1 active)"}, /* ses_reset_open_trans */
{335545208, "Session was reset with warning(s)"}, /* ses_reset_warn */
{335545209, "Transaction is rolled back due to session reset, all changes are lost"}, /* ses_reset_tran_rollback */
{335545210, "Plugin @1:"}, /* plugin_name */
{335740929, "data base file name (@1) already given"}, /* gfix_db_name */
{335740930, "invalid switch @1"}, /* gfix_invalid_sw */
{335740932, "incompatible switch combination"}, /* gfix_incmp_sw */

View File

@ -910,6 +910,7 @@ static const struct {
{335545207, -901}, /* 887 ses_reset_open_trans */
{335545208, -901}, /* 888 ses_reset_warn */
{335545209, -901}, /* 889 ses_reset_tran_rollback */
{335545210, -901}, /* 890 plugin_name */
{335740929, -901}, /* 1 gfix_db_name */
{335740930, -901}, /* 2 gfix_invalid_sw */
{335740932, -901}, /* 4 gfix_incmp_sw */

View File

@ -910,6 +910,7 @@ static const struct {
{335545207, "25S02"}, // 887 ses_reset_open_trans
{335545208, "01000"}, // 888 ses_reset_warn
{335545209, "01102"}, // 889 ses_reset_tran_rollback
{335545210, "00000"}, // 890 plugin_name
{335740929, "00000"}, // 1 gfix_db_name
{335740930, "00000"}, // 2 gfix_invalid_sw
{335740932, "00000"}, // 4 gfix_incmp_sw

View File

@ -422,6 +422,8 @@ namespace Jrd {
bool fLoad = false, fTry = false;
bool holderLess = false;
FbLocalStatus errorVector;
Arg::Gds(isc_db_crypt_key).copyTo(&errorVector);
for (GetPlugins<IKeyHolderPlugin> keyControl(IPluginManager::TYPE_KEY_HOLDER, dbb.dbb_config);
keyControl.hasData(); keyControl.next())
{
@ -445,6 +447,11 @@ namespace Jrd {
fLoad = true;
break;
}
else
{
(Arg::Gds(isc_plugin_name) << keyControl.name() <<
Arg::StatusVector(&st)).appendTo(&errorVector);
}
}
if (!fTry)
@ -456,10 +463,15 @@ namespace Jrd {
holderLess = true;
fLoad = true;
}
else
{
(Arg::Gds(isc_plugin_name) << plugName <<
Arg::StatusVector(&status)).appendTo(&errorVector);
}
}
if (!fLoad)
Arg::Gds(isc_db_crypt_key).raise();
errorVector.raise();
cryptPlugin = p;
cryptPlugin->addRef();

View File

@ -1,7 +1,7 @@
/* MAX_NUMBER is the next number to be used, always one more than the highest message number. */
set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES (?, ?, ?, ?);
--
('2018-06-06 11:00:00', 'JRD', 0, 890)
('2018-08-29 14:16:00', 'JRD', 0, 891)
('2015-03-17 18:33:00', 'QLI', 1, 533)
('2015-01-07 18:01:51', 'GFIX', 3, 134)
('1996-11-07 13:39:40', 'GPRE', 4, 1)

View File

@ -997,6 +997,7 @@ Data source : @4', NULL, NULL)
('ses_reset_open_trans', NULL, 'Attachment.cpp', NULL, 0, 887, NULL, 'There are open transactions (@1 active)', NULL, NULL);
('ses_reset_warn', NULL, 'Attachment.cpp', NULL, 0, 888, NULL, 'Session was reset with warning(s)', NULL, NULL);
('ses_reset_tran_rollback', NULL, 'Attachment.cpp', NULL, 0, 889, NULL, 'Transaction is rolled back due to session reset, all changes are lost', NULL, NULL);
('plugin_name', NULL, 'CryptoManager.cpp', NULL, 0, 890, NULL, 'Plugin @1:', NULL, NULL);
-- QLI
(NULL, NULL, NULL, NULL, 1, 0, NULL, 'expected type', NULL, NULL);
(NULL, NULL, NULL, NULL, 1, 1, NULL, 'bad block type', NULL, NULL);

View File

@ -896,6 +896,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
(-901, '25', 'S02', 0, 887, 'ses_reset_open_trans', NULL, 'ERROR')
(-901, '01', '000', 0, 888, 'ses_reset_warn', NULL, 'WARNING')
(-901, '01', '102', 0, 889, 'ses_reset_tran_rollback', NULL, 'WARNING')
(-901, '00', '000', 0, 890, 'plugin_name', NULL, NULL)
-- GFIX
(-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL)
(-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL)