Skip to content

Commit 39b87b3

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 770d054 commit 39b87b3

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
@@ -312,6 +312,15 @@ Jrd::Attachment::~Attachment()
312312
}
313313

314314

315+
bool Attachment::locksmith(thread_db* tdbb, SystemPrivilege sp) const
316+
{
317+
if (tdbb->tdbb_flags & TDBB_replicator)
318+
return true;
319+
320+
const auto user = getEffectiveUserId();
321+
return (user && user->locksmith(tdbb, sp));
322+
}
323+
315324
Jrd::PreparedStatement* Jrd::Attachment::prepareStatement(thread_db* tdbb, jrd_tra* transaction,
316325
const string& text, Firebird::MemoryPool* pool)
317326
{

src/jrd/Attachment.h

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

837837

838-
inline bool Attachment::locksmith(thread_db* tdbb, SystemPrivilege sp) const
839-
{
840-
const auto user = getEffectiveUserId();
841-
return (user && user->locksmith(tdbb, sp));
842-
}
843-
844838
inline jrd_tra* Attachment::getSysTransaction()
845839
{
846840
return att_sys_transaction;

src/jrd/scl.epp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,6 @@ void SCL_check_access(thread_db* tdbb,
228228
**************************************/
229229
SET_TDBB(tdbb);
230230

231-
// Allow the replicator any access to database, its permissions are already validated
232-
if (tdbb->tdbb_flags & TDBB_replicator)
233-
return;
234-
235231
const MetaName& userName = s_class->sclClassUser.second;
236232

237233
if (s_class && (s_class->scl_flags & SCL_corrupt))
@@ -291,10 +287,6 @@ void SCL_check_create_access(thread_db* tdbb, int type)
291287
**************************************/
292288
SET_TDBB(tdbb);
293289

294-
// Allow the replicator any access to database, its permissions are already validated
295-
if (tdbb->tdbb_flags & TDBB_replicator)
296-
return;
297-
298290
Jrd::Attachment* const attachment = tdbb->getAttachment();
299291

300292
// Allow the locksmith any access to database

0 commit comments

Comments
 (0)