Skip to content

Commit 3ba5e48

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 4d75d25 commit 3ba5e48

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
@@ -262,6 +262,15 @@ Jrd::Attachment::~Attachment()
262262
}
263263

264264

265+
bool Attachment::locksmith(thread_db* tdbb, SystemPrivilege sp) const
266+
{
267+
if (tdbb->tdbb_flags & TDBB_replicator)
268+
return true;
269+
270+
const auto user = getEffectiveUserId();
271+
return (user && user->locksmith(tdbb, sp));
272+
}
273+
265274
Jrd::PreparedStatement* Jrd::Attachment::prepareStatement(thread_db* tdbb, jrd_tra* transaction,
266275
const string& text, Firebird::MemoryPool* pool)
267276
{

src/jrd/Attachment.h

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

834834

835-
inline bool Attachment::locksmith(thread_db* tdbb, SystemPrivilege sp) const
836-
{
837-
const auto user = getEffectiveUserId();
838-
return (user && user->locksmith(tdbb, sp));
839-
}
840-
841835
inline jrd_tra* Attachment::getSysTransaction() noexcept
842836
{
843837
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, const MetaName& s
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)