Skip to content

Commit 97856dc

Browse files
committed
Treat internal replicator operations as locksmith-allowed. This ensures that replicated DDL never fails due to permission checks. Cleanup replicator checks from SCL, they become redundant now. This fixes #8867: Replication stops if GRANT issued by NON-DBA user who has ADMIN role and appropriate object (table, etc) belongs to another user
1 parent d089813 commit 97856dc

3 files changed

Lines changed: 9 additions & 14 deletions

File tree

src/jrd/Attachment.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,15 @@ Jrd::Attachment::~Attachment()
315315
}
316316

317317

318+
bool Attachment::locksmith(thread_db* tdbb, SystemPrivilege sp) const
319+
{
320+
if (tdbb->tdbb_flags & TDBB_replicator)
321+
return true;
322+
323+
const auto user = getEffectiveUserId();
324+
return (user && user->locksmith(tdbb, sp));
325+
}
326+
318327
Jrd::PreparedStatement* Jrd::Attachment::prepareStatement(thread_db* tdbb, jrd_tra* transaction,
319328
const string& text, Firebird::MemoryPool* pool)
320329
{

src/jrd/Attachment.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -870,12 +870,6 @@ class Attachment : public pool_alloc<type_att>
870870
};
871871

872872

873-
inline bool Attachment::locksmith(thread_db* tdbb, SystemPrivilege sp) const
874-
{
875-
const auto user = getEffectiveUserId();
876-
return (user && user->locksmith(tdbb, sp));
877-
}
878-
879873
inline jrd_tra* Attachment::getSysTransaction()
880874
{
881875
return att_sys_transaction;

src/jrd/scl.epp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ void SCL_check_access(thread_db* tdbb,
159159
**************************************/
160160
SET_TDBB(tdbb);
161161

162-
// Allow the replicator any access to database, its permissions are already validated
163-
if (tdbb->tdbb_flags & TDBB_replicator)
164-
return;
165-
166162
const MetaName& userName = s_class->sclClassUser.second;
167163

168164
if (s_class && (s_class->scl_flags & SCL_corrupt))
@@ -222,10 +218,6 @@ void SCL_check_create_access(thread_db* tdbb, ObjectType type)
222218
**************************************/
223219
SET_TDBB(tdbb);
224220

225-
// Allow the replicator any access to database, its permissions are already validated
226-
if (tdbb->tdbb_flags & TDBB_replicator)
227-
return;
228-
229221
Jrd::Attachment* const attachment = tdbb->getAttachment();
230222

231223
// Allow the locksmith any access to database

0 commit comments

Comments
 (0)