fix compile errors
This commit is contained in:
parent
ce0f8aae66
commit
cbbe8c16dc
|
@ -2601,7 +2601,7 @@ int tscProcessRetrieveMetricRsp(SSqlObj *pSql) {
|
|||
int tscProcessEmptyResultRsp(SSqlObj *pSql) { return tscLocalResultCommonBuilder(pSql, 0); }
|
||||
|
||||
int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||
SConnectMsg *pConnect;
|
||||
SCMConnectMsg *pConnect;
|
||||
char * pMsg, *pStart;
|
||||
|
||||
SSqlCmd *pCmd = &pSql->cmd;
|
||||
|
@ -2609,7 +2609,7 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
pMsg = pCmd->payload + tsRpcHeadSize;
|
||||
pStart = pMsg;
|
||||
|
||||
pConnect = (SConnectMsg *)pMsg;
|
||||
pConnect = (SCMConnectMsg *)pMsg;
|
||||
|
||||
char *db; // ugly code to move the space
|
||||
db = strstr(pObj->db, TS_PATH_DELIMITER);
|
||||
|
@ -2618,7 +2618,7 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
|
||||
strcpy(pConnect->clientVersion, version);
|
||||
|
||||
pMsg += sizeof(SConnectMsg);
|
||||
pMsg += sizeof(SCMConnectMsg);
|
||||
|
||||
pCmd->payloadLen = pMsg - pStart;
|
||||
pCmd->msgType = TSDB_MSG_TYPE_CONNECT;
|
||||
|
@ -3312,13 +3312,11 @@ int tscProcessShowRsp(SSqlObj *pSql) {
|
|||
}
|
||||
|
||||
int tscProcessConnectRsp(SSqlObj *pSql) {
|
||||
char temp[TSDB_TABLE_ID_LEN * 2];
|
||||
SConnectRsp *pConnect;
|
||||
|
||||
char temp[TSDB_TABLE_ID_LEN * 2];
|
||||
STscObj *pObj = pSql->pTscObj;
|
||||
SSqlRes *pRes = &pSql->res;
|
||||
|
||||
pConnect = (SConnectRsp *)pRes->pRsp;
|
||||
SCMConnectRsp *pConnect = (SCMConnectRsp *)pRes->pRsp;
|
||||
strcpy(pObj->acctId, pConnect->acctId); // copy acctId from response
|
||||
int32_t len = sprintf(temp, "%s%s%s", pObj->acctId, TS_PATH_DELIMITER, pObj->db);
|
||||
|
||||
|
@ -3326,11 +3324,11 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
|
|||
strncpy(pObj->db, temp, tListLen(pObj->db));
|
||||
|
||||
SIpList * pIpList;
|
||||
char *rsp = pRes->pRsp + sizeof(SConnectRsp);
|
||||
char *rsp = pRes->pRsp + sizeof(SCMConnectRsp);
|
||||
pIpList = (SIpList *)rsp;
|
||||
tscSetMgmtIpList(pIpList);
|
||||
|
||||
strcpy(pObj->sversion, pConnect->version);
|
||||
strcpy(pObj->sversion, pConnect->serverVersion);
|
||||
pObj->writeAuth = pConnect->writeAuth;
|
||||
pObj->superAuth = pConnect->superAuth;
|
||||
taosTmrReset(tscProcessActivityTimer, tsShellActivityTimer * 500, pObj, tscTmr, &pObj->pTimer);
|
||||
|
|
|
@ -254,8 +254,6 @@ typedef struct _user_obj {
|
|||
char reserved[16];
|
||||
char updateEnd[1];
|
||||
struct _user_obj *prev, *next;
|
||||
int8_t writeAuth;
|
||||
int8_t superAuth;
|
||||
} SUserObj;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -342,14 +342,12 @@ typedef struct {
|
|||
char serverVersion[TSDB_MSG_DEF_VERSION_LEN];
|
||||
int8_t writeAuth;
|
||||
int8_t superAuth;
|
||||
int8_t usePublicIp;
|
||||
int16_t index;
|
||||
int16_t numOfIps;
|
||||
uint16_t port;
|
||||
uint32_t ip[TSDB_MSG_DEF_MAX_MPEERS];
|
||||
} SCMConnectRsp;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int32_t maxUsers;
|
||||
int32_t maxDbs;
|
||||
|
|
|
@ -1315,32 +1315,32 @@ int32_t mgmtRetriveUserAuthInfo(char *user, char *spi, char *encrypt, char *secr
|
|||
|
||||
int32_t mgmtProcessConnectMsg(int8_t type, void *pCont, int32_t contLen, void *ahandle, int32_t code) {
|
||||
SCMConnectMsg *pConnectMsg = (SCMConnectMsg *) pCont;
|
||||
uint32_t destIp = 0;
|
||||
uint32_t srcIp = 0;
|
||||
SRpcConnInfo connInfo;
|
||||
rpcGetConnInfo(ahandle, &connInfo);
|
||||
|
||||
SUserObj *pUser = mgmtGetUser(pConnectMsg->head.userId);
|
||||
SUserObj *pUser = mgmtGetUser(connInfo.user);
|
||||
if (pUser == NULL) {
|
||||
mLError("user:%s login from %s to %s, code:%d", pConnectMsg->head.userId, taosIpStr(srcIp), taosIpStr(destIp), code);
|
||||
mLError("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||
rpcSendResponse(ahandle, TSDB_CODE_INVALID_USER, NULL, 0);
|
||||
return TSDB_CODE_INVALID_USER;
|
||||
}
|
||||
|
||||
if (mgmtCheckExpired()) {
|
||||
mLError("user:%s login from %s to %s, code:%d", pConnectMsg->head.userId, taosIpStr(srcIp), taosIpStr(destIp), code);
|
||||
mLError("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||
rpcSendResponse(ahandle, TSDB_CODE_GRANT_EXPIRED, NULL, 0);
|
||||
return TSDB_CODE_GRANT_EXPIRED;
|
||||
}
|
||||
|
||||
SAcctObj *pAcct = mgmtGetAcct(pUser->acct);
|
||||
if (pAcct == NULL) {
|
||||
mLError("user:%s login from %s to %s, code:%d", pConnectMsg->head.userId, taosIpStr(srcIp), taosIpStr(destIp), code);
|
||||
mLError("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||
rpcSendResponse(ahandle, TSDB_CODE_INVALID_ACCT, NULL, 0);
|
||||
return TSDB_CODE_INVALID_ACCT;
|
||||
}
|
||||
|
||||
code = taosCheckVersion(pConnectMsg->clientVersion, version, 3);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
mLError("user:%s login from %s to %s, code:%d", pConnectMsg->head.userId, taosIpStr(srcIp), taosIpStr(destIp), code);
|
||||
mLError("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||
rpcSendResponse(ahandle, code, NULL, 0);
|
||||
return code;
|
||||
}
|
||||
|
@ -1350,7 +1350,7 @@ int32_t mgmtProcessConnectMsg(int8_t type, void *pCont, int32_t contLen, void *a
|
|||
sprintf(dbName, "%x%s%s", pAcct->acctId, TS_PATH_DELIMITER, pConnectMsg->db);
|
||||
SDbObj *pDb = mgmtGetDb(dbName);
|
||||
if (pDb == NULL) {
|
||||
mLError("user:%s login from %s to %s, code:%d", pConnectMsg->head.userId, taosIpStr(srcIp), taosIpStr(destIp), code);
|
||||
mLError("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||
rpcSendResponse(ahandle, TSDB_CODE_INVALID_DB, NULL, 0);
|
||||
return TSDB_CODE_INVALID_DB;
|
||||
}
|
||||
|
@ -1358,22 +1358,21 @@ int32_t mgmtProcessConnectMsg(int8_t type, void *pCont, int32_t contLen, void *a
|
|||
|
||||
SCMConnectRsp *pConnectRsp = rpcMallocCont(sizeof(SCMConnectRsp));
|
||||
if (pConnectRsp == NULL) {
|
||||
mLError("user:%s login from %s to %s, code:%d", pConnectMsg->head.userId, taosIpStr(srcIp), taosIpStr(destIp), code);
|
||||
mLError("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||
rpcSendResponse(ahandle, TSDB_CODE_SERV_OUT_OF_MEMORY, NULL, 0);
|
||||
return TSDB_CODE_SERV_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
sprintf(pConnectRsp->acctId, "%x", pAcct->acctId);
|
||||
strcpy(pConnectRsp->serverVersion, version);
|
||||
pConnectRsp->writeAuth = pConn->writeAuth;
|
||||
pConnectRsp->superAuth = pConn->superAuth;
|
||||
pConnectRsp->writeAuth = pUser->writeAuth;
|
||||
pConnectRsp->superAuth = pUser->superAuth;
|
||||
|
||||
pConnectRsp->index = 0;
|
||||
pConnectRsp->usePublicIp = (destIp == tsPublicIpInt ? 1 : 0);
|
||||
if (pSdbPublicIpList != NULL && pSdbIpList != NULL) {
|
||||
pConnectRsp->numOfIps = htons(pSdbPublicIpList->numOfIps);
|
||||
pConnectRsp->port = htons(tsMgmtShellPort);
|
||||
if (pConnectRsp->usePublicIp) {
|
||||
if (connInfo.serverIp == tsPublicIpInt) {
|
||||
for (int i = 0; i < pSdbPublicIpList->numOfIps; ++i) {
|
||||
pConnectRsp->ip[i] = htonl(pSdbPublicIpList->ip[i]);
|
||||
}
|
||||
|
@ -1387,7 +1386,7 @@ int32_t mgmtProcessConnectMsg(int8_t type, void *pCont, int32_t contLen, void *a
|
|||
pConnectRsp->port = htons(tsMgmtShellPort);
|
||||
}
|
||||
|
||||
mLPrint("user:%s login from %s to %s, code:%d", pConnectMsg->head.userId, taosIpStr(srcIp), taosIpStr(destIp), code);
|
||||
mLPrint("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue