2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
"""
|
|
|
|
ID: issue-544
|
|
|
|
ISSUE: 544
|
|
|
|
TITLE: Too many grants lose privileges
|
|
|
|
DESCRIPTION:
|
|
|
|
Issuing more than 2000 grants on any one object causes
|
|
|
|
an internal buffer flow in generating the access
|
|
|
|
control list that actually enforces the rights.
|
|
|
|
JIRA: CORE-216
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_0216
|
2022-01-18 20:45:21 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
init_script = """create table T (PK integer);
|
2021-04-26 20:07:00 +02:00
|
|
|
create table LOG(PK integer);
|
|
|
|
"""
|
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
db = db_factory(page_size=4096, init=init_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
act = python_act('db')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=2.5')
|
2022-01-18 20:45:21 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
with act.db.connect() as con:
|
2021-11-10 19:02:05 +01:00
|
|
|
c = con.cursor()
|
|
|
|
# Create 4000 triggers on table T
|
|
|
|
i = 1
|
|
|
|
cmd = """create trigger LOGT_%d for T after insert as
|
|
|
|
begin
|
|
|
|
insert into log (PK) values (new.pk);
|
|
|
|
end
|
2022-01-18 20:45:21 +01:00
|
|
|
"""
|
2021-11-10 19:02:05 +01:00
|
|
|
while i <= 4000:
|
|
|
|
c.execute(cmd % i)
|
|
|
|
i += 1
|
|
|
|
con.commit()
|
|
|
|
# Grants
|
|
|
|
i = 1
|
|
|
|
cmd = """GRANT INSERT ON LOG TO TRIGGER LOGT_%d"""
|
|
|
|
while i <= 4000:
|
|
|
|
c.execute(cmd % i)
|
|
|
|
i += 1
|
|
|
|
con.commit()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
|