From 5b69e22e9b111784d7ef577a4bbda7786939f91c Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 19 Feb 2024 16:29:40 +0800 Subject: [PATCH 1/2] fix: grant check for streams --- source/dnode/mnode/impl/src/mndStream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 190b4f28ce..5bf1a70749 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -634,7 +634,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { terrno = TSDB_CODE_SUCCESS; if ((terrno = grantCheck(TSDB_GRANT_STREAMS)) < 0) { - goto _OVER; + return terrno; } SCMCreateStreamReq createReq = {0}; From c0cb72ca5652a71b1ead69cfb34ae39e2feacade Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 19 Feb 2024 18:28:50 +0800 Subject: [PATCH 2/2] feat: grant check for topic/subscription --- source/dnode/mnode/impl/src/mndConsumer.c | 5 ----- source/dnode/mnode/impl/src/mndTopic.c | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index c7ae36b02c..e8458a2fdc 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -552,11 +552,6 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { char *msgStr = pMsg->pCont; int32_t code = -1; - if ((terrno = grantCheck(TSDB_GRANT_SUBSCRIPTION)) < 0) { - code = terrno; - return code; - } - SCMSubscribeReq subscribe = {0}; tDeserializeSCMSubscribeReq(msgStr, &subscribe); diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 0d23db09e5..de543f4256 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -564,6 +564,10 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) { return code; } + if ((terrno = grantCheck(TSDB_GRANT_SUBSCRIPTION)) < 0) { + return code; + } + if (tDeserializeSCMCreateTopicReq(pReq->pCont, pReq->contLen, &createTopicReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER;