From 1dd176e31c519387acf95943c0a596178d2abcd1 Mon Sep 17 00:00:00 2001 From: Roman Simakov Date: Tue, 25 Jun 2019 12:34:15 +0300 Subject: [PATCH] Using effective user as grantor instead of current one. --- src/dsql/DdlNodes.epp | 2 +- src/jrd/Attachment.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dsql/DdlNodes.epp b/src/dsql/DdlNodes.epp index ecd6353820..59bb0a6c98 100644 --- a/src/dsql/DdlNodes.epp +++ b/src/dsql/DdlNodes.epp @@ -11693,7 +11693,7 @@ void GrantRevokeNode::grantRevoke(thread_db* tdbb, jrd_tra* transaction, const G (Arg::PrivateDyn(295) << DBA_USER_NAME << owner).raise(); } - MetaName currentUser(attachment->att_user->getUserName()); + MetaName currentUser(attachment->getEffectiveUserId()->getUserName()); MetaName grantorRevoker(grantor ? *grantor : currentUser); if (!isGrant && !privs) // REVOKE ALL ON ALL diff --git a/src/jrd/Attachment.h b/src/jrd/Attachment.h index 63536565bb..4eb94453e2 100644 --- a/src/jrd/Attachment.h +++ b/src/jrd/Attachment.h @@ -592,6 +592,14 @@ public: UserId* getUserId(const Firebird::MetaName &userName); + const UserId* getEffectiveUserId() const + { + if (att_ss_user) + return att_ss_user; + return att_user; + } + + private: Attachment(MemoryPool* pool, Database* dbb, const InitialOptions* initialOptions); ~Attachment();