提交 cdee51f6 编写于 作者: S slguan

message of account

上级 07e6caa3
...@@ -196,7 +196,7 @@ int tscSendMsgToServer(SSqlObj *pSql) { ...@@ -196,7 +196,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
} }
void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle, int32_t code) { void tscProcessMsgFromServer(char type, void *pCont, int contLen, void *ahandle, int32_t code) {
tscPrint("response is received, pCont:%p, code:%d", pCont, code); tscPrint("response:%d is received, pCont:%p, contLen:%d code:%d", type, pCont, contLen, code);
SSqlObj *pSql = (SSqlObj *)ahandle; SSqlObj *pSql = (SSqlObj *)ahandle;
if (pSql == NULL || pSql->signature != pSql) { if (pSql == NULL || pSql->signature != pSql) {
tscError("%p sql is already released, signature:%p", pSql, pSql->signature); tscError("%p sql is already released, signature:%p", pSql, pSql->signature);
...@@ -1692,15 +1692,14 @@ int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1692,15 +1692,14 @@ int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
} }
int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCreateAcctMsg *pAlterMsg;
char * pMsg, *pStart;
int msgLen = 0;
SSqlCmd *pCmd = &pSql->cmd; SSqlCmd *pCmd = &pSql->cmd;
pCmd->payloadLen = sizeof(SCMCreateAcctMsg);
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
tscError("%p failed to malloc for query msg", pSql);
return TSDB_CODE_CLI_OUT_OF_MEMORY;
}
pMsg = doBuildMsgHeader(pSql, &pStart); SCMCreateAcctMsg *pAlterMsg = (SCMCreateAcctMsg *)pCmd->payload;
pAlterMsg = (SCreateAcctMsg *)pMsg;
SSQLToken *pName = &pInfo->pDCLInfo->user.user; SSQLToken *pName = &pInfo->pDCLInfo->user.user;
SSQLToken *pPwd = &pInfo->pDCLInfo->user.passwd; SSQLToken *pPwd = &pInfo->pDCLInfo->user.passwd;
...@@ -1708,8 +1707,6 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1708,8 +1707,6 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
strncpy(pAlterMsg->user, pName->z, pName->n); strncpy(pAlterMsg->user, pName->z, pName->n);
strncpy(pAlterMsg->pass, pPwd->z, pPwd->n); strncpy(pAlterMsg->pass, pPwd->z, pPwd->n);
pMsg += sizeof(SCreateAcctMsg);
SCreateAcctSQL *pAcctOpt = &pInfo->pDCLInfo->acctOpt; SCreateAcctSQL *pAcctOpt = &pInfo->pDCLInfo->acctOpt;
pAlterMsg->cfg.maxUsers = htonl(pAcctOpt->maxUsers); pAlterMsg->cfg.maxUsers = htonl(pAcctOpt->maxUsers);
...@@ -1735,21 +1732,18 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1735,21 +1732,18 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
} }
} }
msgLen = pMsg - pStart;
pCmd->payloadLen = msgLen;
pCmd->msgType = TSDB_MSG_TYPE_CREATE_ACCT; pCmd->msgType = TSDB_MSG_TYPE_CREATE_ACCT;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCreateUserMsg *pAlterMsg; SCMCreateUserMsg *pAlterMsg;
char * pMsg, *pStart; char * pMsg, *pStart;
SSqlCmd *pCmd = &pSql->cmd; SSqlCmd *pCmd = &pSql->cmd;
pMsg = doBuildMsgHeader(pSql, &pStart); pMsg = doBuildMsgHeader(pSql, &pStart);
pAlterMsg = (SCreateUserMsg *)pMsg; pAlterMsg = (SCMCreateUserMsg *)pMsg;
SUserInfo *pUser = &pInfo->pDCLInfo->user; SUserInfo *pUser = &pInfo->pDCLInfo->user;
strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n); strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n);
...@@ -1764,7 +1758,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1764,7 +1758,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
strncpy(pAlterMsg->pass, pUser->passwd.z, pUser->passwd.n); strncpy(pAlterMsg->pass, pUser->passwd.z, pUser->passwd.n);
} }
pMsg += sizeof(SCreateUserMsg); pMsg += sizeof(SCMCreateUserMsg);
pCmd->payloadLen = pMsg - pStart; pCmd->payloadLen = pMsg - pStart;
if (pUser->type == TSDB_ALTER_USER_PASSWD || pUser->type == TSDB_ALTER_USER_PRIVILEGES) { if (pUser->type == TSDB_ALTER_USER_PASSWD || pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
...@@ -1877,18 +1871,18 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1877,18 +1871,18 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
} }
int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SDropUserMsg *pDropMsg; SCMDropUserMsg *pDropMsg;
char * pMsg, *pStart; char * pMsg, *pStart;
SSqlCmd *pCmd = &pSql->cmd; SSqlCmd *pCmd = &pSql->cmd;
pMsg = doBuildMsgHeader(pSql, &pStart); pMsg = doBuildMsgHeader(pSql, &pStart);
pDropMsg = (SDropUserMsg *)pMsg; pDropMsg = (SCMDropUserMsg *)pMsg;
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0); SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0);
strcpy(pDropMsg->user, pMeterMetaInfo->name); strcpy(pDropMsg->user, pMeterMetaInfo->name);
pMsg += sizeof(SDropUserMsg); pMsg += sizeof(SCMDropUserMsg);
pCmd->payloadLen = pMsg - pStart; pCmd->payloadLen = pMsg - pStart;
pCmd->msgType = TSDB_MSG_TYPE_DROP_USER; pCmd->msgType = TSDB_MSG_TYPE_DROP_USER;
......
...@@ -34,6 +34,7 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const ...@@ -34,6 +34,7 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const
void (*fp)(void *, TAOS_RES *, int), void *param, void **taos) { void (*fp)(void *, TAOS_RES *, int), void *param, void **taos) {
STscObj *pObj; STscObj *pObj;
taos_init(); taos_init();
if (user == NULL) { if (user == NULL) {
......
...@@ -430,6 +430,9 @@ void tscFreeResData(SSqlObj* pSql) { ...@@ -430,6 +430,9 @@ void tscFreeResData(SSqlObj* pSql) {
} }
void tscFreeSqlResult(SSqlObj* pSql) { void tscFreeSqlResult(SSqlObj* pSql) {
//TODO not free
return;
tfree(pSql->res.pRsp); tfree(pSql->res.pRsp);
pSql->res.row = 0; pSql->res.row = 0;
pSql->res.numOfRows = 0; pSql->res.numOfRows = 0;
......
...@@ -33,16 +33,12 @@ ...@@ -33,16 +33,12 @@
#include "dnodeVnodeMgmt.h" #include "dnodeVnodeMgmt.h"
#ifdef CLUSTER #ifdef CLUSTER
#include "dnodeCluster.h" #include "acct.h"
#include "httpAdmin.h" #include "admin.h"
#include "mnodeAccount.h" #include "cluster.h"
#include "mnodeBalance.h" #include "grant.h"
#include "mnodeCluster.h" #include "replica.h"
#include "sdbReplica.h" #include "storage.h"
#include "multilevelStorage.h"
#include "vnodeCluster.h"
#include "vnodeReplica.h"
#include "dnodeGrant.h"
#endif #endif
static pthread_mutex_t tsDnodeMutex; static pthread_mutex_t tsDnodeMutex;
...@@ -120,16 +116,7 @@ void dnodeCheckDataDirOpenned(const char *dir) { ...@@ -120,16 +116,7 @@ void dnodeCheckDataDirOpenned(const char *dir) {
void dnodeInitPlugins() { void dnodeInitPlugins() {
#ifdef CLUSTER #ifdef CLUSTER
dnodeClusterInit(); acctInit();
httpAdminInit();
mnodeAccountInit();
mnodeBalanceInit();
mnodeClusterInit();
sdbReplicaInit();
multilevelStorageInit();
vnodeClusterInit();
vnodeReplicaInit();
dnodeGrantInit();
#endif #endif
} }
......
...@@ -247,7 +247,7 @@ typedef struct _db_obj { ...@@ -247,7 +247,7 @@ typedef struct _db_obj {
struct _acctObj; struct _acctObj;
typedef struct _user_obj { typedef struct _user_obj {
char user[TSDB_USER_LEN + 1]; char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN]; char pass[TSDB_KEY_LEN];
char acct[TSDB_USER_LEN]; char acct[TSDB_USER_LEN];
int64_t createdTime; int64_t createdTime;
...@@ -275,23 +275,21 @@ typedef struct { ...@@ -275,23 +275,21 @@ typedef struct {
int64_t totalPoints; int64_t totalPoints;
int64_t inblound; int64_t inblound;
int64_t outbound; int64_t outbound;
TSKEY sKey; int64_t sKey;
char accessState; // Checked by mgmt heartbeat message int8_t accessState; // Checked by mgmt heartbeat message
} SAcctInfo; } SAcctInfo;
typedef struct _acctObj { typedef struct _acctObj {
char user[TSDB_USER_LEN + 1]; char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN]; char pass[TSDB_KEY_LEN];
SAcctCfg cfg; SCMAcctCfg cfg;
int32_t acctId; int32_t acctId;
int64_t createdTime; int64_t createdTime;
char reserved[15]; int8_t reserved[15];
char updateEnd[1]; int8_t updateEnd[1];
SAcctInfo acctInfo; SAcctInfo acctInfo;
SDbObj * pHead; SDbObj * pHead;
SUserObj * pUser; SUserObj * pUser;
struct _connObj *pConn;
pthread_mutex_t mutex; pthread_mutex_t mutex;
} SAcctObj; } SAcctObj;
......
...@@ -280,10 +280,6 @@ typedef struct { ...@@ -280,10 +280,6 @@ typedef struct {
uint8_t ignoreNotExists; uint8_t ignoreNotExists;
} SDropDbMsg, SUseDbMsg; } SDropDbMsg, SUseDbMsg;
typedef struct {
char user[TSDB_USER_LEN];
} SDropUserMsg, SDropAcctMsg;
typedef struct { typedef struct {
char db[TSDB_DB_NAME_LEN]; char db[TSDB_DB_NAME_LEN];
} SShowTableMsg; } SShowTableMsg;
...@@ -340,21 +336,25 @@ typedef struct { ...@@ -340,21 +336,25 @@ typedef struct {
int64_t maxQueryTime; // In unit of hour int64_t maxQueryTime; // In unit of hour
int64_t maxInbound; int64_t maxInbound;
int64_t maxOutbound; int64_t maxOutbound;
char accessState; // Configured only by command int8_t accessState; // Configured only by command
} SAcctCfg; } SCMAcctCfg;
typedef struct { typedef struct {
char user[TSDB_USER_LEN]; char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN]; char pass[TSDB_KEY_LEN];
SAcctCfg cfg; SCMAcctCfg cfg;
} SCreateAcctMsg, SAlterAcctMsg; } SCMCreateAcctMsg, SCMAlterAcctMsg;
typedef struct { typedef struct {
char user[TSDB_USER_LEN]; char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN]; } SCMDropUserMsg, SCMDropAcctMsg;
char privilege;
char flag; typedef struct {
} SCreateUserMsg, SAlterUserMsg; char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN];
int8_t privilege;
int8_t flag;
} SCMCreateUserMsg, SCMAlterUserMsg;
typedef struct { typedef struct {
char db[TSDB_TABLE_ID_LEN]; char db[TSDB_TABLE_ID_LEN];
......
...@@ -81,7 +81,15 @@ struct arguments args = { ...@@ -81,7 +81,15 @@ struct arguments args = {
*/ */
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
/*setlocale(LC_ALL, "en_US.UTF-8"); */ /*setlocale(LC_ALL, "en_US.UTF-8"); */
//
void *taos = taos_connect(NULL, "root", "taosdata", NULL, 0);
printf("ok\n");
taos_query(taos, "create account a pass 'b'");
while (1) {
sleep(1000);
}
//
if (!checkVersion()) { if (!checkVersion()) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
...@@ -13,9 +13,9 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ...@@ -13,9 +13,9 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
ADD_LIBRARY(mnode ${SRC}) ADD_LIBRARY(mnode ${SRC})
TARGET_LINK_LIBRARIES(mnode trpc tutil sdb pthread) TARGET_LINK_LIBRARIES(mnode trpc tutil sdb pthread)
#IF (TD_CLUSTER) IF (TD_CLUSTER)
# TARGET_LINK_LIBRARIES(mnode mcluster) TARGET_LINK_LIBRARIES(mnode acct)
#ENDIF () ENDIF ()
ENDIF () ENDIF ()
...@@ -28,12 +28,11 @@ int32_t mgmtAddUserIntoAcct(SAcctObj *pAcct, SUserObj *pUser); ...@@ -28,12 +28,11 @@ int32_t mgmtAddUserIntoAcct(SAcctObj *pAcct, SUserObj *pUser);
int32_t mgmtRemoveUserFromAcct(SAcctObj *pAcct, SUserObj *pUser); int32_t mgmtRemoveUserFromAcct(SAcctObj *pAcct, SUserObj *pUser);
extern int32_t (*mgmtInitAccts)(); extern int32_t (*mgmtInitAccts)();
extern void (*mgmtCleanUpAccts)();
extern SAcctObj* (*mgmtGetAcct)(char *acctName); extern SAcctObj* (*mgmtGetAcct)(char *acctName);
extern int32_t (*mgmtCheckUserLimit)(SAcctObj *pAcct); extern int32_t (*mgmtCheckUserLimit)(SAcctObj *pAcct);
extern int32_t (*mgmtCheckDbLimit)(SAcctObj *pAcct); extern int32_t (*mgmtCheckDbLimit)(SAcctObj *pAcct);
extern int32_t (*mgmtCheckTableLimit)(SAcctObj *pAcct, SCreateTableMsg *pCreate); extern int32_t (*mgmtCheckTableLimit)(SAcctObj *pAcct, SCreateTableMsg *pCreate);
extern void (*mgmtCheckAcct)();
extern void (*mgmtCleanUpAccts)();
extern int32_t (*mgmtGetAcctMeta)(SMeterMeta *pMeta, SShowObj *pShow, void *pConn); extern int32_t (*mgmtGetAcctMeta)(SMeterMeta *pMeta, SShowObj *pShow, void *pConn);
extern int32_t (*mgmtRetrieveAccts)(SShowObj *pShow, char *data, int32_t rows, void *pConn); extern int32_t (*mgmtRetrieveAccts)(SShowObj *pShow, char *data, int32_t rows, void *pConn);
......
...@@ -97,18 +97,21 @@ int32_t mgmtRemoveUserFromAcct(SAcctObj *pAcct, SUserObj *pUser) { ...@@ -97,18 +97,21 @@ int32_t mgmtRemoveUserFromAcct(SAcctObj *pAcct, SUserObj *pUser) {
} }
int32_t mgmtInitAcctsImp() { int32_t mgmtInitAcctsImp() {
SAcctObj *pAcct = &tsAcctObj;
pAcct->acctId = 0;
strcpy(pAcct->user, "root");
return 0; return 0;
} }
int32_t (*mgmtInitAccts)() = mgmtInitAcctsImp; int32_t (*mgmtInitAccts)() = mgmtInitAcctsImp;
SAcctObj *mgmtGetAcctImp(char *acctName) { static SAcctObj *mgmtGetAcctImp(char *acctName) {
return &tsAcctObj; return &tsAcctObj;
} }
SAcctObj *(*mgmtGetAcct)(char *acctName) = mgmtGetAcctImp; SAcctObj *(*mgmtGetAcct)(char *acctName) = mgmtGetAcctImp;
int32_t mgmtCheckUserLimitImp(SAcctObj *pAcct) { static int32_t mgmtCheckUserLimitImp(SAcctObj *pAcct) {
int32_t numOfUsers = sdbGetNumOfRows(tsUserSdb); int32_t numOfUsers = sdbGetNumOfRows(tsUserSdb);
if (numOfUsers >= tsMaxUsers) { if (numOfUsers >= tsMaxUsers) {
mWarn("numOfUsers:%d, exceed tsMaxUsers:%d", numOfUsers, tsMaxUsers); mWarn("numOfUsers:%d, exceed tsMaxUsers:%d", numOfUsers, tsMaxUsers);
...@@ -119,7 +122,7 @@ int32_t mgmtCheckUserLimitImp(SAcctObj *pAcct) { ...@@ -119,7 +122,7 @@ int32_t mgmtCheckUserLimitImp(SAcctObj *pAcct) {
int32_t (*mgmtCheckUserLimit)(SAcctObj *pAcct) = mgmtCheckUserLimitImp; int32_t (*mgmtCheckUserLimit)(SAcctObj *pAcct) = mgmtCheckUserLimitImp;
int32_t mgmtCheckDbLimitImp(SAcctObj *pAcct) { static int32_t mgmtCheckDbLimitImp(SAcctObj *pAcct) {
int32_t numOfDbs = sdbGetNumOfRows(tsDbSdb); int32_t numOfDbs = sdbGetNumOfRows(tsDbSdb);
if (numOfDbs >= tsMaxDbs) { if (numOfDbs >= tsMaxDbs) {
mWarn("numOfDbs:%d, exceed tsMaxDbs:%d", numOfDbs, tsMaxDbs); mWarn("numOfDbs:%d, exceed tsMaxDbs:%d", numOfDbs, tsMaxDbs);
...@@ -130,36 +133,24 @@ int32_t mgmtCheckDbLimitImp(SAcctObj *pAcct) { ...@@ -130,36 +133,24 @@ int32_t mgmtCheckDbLimitImp(SAcctObj *pAcct) {
int32_t (*mgmtCheckDbLimit)(SAcctObj *pAcct) = mgmtCheckDbLimitImp; int32_t (*mgmtCheckDbLimit)(SAcctObj *pAcct) = mgmtCheckDbLimitImp;
int32_t mgmtCheckTableLimitImp(SAcctObj *pAcct, SCreateTableMsg *pCreate) { static int32_t mgmtCheckTableLimitImp(SAcctObj *pAcct, SCreateTableMsg *pCreate) {
return 0; return 0;
} }
int32_t (*mgmtCheckTableLimit)(SAcctObj *pAcct, SCreateTableMsg *pCreate) = mgmtCheckTableLimitImp; int32_t (*mgmtCheckTableLimit)(SAcctObj *pAcct, SCreateTableMsg *pCreate) = mgmtCheckTableLimitImp;
void mgmtCheckAcctImp() { static void mgmtCleanUpAcctsImp() {
SAcctObj *pAcct = &tsAcctObj;
pAcct->acctId = 0;
strcpy(pAcct->user, "root");
mgmtCreateUser(pAcct, "root", "taosdata");
mgmtCreateUser(pAcct, "monitor", tsInternalPass);
mgmtCreateUser(pAcct, "_root", tsInternalPass);
}
void (*mgmtCheckAcct)() = mgmtCheckAcctImp;
void mgmtCleanUpAcctsImp() {
} }
void (*mgmtCleanUpAccts)() = mgmtCleanUpAcctsImp; void (*mgmtCleanUpAccts)() = mgmtCleanUpAcctsImp;
int32_t mgmtGetAcctMetaImp(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) { static int32_t mgmtGetAcctMetaImp(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
return TSDB_CODE_OPS_NOT_SUPPORT; return TSDB_CODE_OPS_NOT_SUPPORT;
} }
int32_t (*mgmtGetAcctMeta)(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) = mgmtGetAcctMetaImp; int32_t (*mgmtGetAcctMeta)(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) = mgmtGetAcctMetaImp;
int32_t mgmtRetrieveAcctsImp(SShowObj *pShow, char *data, int32_t rows, void *pConn) { static int32_t mgmtRetrieveAcctsImp(SShowObj *pShow, char *data, int32_t rows, void *pConn) {
return 0; return 0;
} }
......
...@@ -60,6 +60,8 @@ void mgmtProcessTranRequest(SSchedMsg *sched) { ...@@ -60,6 +60,8 @@ void mgmtProcessTranRequest(SSchedMsg *sched) {
void *pConn = sched->thandle; void *pConn = sched->thandle;
(*mgmtProcessShellMsg[msgType])(pCont, contLen, pConn); (*mgmtProcessShellMsg[msgType])(pCont, contLen, pConn);
//rpcSendResponse(pConn, 12, NULL, 0);
if (sched->msg) { if (sched->msg) {
free(sched->msg); free(sched->msg);
} }
...@@ -73,7 +75,7 @@ void mgmtAddToTranRequest(int8_t type, void *pCont, int contLen, void *ahandle) ...@@ -73,7 +75,7 @@ void mgmtAddToTranRequest(int8_t type, void *pCont, int contLen, void *ahandle)
schedMsg.thandle = ahandle; schedMsg.thandle = ahandle;
*(int8_t *) (schedMsg.msg) = type; *(int8_t *) (schedMsg.msg) = type;
*(int32_t *) (schedMsg.msg + sizeof(int8_t)) = contLen; *(int32_t *) (schedMsg.msg + sizeof(int8_t)) = contLen;
memcpy(schedMsg.msg, pCont + sizeof(int32_t) + sizeof(int8_t), contLen); memcpy(schedMsg.msg + sizeof(int32_t) + sizeof(int8_t), pCont, contLen);
taosScheduleTask(tsMgmtTranQhandle, &schedMsg); taosScheduleTask(tsMgmtTranQhandle, &schedMsg);
} }
...@@ -632,7 +634,7 @@ int32_t mgmtProcessKillConnectionMsg(void *pCont, int32_t contLen, void *ahandle ...@@ -632,7 +634,7 @@ int32_t mgmtProcessKillConnectionMsg(void *pCont, int32_t contLen, void *ahandle
} }
int32_t mgmtProcessCreateUserMsg(void *pCont, int32_t contLen, void *ahandle) { int32_t mgmtProcessCreateUserMsg(void *pCont, int32_t contLen, void *ahandle) {
// SCreateUserMsg *pCreate = (SCreateUserMsg *)pMsg; // SCMCreateUserMsg *pCreate = (SCMCreateUserMsg *)pMsg;
// int32_t code = 0; // int32_t code = 0;
// //
// if (mgmtCheckRedirectMsg(pConn, TSDB_MSG_TYPE_CREATE_USER_RSP) != 0) { // if (mgmtCheckRedirectMsg(pConn, TSDB_MSG_TYPE_CREATE_USER_RSP) != 0) {
...@@ -654,7 +656,7 @@ int32_t mgmtProcessCreateUserMsg(void *pCont, int32_t contLen, void *ahandle) { ...@@ -654,7 +656,7 @@ int32_t mgmtProcessCreateUserMsg(void *pCont, int32_t contLen, void *ahandle) {
} }
int32_t mgmtProcessAlterUserMsg(void *pCont, int32_t contLen, void *ahandle) { int32_t mgmtProcessAlterUserMsg(void *pCont, int32_t contLen, void *ahandle) {
// SAlterUserMsg *pAlter = (SAlterUserMsg *)pMsg; // SCMAlterUserMsg *pAlter = (SCMAlterUserMsg *)pMsg;
// int32_t code = 0; // int32_t code = 0;
// SUserObj * pUser; // SUserObj * pUser;
// SUserObj * pOperUser; // SUserObj * pOperUser;
...@@ -766,7 +768,7 @@ int32_t mgmtProcessAlterUserMsg(void *pCont, int32_t contLen, void *ahandle) { ...@@ -766,7 +768,7 @@ int32_t mgmtProcessAlterUserMsg(void *pCont, int32_t contLen, void *ahandle) {
} }
int32_t mgmtProcessDropUserMsg(void *pCont, int32_t contLen, void *ahandle) { int32_t mgmtProcessDropUserMsg(void *pCont, int32_t contLen, void *ahandle) {
// SDropUserMsg *pDrop = (SDropUserMsg *)pMsg; // SCMDropUserMsg *pDrop = (SCMDropUserMsg *)pMsg;
// int32_t code = 0; // int32_t code = 0;
// SUserObj * pUser; // SUserObj * pUser;
// SUserObj * pOperUser; // SUserObj * pOperUser;
...@@ -1407,44 +1409,15 @@ int32_t mgmtCheckRedirectMsgImp(void *pConn, int32_t msgType) { ...@@ -1407,44 +1409,15 @@ int32_t mgmtCheckRedirectMsgImp(void *pConn, int32_t msgType) {
} }
int32_t (*mgmtCheckRedirectMsg)(void *pConn, int32_t msgType) = mgmtCheckRedirectMsgImp; int32_t (*mgmtCheckRedirectMsg)(void *pConn, int32_t msgType) = mgmtCheckRedirectMsgImp;
int32_t mgmtProcessAlterAcctMsgImp(void *pCont, int32_t contLen, void *ahandle) { static int32_t mgmtProcessUnSupportMsg(void *pCont, int32_t contLen, void *ahandle) {
//return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_ALTER_ACCT_RSP, TSDB_CODE_OPS_NOT_SUPPORT); rpcSendResponse(ahandle, TSDB_CODE_OPS_NOT_SUPPORT, NULL, 0);
return 0;
}
int32_t (*mgmtProcessAlterAcctMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessAlterAcctMsgImp;
int32_t mgmtProcessCreateDnodeMsgImp(void *pCont, int32_t contLen, void *ahandle) {
//return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_CREATE_DNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
return 0;
}
int32_t (*mgmtProcessCreateDnodeMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessCreateDnodeMsgImp;
int32_t mgmtProcessCfgMnodeMsgImp(void *pCont, int32_t contLen, void *ahandle) {
//return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_CFG_MNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
return 0;
}
int32_t (*mgmtProcessCfgMnodeMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessCfgMnodeMsgImp;
int32_t mgmtProcessDropMnodeMsgImp(void *pCont, int32_t contLen, void *ahandle) {
//return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_DROP_MNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
return 0; return 0;
} }
int32_t (*mgmtProcessDropMnodeMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessDropMnodeMsgImp;
int32_t mgmtProcessDropDnodeMsgImp(void *pCont, int32_t contLen, void *ahandle) { int32_t (*mgmtProcessAlterAcctMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessUnSupportMsg;
//return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_DROP_DNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT); int32_t (*mgmtProcessCreateDnodeMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessUnSupportMsg;
return 0; int32_t (*mgmtProcessCfgMnodeMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessUnSupportMsg;
} int32_t (*mgmtProcessDropMnodeMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessUnSupportMsg;
int32_t (*mgmtProcessDropDnodeMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessDropDnodeMsgImp; int32_t (*mgmtProcessDropDnodeMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessUnSupportMsg;
int32_t (*mgmtProcessDropAcctMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessUnSupportMsg;
int32_t mgmtProcessDropAcctMsgImp(void *pCont, int32_t contLen, void *ahandle) { int32_t (*mgmtProcessCreateAcctMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessUnSupportMsg;
// return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_DROP_ACCT_RSP, TSDB_CODE_OPS_NOT_SUPPORT); \ No newline at end of file
return 0;
}
int32_t (*mgmtProcessDropAcctMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessDropAcctMsgImp;
int32_t mgmtProcessCreateAcctMsgImp(void *pCont, int32_t contLen, void *ahandle) {
// return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_CREATE_ACCT_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
return 0;
}
int32_t (*mgmtProcessCreateAcctMsg)(void *pCont, int32_t contLen, void *ahandle) = mgmtProcessCreateAcctMsgImp;
\ No newline at end of file
...@@ -125,8 +125,6 @@ int32_t mgmtStartSystem() { ...@@ -125,8 +125,6 @@ int32_t mgmtStartSystem() {
mError("failed to init dnode balance") mError("failed to init dnode balance")
} }
mgmtCheckAcct();
taosTmrReset(mgmtDoStatistic, tsStatusInterval * 30000, NULL, tsMgmtTmr, &tsMgmtStatisTimer); taosTmrReset(mgmtDoStatistic, tsStatusInterval * 30000, NULL, tsMgmtTmr, &tsMgmtStatisTimer);
mPrint("TDengine mgmt is initialized successfully"); mPrint("TDengine mgmt is initialized successfully");
......
...@@ -78,6 +78,11 @@ int32_t mgmtInitUsers() { ...@@ -78,6 +78,11 @@ int32_t mgmtInitUsers() {
numOfUsers++; numOfUsers++;
} }
pAcct = mgmtGetAcct("root");
mgmtCreateUser(pAcct, "root", "taosdata");
mgmtCreateUser(pAcct, "monitor", tsInternalPass);
mgmtCreateUser(pAcct, "_root", tsInternalPass);
mTrace("user data is initialized"); mTrace("user data is initialized");
return 0; return 0;
} }
......
...@@ -108,9 +108,9 @@ ELSEIF(TD_DARWIN_64) ...@@ -108,9 +108,9 @@ ELSEIF(TD_DARWIN_64)
TARGET_LINK_LIBRARIES(tutil iconv pthread os) TARGET_LINK_LIBRARIES(tutil iconv pthread os)
ENDIF() ENDIF()
IF (TD_CLUSTER) #IF (TD_CLUSTER)
TARGET_LINK_LIBRARIES(tutil mstorage) # TARGET_LINK_LIBRARIES(tutil mstorage)
ENDIF () #ENDIF ()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册