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

Anti isc_random pass

This commit is contained in:
alexpeshkoff 2012-06-29 12:44:41 +00:00
parent d244ba5e9d
commit 9bf5e60dfa
13 changed files with 151 additions and 23 deletions

View File

@ -1478,6 +1478,30 @@ C --
PARAMETER (GDS__wroblrver2 = 335545032)
INTEGER*4 GDS__trunc_limits
PARAMETER (GDS__trunc_limits = 335545033)
INTEGER*4 GDS__info_access
PARAMETER (GDS__info_access = 335545034)
INTEGER*4 GDS__svc_no_stdin
PARAMETER (GDS__svc_no_stdin = 335545035)
INTEGER*4 GDS__svc_start_failed
PARAMETER (GDS__svc_start_failed = 335545036)
INTEGER*4 GDS__svc_no_switches
PARAMETER (GDS__svc_no_switches = 335545037)
INTEGER*4 GDS__svc_bad_size
PARAMETER (GDS__svc_bad_size = 335545038)
INTEGER*4 GDS__no_crypt_plugin
PARAMETER (GDS__no_crypt_plugin = 335545039)
INTEGER*4 GDS__cp_name_too_long
PARAMETER (GDS__cp_name_too_long = 335545040)
INTEGER*4 GDS__cp_process_active
PARAMETER (GDS__cp_process_active = 335545041)
INTEGER*4 GDS__cp_already_crypted
PARAMETER (GDS__cp_already_crypted = 335545042)
INTEGER*4 GDS__decrypt_error
PARAMETER (GDS__decrypt_error = 335545043)
INTEGER*4 GDS__no_providers
PARAMETER (GDS__no_providers = 335545044)
INTEGER*4 GDS__null_spb
PARAMETER (GDS__null_spb = 335545045)
INTEGER*4 GDS__gfix_db_name
PARAMETER (GDS__gfix_db_name = 335740929)
INTEGER*4 GDS__gfix_invalid_sw

View File

@ -746,6 +746,18 @@ const
gds_libtommath_generic = 335545031;
gds_wroblrver2 = 335545032;
gds_trunc_limits = 335545033;
gds_info_access = 335545034;
gds_svc_no_stdin = 335545035;
gds_svc_start_failed = 335545036;
gds_svc_no_switches = 335545037;
gds_svc_bad_size = 335545038;
gds_no_crypt_plugin = 335545039;
gds_cp_name_too_long = 335545040;
gds_cp_process_active = 335545041;
gds_cp_already_crypted = 335545042;
gds_decrypt_error = 335545043;
gds_no_providers = 335545044;
gds_null_spb = 335545045;
gds_gfix_db_name = 335740929;
gds_gfix_invalid_sw = 335740930;
gds_gfix_incmp_sw = 335740932;

View File

