From c0c98320f323b0c186e0cd3ea4ed50464f16b0f1 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 8 Dec 2022 17:14:17 +0800 Subject: [PATCH] enh: check topic privilege --- source/dnode/mnode/impl/src/mndConsumer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 76bff9a70f..373a653b51 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -555,6 +555,12 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { } if (mndCheckDbPrivilegeByName(pMnode, pMsg->info.conn.user, MND_OPER_READ_DB, pTopic->db) != 0) { + mndReleaseTopic(pMnode, pTopic); + goto SUBSCRIBE_OVER; + } + + if (mndCheckTopicPrivilege(pMnode, pMsg->info.conn.user, MND_OPER_SUBSCRIBE, pTopic) != 0) { + mndReleaseTopic(pMnode, pTopic); goto SUBSCRIBE_OVER; }