From: <ro...@us...> - 2014-04-10 01:39:35
|
Revision: 59415 http://sourceforge.net/p/firebird/code/59415 Author: robocop Date: 2014-04-10 01:39:32 +0000 (Thu, 10 Apr 2014) Log Message: ----------- Experimental way of stopping gbak impersonation in sys tables. Gbak only needs to write to sys tables when it's restoring and only in the first attachment. Second and third attachment are for bringing the DB online and setting the R/O flag. Please test. Modified Paths: -------------- firebird/trunk/src/jrd/vio.cpp Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2014-04-10 01:36:15 UTC (rev 59414) +++ firebird/trunk/src/jrd/vio.cpp 2014-04-10 01:39:32 UTC (rev 59415) @@ -171,6 +171,16 @@ static void update_in_place(thread_db*, jrd_tra*, record_param*, record_param*); static void verb_post(thread_db*, jrd_tra*, record_param*, Record*, const bool, const bool); + +inline void check_gbak_cheating(thread_db* tdbb, const jrd_rel* relation, const char* op) +{ + const ULONG uflags = tdbb->getAttachment()->att_flags; + if ((uflags & ATT_gbak_attachment) && !(uflags & ATT_creator)) + protect_system_table(tdbb, relation, op, true); +} + + + // Pick up relation ids #include "../jrd/ini.h" @@ -1316,6 +1326,8 @@ transaction->tra_flags |= TRA_write; jrd_rel* relation = rpb->rpb_relation; + check_gbak_cheating(tdbb, relation, "DELETE"); + // If we're about to erase a system relation, check to make sure // everything is completely kosher. @@ -2355,6 +2367,8 @@ return; } + check_gbak_cheating(tdbb, relation, "UPDATE"); + // If we're about to modify a system relation, check to make sure // everything is completely kosher. @@ -2928,6 +2942,8 @@ jrd_rel* relation = rpb->rpb_relation; DSC desc, desc2; + check_gbak_cheating(tdbb, relation, "INSERT"); + if (needDfw(tdbb, transaction)) { switch ((RIDS) relation->rel_id) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |