diff --git a/src/mnode/src/mgmtShell.c b/src/mnode/src/mgmtShell.c index 193521b0260c42213f3d07578fa129a33c206f65..08ea74c9f6bf9774649837e72051b77037e35b38 100644 --- a/src/mnode/src/mgmtShell.c +++ b/src/mnode/src/mgmtShell.c @@ -375,7 +375,7 @@ static int mgmtShellRetriveAuth(char *user, char *spi, char *encrypt, char *secr if (!sdbIsMaster()) { *secret = 0; - return TSDB_CODE_SUCCESS; + return TSDB_CODE_NOT_READY; } SUserObj *pUser = mgmtGetUser(user); @@ -594,4 +594,4 @@ void* mgmtCloneQueuedMsg(SQueuedMsg *pSrcMsg) { pSrcMsg->pUser = NULL; return pDestMsg; -} \ No newline at end of file +} diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index dfb549b3f9c914fefa396a6cefcd974bc11eff97..3bc20bf2d8096fd6843c21e1b1db44d9181e89d4 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -613,11 +613,13 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) { pConn->tranId = (uint16_t)(rand() & 0xFFFF); pConn->ownId = htonl(pConn->sid); pConn->linkUid = pHead->linkUid; - if (pRpc->afp && (*pRpc->afp)(pConn->user, &pConn->spi, &pConn->encrypt, pConn->secret, pConn->ckey) < 0) { - tWarn("%s %p, user not there", pRpc->label, pConn); - taosFreeId(pRpc->idPool, sid); // sid shall be released - terrno = TSDB_CODE_INVALID_USER; - pConn = NULL; + if (pRpc->afp) { + terrno = (*pRpc->afp)(pConn->user, &pConn->spi, &pConn->encrypt, pConn->secret, pConn->ckey); + if (terrno != 0) { + tWarn("%s %p, user not there or server not ready", pRpc->label, pConn); + taosFreeId(pRpc->idPool, sid); // sid shall be released + pConn = NULL; + } } } @@ -1334,7 +1336,8 @@ static int rpcCheckAuthentication(SRpcConn *pConn, char *msg, int msgLen) { if ( !rpcIsReq(pHead->msgType) ) { // for response, if code is auth failure, it shall bypass the auth process code = htonl(pHead->code); - if (code==TSDB_CODE_INVALID_TIME_STAMP || code==TSDB_CODE_AUTH_FAILURE || code==TSDB_CODE_INVALID_USER) { + if (code==TSDB_CODE_INVALID_TIME_STAMP || code==TSDB_CODE_AUTH_FAILURE || + code==TSDB_CODE_INVALID_USER || code == TSDB_CODE_NOT_READY) { pHead->msgLen = (int32_t)htonl((uint32_t)pHead->msgLen); return 0; }