From 767934ad4afcab5a467b103a25f545ec74c41ffa Mon Sep 17 00:00:00 2001 From: kailixu Date: Fri, 31 May 2024 17:50:57 +0800 Subject: [PATCH] enh: support createdb permission for user --- include/common/trow.h | 1 - source/client/src/clientEnv.c | 1 + source/dnode/mnode/impl/src/mndDb.c | 7 ++++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/common/trow.h b/include/common/trow.h index 92713e8e63..e43c67f931 100644 --- a/include/common/trow.h +++ b/include/common/trow.h @@ -289,7 +289,6 @@ int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValT */ static FORCE_INLINE void tdSRowInit(SRowBuilder *pBuilder, int16_t sver) { - pBuilder->rowType = pBuilder->rowType; pBuilder->sver = sver; } int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols, int32_t flen); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 439103e5c4..ce3af827e1 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -330,6 +330,7 @@ void *createRequest(uint64_t connId, int32_t type, int64_t reqid) { } SSyncQueryParam *interParam = taosMemoryCalloc(1, sizeof(SSyncQueryParam)); if (interParam == NULL) { + releaseTscObj(connId); doDestroyRequest(pRequest); terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index ad596289de..d12f73cee6 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -874,9 +874,6 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { } #endif mInfo("db:%s, start to create, vgroups:%d", createReq.db, createReq.numOfVgroups); - if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_DB, NULL) != 0) { - goto _OVER; - } pDb = mndAcquireDb(pMnode, createReq.db); if (pDb != NULL) { @@ -901,6 +898,10 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { } } + if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_DB, NULL) != 0) { + goto _OVER; + } + if ((terrno = grantCheck(TSDB_GRANT_DB)) != 0) { code = terrno; goto _OVER;