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

Backported fix for CORE-3736: WITH LOCK clause is allowed for users with read-only rights on some table, thus blocking others from updating this table

This commit is contained in:
alexpeshkoff 2012-01-19 15:34:03 +00:00
parent 6da2d8494e
commit a2663437b9

View File

@ -916,6 +916,24 @@ RecordSource* OPT_compile(thread_db* tdbb,
rsb = gen_first(tdbb, opt, rsb, rse->rse_first); rsb = gen_first(tdbb, opt, rsb, rse->rse_first);
} }
if (rse->rse_writelock)
{
rsb->rsb_flags |= rsb_writelock;
for (USHORT i = 1; i <= streams[0]; ++i)
{
const USHORT stream = streams[i];
CompilerScratch::csb_repeat* r = &csb->csb_rpt[stream];
if (r->csb_relation)
{
CMP_post_access(tdbb, csb, r->csb_relation->rel_security_name,
r->csb_view ? r->csb_view->rel_id : 0,
SCL_sql_update, "TABLE", r->csb_relation->rel_name);
}
}
}
// release memory allocated for index descriptions // release memory allocated for index descriptions
for (i = 1; i <= streams[0]; ++i) { for (i = 1; i <= streams[0]; ++i) {
stream = streams[i]; stream = streams[i];
@ -953,9 +971,6 @@ RecordSource* OPT_compile(thread_db* tdbb,
throw; throw;
} }
if (rse->rse_writelock)
rsb->rsb_flags |= rsb_writelock;
// Assign pointer to list of dependent invariant values // Assign pointer to list of dependent invariant values
rsb->rsb_invariants = rse->rse_invariants; rsb->rsb_invariants = rse->rse_invariants;