@ -735,6 +735,18 @@ static const struct {
{"libtommath_generic", 335545031},
{"wroblrver2", 335545032},
{"trunc_limits", 335545033},
{"info_access", 335545034},
{"svc_no_stdin", 335545035},
{"svc_start_failed", 335545036},
{"svc_no_switches", 335545037},
{"svc_bad_size", 335545038},
{"no_crypt_plugin", 335545039},
{"cp_name_too_long", 335545040},
{"cp_process_active", 335545041},
{"cp_already_crypted", 335545042},
{"decrypt_error", 335545043},
{"no_providers", 335545044},
{"null_spb", 335545045},
{"gfix_db_name", 335740929},
{"gfix_invalid_sw", 335740930},
{"gfix_incmp_sw", 335740932},

View File

@ -769,6 +769,18 @@ const ISC_STATUS isc_protect_sys_tab = 335545030L;
const ISC_STATUS isc_libtommath_generic = 335545031L;
const ISC_STATUS isc_wroblrver2 = 335545032L;
const ISC_STATUS isc_trunc_limits = 335545033L;
const ISC_STATUS isc_info_access = 335545034L;
const ISC_STATUS isc_svc_no_stdin = 335545035L;
const ISC_STATUS isc_svc_start_failed = 335545036L;
const ISC_STATUS isc_svc_no_switches = 335545037L;
const ISC_STATUS isc_svc_bad_size = 335545038L;
const ISC_STATUS isc_no_crypt_plugin = 335545039L;
const ISC_STATUS isc_cp_name_too_long = 335545040L;
const ISC_STATUS isc_cp_process_active = 335545041L;
const ISC_STATUS isc_cp_already_crypted = 335545042L;
const ISC_STATUS isc_decrypt_error = 335545043L;
const ISC_STATUS isc_no_providers = 335545044L;
const ISC_STATUS isc_null_spb = 335545045L;
const ISC_STATUS isc_gfix_db_name = 335740929L;
const ISC_STATUS isc_gfix_invalid_sw = 335740930L;
const ISC_STATUS isc_gfix_incmp_sw = 335740932L;
@ -1212,7 +1224,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 = 1156;
const ISC_STATUS isc_err_max = 1168;
#else /* c definitions */
@ -1951,6 +1963,18 @@ const ISC_STATUS isc_err_max = 1156;
#define isc_libtommath_generic 335545031L
#define isc_wroblrver2 335545032L
#define isc_trunc_limits 335545033L
#define isc_info_access 335545034L
#define isc_svc_no_stdin 335545035L
#define isc_svc_start_failed 335545036L
#define isc_svc_no_switches 335545037L
#define isc_svc_bad_size 335545038L
#define isc_no_crypt_plugin 335545039L
#define isc_cp_name_too_long 335545040L
#define isc_cp_process_active 335545041L
#define isc_cp_already_crypted 335545042L
#define isc_decrypt_error 335545043L
#define isc_no_providers 335545044L
#define isc_null_spb 335545045L
#define isc_gfix_db_name 335740929L
#define isc_gfix_invalid_sw 335740930L
#define isc_gfix_incmp_sw 335740932L
@ -2394,7 +2418,7 @@ const ISC_STATUS isc_err_max = 1156;
#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 1156
#define isc_err_max 1168
#endif

View File

@ -738,6 +738,18 @@ Data source : @4"}, /* eds_statement */
{335545031, "Libtommath error code @1 in function @2"}, /* libtommath_generic */
{335545032, "unsupported BLR version (expected between @1 and @2, encountered @3)"}, /* wroblrver2 */
{335545033, "expected length @1, actual @2"}, /* trunc_limits */
{335545034, "Wrong info requested in isc_svc_query() for anonymous service"}, /* info_access */
{335545035, "No isc_info_svc_stdin in user request, but service thread requested stdin data"}, /* svc_no_stdin */
{335545036, "Start request for anonymous service is impossible"}, /* svc_start_failed */
{335545037, ""}, /* svc_no_switches */
{335545038, "Size of stdin data is more than was requested from client"}, /* svc_bad_size */
{335545039, "Crypt plugin @1 failed to load"}, /* no_crypt_plugin */
{335545040, "Length of crypt plugin name should not exceed @1 byte"}, /* cp_name_too_long */
{335545041, "Crypt failed - already crypting database"}, /* cp_process_active */
{335545042, "Crypt failed - database is already in requested state"}, /* cp_already_crypted */
{335545043, "Missing crypt plugin, but page appears encrypted"}, /* decrypt_error */
{335545044, "No providers loaded"}, /* no_providers */
{335545045, "NULL data with non-zero SPB length"}, /* null_spb */
{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

@ -733,7 +733,19 @@ static const struct {
{335545030, -902}, /* 710 protect_sys_tab */
{335545031, -901}, /* 711 libtommath_generic */
{335545032, -902}, /* 712 wroblrver2 */
{335545033, -802}, /* 713 trunc_limits */
{335545033, -551}, /* 713 trunc_limits */
{335545034, -551}, /* 714 info_access */
{335545035, -104}, /* 715 svc_no_stdin */
{335545036, -551}, /* 716 svc_start_failed */
{335545037, -104}, /* 717 svc_no_switches */
{335545038, -104}, /* 718 svc_bad_size */
{335545039, -104}, /* 719 no_crypt_plugin */
{335545040, -104}, /* 720 cp_name_too_long */
{335545041, -901}, /* 721 cp_process_active */
{335545042, -901}, /* 722 cp_already_crypted */
{335545043, -902}, /* 723 decrypt_error */
{335545044, -902}, /* 724 no_providers */
{335545045, -104}, /* 725 null_spb */
{335740929, -901}, /* 1 gfix_db_name */
{335740930, -901}, /* 2 gfix_invalid_sw */
{335740932, -901}, /* 4 gfix_incmp_sw */

View File

@ -733,7 +733,19 @@ static const struct {
{335545030, "42000"}, // 710 protect_sys_tab
{335545031, "2F000"}, // 711 libtommath_generic
{335545032, "HY000"}, // 712 wroblrver2
{335545033, "22001"}, // 713 trunc_limits
{335545033, "28000"}, // 713 trunc_limits
{335545034, "28000"}, // 714 info_access
{335545035, "HY024"}, // 715 svc_no_stdin
{335545036, "28000"}, // 716 svc_start_failed
{335545037, "HY024"}, // 717 svc_no_switches
{335545038, "HY109"}, // 718 svc_bad_size
{335545039, "HY024"}, // 719 no_crypt_plugin
{335545040, "22001"}, // 720 cp_name_too_long
{335545041, "42818"}, // 721 cp_process_active
{335545042, "42818"}, // 722 cp_already_crypted
{335545043, "39000"}, // 723 decrypt_error
{335545044, "39000"}, // 724 no_providers
{335545045, "42818"}, // 725 null_spb
{335740929, "00000"}, // 1 gfix_db_name
{335740930, "00000"}, // 2 gfix_invalid_sw
{335740932, "00000"}, // 4 gfix_incmp_sw

View File

@ -67,7 +67,7 @@ namespace {
{
if (!header)
{
(Arg::Gds(isc_random) << "Header page fetch failed").raise();
ERR_punt();
}
}
@ -201,8 +201,7 @@ namespace Jrd {
upInfo, dbb.dbb_config, pluginName);
if (!cryptControl.hasData())
{
(Arg::Gds(isc_random) <<
"Invalid crypt plugin name").raise();
(Arg::Gds(isc_no_crypt_plugin) << pluginName).raise();
}
// do not assign cryptPlugin directly before key init complete
@ -216,8 +215,7 @@ namespace Jrd {
{
if (plugName.length() > 31)
{
(Arg::Gds(isc_random) <<
"Crypt plugin name should not be >31 bytes").raise();
(Arg::Gds(isc_cp_name_too_long) << Arg::Num(31)).raise();
}
bool newCryptState = plugName.hasData();
@ -228,15 +226,13 @@ namespace Jrd {
// Check header page for flags
if (hdr->hdr_flags & Ods::hdr_crypt_process)
{
(Arg::Gds(isc_random) <<
"Crypt failed - already crypting database").raise();
(Arg::Gds(isc_cp_process_active)).raise();
}
bool headerCryptState = hdr->hdr_flags & Ods::hdr_encrypted;
if (headerCryptState == newCryptState)
{
(Arg::Gds(isc_random) <<
"Crypt failed - database is already in requested state").raise();
(Arg::Gds(isc_cp_already_crypted)).raise();
}
fb_assert(stateLock);
@ -503,7 +499,7 @@ namespace Jrd {
if (!cryptPlugin)
{
(Arg::Gds(isc_random) << "Not crypt mode, but page appears encrypted").copyTo(sv);
(Arg::Gds(isc_decrypt_error)).raise();
return false;
}
}

View File

@ -1126,7 +1126,7 @@ ISC_STATUS Service::query2(thread_db* /*tdbb*/,
break;
default:
status_exception::raise(Arg::Gds(isc_bad_spb_form) <<
Arg::Gds(isc_random) << "wrong info request for anonymous service");
Arg::Gds(isc_info_access));
break;
}
}
@ -1515,7 +1515,7 @@ ISC_STATUS Service::query2(thread_db* /*tdbb*/,
}
else
{
(Arg::Gds(isc_random) << "No request from user for stdin data").raise();
(Arg::Gds(isc_svc_no_stdin)).raise();
}
}
@ -1971,7 +1971,7 @@ void Service::start(USHORT spb_length, const UCHAR* spb_data)
if (svc_user_flag == SVC_user_none)
{
status_exception::raise(Arg::Gds(isc_bad_spb_form) <<
Arg::Gds(isc_random) << "start request for anonymous service is impossible");
Arg::Gds(isc_svc_start_failed));
}
{ // scope for locked globalServicesMutex
@ -2055,7 +2055,7 @@ void Service::start(USHORT spb_length, const UCHAR* spb_data)
if ((!svc_switches.hasData()) && svc_id != isc_action_svc_get_fb_log)
{
status_exception::raise(Arg::Gds(isc_bad_spb_form) <<
Arg::Gds(isc_random) << "all services except for get_ib_log require switches");
Arg::Gds(isc_svc_no_switches));
}
// Do not let everyone look at server log
@ -2371,7 +2371,7 @@ ULONG Service::put(const UCHAR* buffer, ULONG length)
// check length correctness
if (length > svc_stdin_size_requested && length > svc_stdin_preload_requested)
{
(Arg::Gds(isc_random) << "Size of data is more than requested").raise();
(Arg::Gds(isc_svc_bad_size)).raise();
}
if (svc_stdin_size_requested) // service waits for data from us

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 (?, ?, ?, ?);
--
('2012-06-05 15:01:35', 'JRD', 0, 714)
('2012-06-29 16:14:26', 'JRD', 0, 726)
('2012-01-23 20:10:30', 'QLI', 1, 532)
('2009-07-16 05:26:11', 'GFIX', 3, 121)
('1996-11-07 13:39:40', 'GPRE', 4, 1)

View File

@ -821,6 +821,18 @@ Data source : @4', NULL, NULL)
('libtommath_generic', 'check', 'BigInteger.cpp', NULL, 0, 711, NULL, 'Libtommath error code @1 in function @2', NULL, NULL)
('wroblrver2', NULL, NULL, NULL, 0, 712, NULL, 'unsupported BLR version (expected between @1 and @2, encountered @3)', NULL, NULL);
('trunc_limits', NULL, NULL, NULL, 0, 713, NULL, 'expected length @1, actual @2', NULL, NULL);
('info_access', NULL, 'svc.cpp', NULL, 0, 714, NULL, 'Wrong info requested in isc_svc_query() for anonymous service', NULL, NULL);
('svc_no_stdin', NULL, 'svc.cpp', NULL, 0, 715, NULL, 'No isc_info_svc_stdin in user request, but service thread requested stdin data', NULL, NULL);
('svc_start_failed', NULL, 'svc.cpp', NULL, 0, 716, NULL, 'Start request for anonymous service is impossible', NULL, NULL);
('svc_no_switches', NULL, 'svc.cpp', NULL, 0, 717, NULL, '', NULL, NULL);
('svc_bad_size', NULL, 'svc.cpp', NULL, 0, 718, NULL, 'Size of stdin data is more than was requested from client', NULL, NULL);
('no_crypt_plugin', NULL, 'CryptoManager.cpp', NULL, 0, 719, NULL, 'Crypt plugin @1 failed to load', NULL, NULL);
('cp_name_too_long', NULL, 'CryptoManager.cpp', NULL, 0, 720, NULL, 'Length of crypt plugin name should not exceed @1 byte', NULL, NULL);
('cp_process_active', NULL, 'CryptoManager.cpp', NULL, 0, 721, NULL, 'Crypt failed - already crypting database', NULL, NULL);
('cp_already_crypted', NULL, 'CryptoManager.cpp', NULL, 0, 722, NULL, 'Crypt failed - database is already in requested state', NULL, NULL);
('decrypt_error', NULL, 'CryptoManager.cpp', NULL, 0, 723, NULL, 'Missing crypt plugin, but page appears encrypted', NULL, NULL);
('no_providers', NULL, 'why.cpp', NULL, 0, 724, NULL, 'No providers loaded', NULL, NULL);
('null_spb', NULL, 'why.cpp', NULL, 0, 725, NULL, 'NULL data with non-zero SPB length', 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

@ -719,7 +719,19 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
-- If you have better SQL code for this, change it.
(-901, '2F', '000', 0, 711, 'libtommath_generic', NULL, NULL)
(-902, 'HY', '000', 0, 712, 'wroblrver2', NULL, NULL)
(-802, '22', '001', 0, 713, 'trunc_limits', NULL, NULL)
(-551, '28', '000', 0, 713, 'trunc_limits', NULL, NULL)
(-551, '28', '000', 0, 714, 'info_access', NULL, NULL)
(-104, 'HY', '024', 0, 715, 'svc_no_stdin', NULL, NULL)
(-551, '28', '000', 0, 716, 'svc_start_failed', NULL, NULL)
(-104, 'HY', '024', 0, 717, 'svc_no_switches', NULL, NULL)
(-104, 'HY', '109', 0, 718, 'svc_bad_size', NULL, NULL)
(-104, 'HY', '024', 0, 719, 'no_crypt_plugin', NULL, NULL)
(-104, '22', '001', 0, 720, 'cp_name_too_long', NULL, NULL)
(-901, '42', '818', 0, 721, 'cp_process_active', NULL, NULL)
(-901, '42', '818', 0, 722, 'cp_already_crypted', NULL, NULL)
(-902, '39', '000', 0, 723, 'decrypt_error', NULL, NULL)
(-902, '39', '000', 0, 724, 'no_providers', NULL, NULL)
(-104, '42', '818', 0, 725, 'null_spb', NULL, NULL)
-- GFIX
(-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL)
(-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL)

View File

@ -4602,7 +4602,7 @@ static IService* getServiceManagerByName(IProvider** provider, IStatus* status,
if (status->isSuccess())
{
(Arg::Gds(isc_service_att_err) <<
Arg::Gds(isc_random) << "No providers loaded").copyTo(status);
Arg::Gds(isc_no_providers)).copyTo(status);
}
return NULL;
@ -4974,7 +4974,7 @@ YService* Dispatcher::attachServiceManager(IStatus* status, const char* serviceN
if (spbLength > 0 && !spb)
status_exception::raise(Arg::Gds(isc_bad_spb_form) <<
Arg::Gds(isc_random) << "NULL data with non-zero SPB length");
Arg::Gds(isc_null_spb));
PathName svcName(serviceName);
svcName.trim();