Merge remote-tracking branch 'freemine/un-hard-coded-username/password' into develop
This commit is contained in:
commit
a3bdfdbbc2
|
@ -227,12 +227,12 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_connectImp(JNIEn
|
|||
}
|
||||
|
||||
if (user == NULL) {
|
||||
jniTrace("jobj:%p, user is null, use tsDefaultUser", jobj);
|
||||
user = tsDefaultUser;
|
||||
jniTrace("jobj:%p, user is null, use default user %s", jobj, TSDB_DEFAULT_USER);
|
||||
user = TSDB_DEFAULT_USER;
|
||||
}
|
||||
if (pass == NULL) {
|
||||
jniTrace("jobj:%p, pass is null, use tsDefaultPass", jobj);
|
||||
pass = tsDefaultPass;
|
||||
jniTrace("jobj:%p, pass is null, use default password", jobj);
|
||||
pass = TSDB_DEFAULT_PASS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -252,8 +252,8 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_connectImp(JNIEn
|
|||
|
||||
if (host != NULL) (*env)->ReleaseStringUTFChars(env, jhost, host);
|
||||
if (dbname != NULL) (*env)->ReleaseStringUTFChars(env, jdbName, dbname);
|
||||
if (user != NULL && user != tsDefaultUser) (*env)->ReleaseStringUTFChars(env, juser, user);
|
||||
if (pass != NULL && pass != tsDefaultPass) (*env)->ReleaseStringUTFChars(env, jpass, pass);
|
||||
if (user != NULL && user != (const char *)TSDB_DEFAULT_USER) (*env)->ReleaseStringUTFChars(env, juser, user);
|
||||
if (pass != NULL && pass != (const char *)TSDB_DEFAULT_PASS) (*env)->ReleaseStringUTFChars(env, jpass, pass);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -92,10 +92,6 @@ extern int32_t tsNumOfMnodes;
|
|||
extern int32_t tsMaxShellConns;
|
||||
extern int32_t tsMaxTables;
|
||||
|
||||
extern char tsDefaultDB[];
|
||||
extern char tsDefaultUser[];
|
||||
extern char tsDefaultPass[];
|
||||
|
||||
extern char tsMqttBrokerAddress[];
|
||||
extern char tsMqttBrokerClientId[];
|
||||
|
||||
|
|
|
@ -109,10 +109,6 @@ int32_t tsReplications = TSDB_DEFAULT_REPLICA_NUM;
|
|||
int16_t tsAffectedRowsMod = 0;
|
||||
int32_t tsNumOfMnodes = 3;
|
||||
int32_t tsMaxShellConns = 5000;
|
||||
|
||||
char tsDefaultDB[TSDB_DB_NAME_LEN] = {0};
|
||||
char tsDefaultUser[64] = "root";
|
||||
char tsDefaultPass[64] = "taosdata";
|
||||
int32_t tsMaxConnections = 5000;
|
||||
|
||||
int32_t tsBalanceInterval = 300; // seconds
|
||||
|
@ -713,37 +709,6 @@ static void doInitGlobalConfig() {
|
|||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
// login configs
|
||||
cfg.option = "defaultDB";
|
||||
cfg.ptr = tsDefaultDB;
|
||||
cfg.valType = TAOS_CFG_VTYPE_STRING;
|
||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 0;
|
||||
cfg.ptrLength = TSDB_DB_NAME_LEN - 1;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
cfg.option = "defaultUser";
|
||||
cfg.ptr = tsDefaultUser;
|
||||
cfg.valType = TAOS_CFG_VTYPE_STRING;
|
||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 0;
|
||||
cfg.ptrLength = TSDB_USER_LEN - 1;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
cfg.option = "defaultPass";
|
||||
cfg.ptr = tsDefaultPass;
|
||||
cfg.valType = TAOS_CFG_VTYPE_STRING;
|
||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_NOT_PRINT;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 0;
|
||||
cfg.ptrLength = TSDB_PASSWORD_LEN - 1;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
cfg.option = "mqttBrokerAddress";
|
||||
cfg.ptr = tsMqttBrokerAddress;
|
||||
cfg.valType = TAOS_CFG_VTYPE_STRING;
|
||||
|
|
|
@ -48,8 +48,8 @@ int main(int argc, char *argv[]) {
|
|||
taosInitLog("cq.log", 100000, 10);
|
||||
|
||||
SCqCfg cqCfg;
|
||||
strcpy(cqCfg.user, "root");
|
||||
strcpy(cqCfg.pass, "taosdata");
|
||||
strcpy(cqCfg.user, TSDB_DEFAULT_USER);
|
||||
strcpy(cqCfg.pass, TSDB_DEFAULT_PASS);
|
||||
cqCfg.vgId = 2;
|
||||
cqCfg.cqWrite = writeToQueue;
|
||||
|
||||
|
|
|
@ -83,6 +83,9 @@ extern const int32_t TYPE_BYTES[11];
|
|||
#define TSDB_DATA_NULL_STR "NULL"
|
||||
#define TSDB_DATA_NULL_STR_L "null"
|
||||
|
||||
#define TSDB_DEFAULT_USER "root"
|
||||
#define TSDB_DEFAULT_PASS "taosdata"
|
||||
|
||||
#define TSDB_TRUE 1
|
||||
#define TSDB_FALSE 0
|
||||
#define TSDB_OK 0
|
||||
|
|
|
@ -56,11 +56,11 @@ TAOS *shellInit(SShellArguments *args) {
|
|||
if (args->is_use_passwd) {
|
||||
if (args->password == NULL) args->password = getpass("Enter password: ");
|
||||
} else {
|
||||
args->password = tsDefaultPass;
|
||||
args->password = TSDB_DEFAULT_PASS;
|
||||
}
|
||||
|
||||
if (args->user == NULL) {
|
||||
args->user = tsDefaultUser;
|
||||
args->user = TSDB_DEFAULT_USER;
|
||||
}
|
||||
|
||||
taos_init();
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "taosdef.h"
|
||||
#include "tutil.h"
|
||||
|
||||
#include "tglobal.h"
|
||||
|
||||
#define COMMAND_SIZE 65536
|
||||
#define DEFAULT_DUMP_FILE "taosdump.sql"
|
||||
|
||||
|
@ -324,7 +326,7 @@ void taosFreeDbInfos();
|
|||
int main(int argc, char *argv[]) {
|
||||
SDumpArguments arguments = {
|
||||
// connection option
|
||||
NULL, "root", "taosdata", 0,
|
||||
NULL, TSDB_DEFAULT_USER, TSDB_DEFAULT_PASS, 0,
|
||||
// output file
|
||||
DEFAULT_DUMP_FILE, DEFAULT_DUMP_FILE, NULL,
|
||||
// dump unit option
|
||||
|
@ -502,7 +504,7 @@ int taosDumpOut(SDumpArguments *arguments) {
|
|||
}
|
||||
|
||||
strncpy(dbInfos[count]->name, (char *)row[TSDB_SHOW_DB_NAME_INDEX], fields[TSDB_SHOW_DB_NAME_INDEX].bytes);
|
||||
if (strcmp(arguments->user, "root") == 0) {
|
||||
if (strcmp(arguments->user, TSDB_DEFAULT_USER) == 0) {
|
||||
dbInfos[count]->replica = (int)(*((int16_t *)row[TSDB_SHOW_DB_REPLICA_INDEX]));
|
||||
dbInfos[count]->days = (int)(*((int16_t *)row[TSDB_SHOW_DB_DAYS_INDEX]));
|
||||
dbInfos[count]->keep = *((int *)row[TSDB_SHOW_DB_KEEP_INDEX]);
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "mnodeSdb.h"
|
||||
#include "mnodeUser.h"
|
||||
|
||||
#include "tglobal.h"
|
||||
|
||||
void * tsAcctSdb = NULL;
|
||||
static int32_t tsAcctUpdateSize;
|
||||
static int32_t mnodeCreateRootAcct();
|
||||
|
@ -174,8 +176,8 @@ static int32_t mnodeCreateRootAcct() {
|
|||
|
||||
SAcctObj *pAcct = malloc(sizeof(SAcctObj));
|
||||
memset(pAcct, 0, sizeof(SAcctObj));
|
||||
strcpy(pAcct->user, "root");
|
||||
taosEncryptPass((uint8_t*)"taosdata", strlen("taosdata"), pAcct->pass);
|
||||
strcpy(pAcct->user, TSDB_DEFAULT_USER);
|
||||
taosEncryptPass((uint8_t *)TSDB_DEFAULT_PASS, strlen(TSDB_DEFAULT_PASS), pAcct->pass);
|
||||
pAcct->cfg = (SAcctCfg){
|
||||
.maxUsers = 10,
|
||||
.maxDbs = 64,
|
||||
|
|
|
@ -478,7 +478,7 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
|
|||
cols++;
|
||||
|
||||
#ifndef __CLOUD_VERSION__
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
#endif
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
|
@ -490,7 +490,7 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
|
|||
#endif
|
||||
|
||||
#ifndef __CLOUD_VERSION__
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
#endif
|
||||
pShow->bytes[cols] = 2;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||
|
@ -514,7 +514,7 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
|
|||
cols++;
|
||||
|
||||
#ifndef __CLOUD_VERSION__
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
#endif
|
||||
pShow->bytes[cols] = 4;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||
|
@ -628,7 +628,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
|
|||
cols++;
|
||||
|
||||
#ifndef __CLOUD_VERSION__
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
#endif
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pDb->numOfVgroups;
|
||||
|
@ -638,7 +638,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
|
|||
#endif
|
||||
|
||||
#ifndef __CLOUD_VERSION__
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
#endif
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int16_t *)pWrite = pDb->cfg.replications;
|
||||
|
@ -659,7 +659,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
|
|||
cols++;
|
||||
|
||||
#ifndef __CLOUD_VERSION__
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
#endif
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
*(int32_t *)pWrite = pDb->cfg.maxTables; // table num can be created should minus 1
|
||||
|
|
|
@ -254,7 +254,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
|
|||
// TODO temporary disabled for compiling: strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep);
|
||||
}
|
||||
|
||||
if (strcmp(pMsg->pUser->user, "root") != 0) {
|
||||
if (strcmp(pMsg->pUser->user, TSDB_DEFAULT_USER) != 0) {
|
||||
return TSDB_CODE_MND_NO_RIGHTS;
|
||||
}
|
||||
|
||||
|
@ -480,7 +480,7 @@ static int32_t mnodeDropDnodeByEp(char *ep, SMnodeMsg *pMsg) {
|
|||
static int32_t mnodeProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
|
||||
SCMCreateDnodeMsg *pCreate = pMsg->rpcMsg.pCont;
|
||||
|
||||
if (strcmp(pMsg->pUser->user, "root") != 0) {
|
||||
if (strcmp(pMsg->pUser->user, TSDB_DEFAULT_USER) != 0) {
|
||||
return TSDB_CODE_MND_NO_RIGHTS;
|
||||
} else {
|
||||
return mnodeCreateDnode(pCreate->ep, pMsg);
|
||||
|
@ -490,7 +490,7 @@ static int32_t mnodeProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
|
|||
static int32_t mnodeProcessDropDnodeMsg(SMnodeMsg *pMsg) {
|
||||
SCMDropDnodeMsg *pDrop = pMsg->rpcMsg.pCont;
|
||||
|
||||
if (strcmp(pMsg->pUser->user, "root") != 0) {
|
||||
if (strcmp(pMsg->pUser->user, TSDB_DEFAULT_USER) != 0) {
|
||||
return TSDB_CODE_MND_NO_RIGHTS;
|
||||
} else {
|
||||
return mnodeDropDnodeByEp(pDrop->ep, pMsg);
|
||||
|
@ -501,7 +501,7 @@ static int32_t mnodeGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
|
|||
SUserObj *pUser = mnodeGetUserFromConn(pConn);
|
||||
if (pUser == NULL) return 0;
|
||||
|
||||
if (strcmp(pUser->pAcct->user, "root") != 0) {
|
||||
if (strcmp(pUser->pAcct->user, TSDB_DEFAULT_USER) != 0) {
|
||||
mnodeDecUserRef(pUser);
|
||||
return TSDB_CODE_MND_NO_RIGHTS;
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ static int32_t mnodeGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
|
|||
SUserObj *pUser = mnodeGetUserFromConn(pConn);
|
||||
if (pUser == NULL) return 0;
|
||||
|
||||
if (strcmp(pUser->user, "root") != 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) {
|
||||
mnodeDecUserRef(pUser);
|
||||
return TSDB_CODE_MND_NO_RIGHTS;
|
||||
}
|
||||
|
@ -740,7 +740,7 @@ static int32_t mnodeGetConfigMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
|
|||
SUserObj *pUser = mnodeGetUserFromConn(pConn);
|
||||
if (pUser == NULL) return 0;
|
||||
|
||||
if (strcmp(pUser->user, "root") != 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) {
|
||||
mnodeDecUserRef(pUser);
|
||||
return TSDB_CODE_MND_NO_RIGHTS;
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ static int32_t mnodeGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
|
|||
SUserObj *pUser = mnodeGetUserFromConn(pConn);
|
||||
if (pUser == NULL) return 0;
|
||||
|
||||
if (strcmp(pUser->user, "root") != 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) {
|
||||
mnodeDecUserRef(pUser);
|
||||
return TSDB_CODE_MND_NO_RIGHTS;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "mnodeShow.h"
|
||||
#include "mnodeUser.h"
|
||||
|
||||
#include "tglobal.h"
|
||||
|
||||
static void * tsMnodeSdb = NULL;
|
||||
static int32_t tsMnodeUpdateSize = 0;
|
||||
static SRpcIpSet tsMnodeIpSetForShell;
|
||||
|
@ -333,7 +335,7 @@ static int32_t mnodeGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
|
|||
SUserObj *pUser = mnodeGetUserFromConn(pConn);
|
||||
if (pUser == NULL) return 0;
|
||||
|
||||
if (strcmp(pUser->pAcct->user, "root") != 0) {
|
||||
if (strcmp(pUser->pAcct->user, TSDB_DEFAULT_USER) != 0) {
|
||||
mnodeDecUserRef(pUser);
|
||||
return TSDB_CODE_MND_NO_RIGHTS;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ static void *mnodeGetNextConn(SHashMutableIterator *pIter, SConnObj **pConn) {
|
|||
static int32_t mnodeGetConnsMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
|
||||
SUserObj *pUser = mnodeGetUserFromConn(pConn);
|
||||
if (pUser == NULL) return 0;
|
||||
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->schema;
|
||||
|
@ -294,7 +294,7 @@ int32_t mnodeSaveQueryStreamList(SConnObj *pConn, SCMHeartBeatMsg *pHBMsg) {
|
|||
static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
|
||||
SUserObj *pUser = mnodeGetUserFromConn(pConn);
|
||||
if (pUser == NULL) return 0;
|
||||
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->schema;
|
||||
|
@ -403,7 +403,7 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
|
|||
static int32_t mnodeGetStreamMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
|
||||
SUserObj *pUser = mnodeGetUserFromConn(pConn);
|
||||
if (pUser == NULL) return 0;
|
||||
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
|
||||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->schema;
|
||||
|
@ -531,7 +531,7 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v
|
|||
|
||||
static int32_t mnodeProcessKillQueryMsg(SMnodeMsg *pMsg) {
|
||||
SUserObj *pUser = pMsg->pUser;
|
||||
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
|
||||
SCMKillQueryMsg *pKill = pMsg->rpcMsg.pCont;
|
||||
mPrint("kill query msg is received, queryId:%s", pKill->queryId);
|
||||
|
@ -561,7 +561,7 @@ static int32_t mnodeProcessKillQueryMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
static int32_t mnodeProcessKillStreamMsg(SMnodeMsg *pMsg) {
|
||||
SUserObj *pUser = pMsg->pUser;
|
||||
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
|
||||
SCMKillQueryMsg *pKill = pMsg->rpcMsg.pCont;
|
||||
mPrint("kill stream msg is received, streamId:%s", pKill->queryId);
|
||||
|
@ -591,7 +591,7 @@ static int32_t mnodeProcessKillStreamMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
static int32_t mnodeProcessKillConnectionMsg(SMnodeMsg *pMsg) {
|
||||
SUserObj *pUser = pMsg->pUser;
|
||||
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
|
||||
SCMKillConnMsg *pKill = pMsg->rpcMsg.pCont;
|
||||
SConnObj * pConn = taosCacheAcquireByName(tsMnodeConnCache, pKill->queryId);
|
||||
|
|
|
@ -105,10 +105,10 @@ static int32_t mnodeUserActionRestored() {
|
|||
int32_t numOfRows = sdbGetNumOfRows(tsUserSdb);
|
||||
if (numOfRows <= 0 && dnodeIsFirstDeploy()) {
|
||||
mPrint("dnode first deploy, create root user");
|
||||
SAcctObj *pAcct = mnodeGetAcct("root");
|
||||
mnodeCreateUser(pAcct, "root", "taosdata", NULL);
|
||||
SAcctObj *pAcct = mnodeGetAcct(TSDB_DEFAULT_USER);
|
||||
mnodeCreateUser(pAcct, TSDB_DEFAULT_USER, TSDB_DEFAULT_PASS, NULL);
|
||||
mnodeCreateUser(pAcct, "monitor", tsInternalPass, NULL);
|
||||
mnodeCreateUser(pAcct, "_root", tsInternalPass, NULL);
|
||||
mnodeCreateUser(pAcct, "_"TSDB_DEFAULT_USER, tsInternalPass, NULL);
|
||||
mnodeDecAcctRef(pAcct);
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass, void *pMsg) {
|
|||
pUser->createdTime = taosGetTimestampMs();
|
||||
pUser->superAuth = 0;
|
||||
pUser->writeAuth = 1;
|
||||
if (strcmp(pUser->user, "root") == 0 || strcmp(pUser->user, pUser->acct) == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0 || strcmp(pUser->user, pUser->acct) == 0) {
|
||||
pUser->superAuth = 1;
|
||||
}
|
||||
|
||||
|
@ -404,12 +404,12 @@ static int32_t mnodeProcessAlterUserMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
if ((pAlter->flag & TSDB_ALTER_USER_PASSWD) != 0) {
|
||||
bool hasRight = false;
|
||||
if (strcmp(pOperUser->user, "root") == 0) {
|
||||
if (strcmp(pOperUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
hasRight = true;
|
||||
} else if (strcmp(pUser->user, pOperUser->user) == 0) {
|
||||
hasRight = true;
|
||||
} else if (pOperUser->superAuth) {
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
hasRight = false;
|
||||
} else if (strcmp(pOperUser->acct, pUser->acct) != 0) {
|
||||
hasRight = false;
|
||||
|
@ -429,16 +429,16 @@ static int32_t mnodeProcessAlterUserMsg(SMnodeMsg *pMsg) {
|
|||
} else if ((pAlter->flag & TSDB_ALTER_USER_PRIVILEGES) != 0) {
|
||||
bool hasRight = false;
|
||||
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
hasRight = false;
|
||||
} else if (strcmp(pUser->user, pUser->acct) == 0) {
|
||||
hasRight = false;
|
||||
} else if (strcmp(pOperUser->user, "root") == 0) {
|
||||
} else if (strcmp(pOperUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
hasRight = true;
|
||||
} else if (strcmp(pUser->user, pOperUser->user) == 0) {
|
||||
hasRight = false;
|
||||
} else if (pOperUser->superAuth) {
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
hasRight = false;
|
||||
} else if (strcmp(pOperUser->acct, pUser->acct) != 0) {
|
||||
hasRight = false;
|
||||
|
@ -492,9 +492,9 @@ static int32_t mnodeProcessDropUserMsg(SMnodeMsg *pMsg) {
|
|||
}
|
||||
|
||||
bool hasRight = false;
|
||||
if (strcmp(pUser->user, "root") == 0) {
|
||||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
hasRight = false;
|
||||
} else if (strcmp(pOperUser->user, "root") == 0) {
|
||||
} else if (strcmp(pOperUser->user, TSDB_DEFAULT_USER) == 0) {
|
||||
hasRight = true;
|
||||
} else if (strcmp(pUser->user, pOperUser->user) == 0) {
|
||||
hasRight = false;
|
||||
|
|
|
@ -177,8 +177,8 @@ static void dnodeBuildMonitorSql(char *sql, int32_t cmd) {
|
|||
") tags (acctId binary(%d))",
|
||||
tsMonitorDbName, TSDB_USER_LEN);
|
||||
} else if (cmd == MONITOR_CMD_CREATE_TB_ACCT_ROOT) {
|
||||
snprintf(sql, SQL_LENGTH, "create table if not exists %s.acct_%s using %s.acct tags('%s')", tsMonitorDbName, "root",
|
||||
tsMonitorDbName, "root");
|
||||
snprintf(sql, SQL_LENGTH, "create table if not exists %s.acct_%s using %s.acct tags('%s')", tsMonitorDbName, TSDB_DEFAULT_USER,
|
||||
tsMonitorDbName, TSDB_DEFAULT_USER);
|
||||
} else if (cmd == MONITOR_CMD_CREATE_TB_SLOWQUERY) {
|
||||
snprintf(sql, SQL_LENGTH,
|
||||
"create table if not exists %s.slowquery(ts timestamp, username "
|
||||
|
|
|
@ -109,7 +109,7 @@ void* taos_execute(void *param) {
|
|||
|
||||
taosGetFqdnPortFromEp(tsFirst, fqdn, &port);
|
||||
|
||||
void *taos = taos_connect(fqdn, tsDefaultUser, tsDefaultPass, NULL, port);
|
||||
void *taos = taos_connect(fqdn, "root", "taosdata", NULL, port);
|
||||
if (taos == NULL) taos_error(taos);
|
||||
|
||||
char sql[1024] = {0};
|
||||
|
|
|
@ -73,7 +73,7 @@ void createDbAndTable() {
|
|||
|
||||
taosGetFqdnPortFromEp(tsFirst, fqdn, &port);
|
||||
|
||||
con = taos_connect(fqdn, tsDefaultUser, tsDefaultPass, NULL, port);
|
||||
con = taos_connect(fqdn, "root", "taosdata", NULL, port);
|
||||
if (con == NULL) {
|
||||
pError("failed to connect to DB, reason:%s", taos_errstr(con));
|
||||
exit(1);
|
||||
|
@ -200,7 +200,7 @@ void *syncTest(void *param) {
|
|||
|
||||
taosGetFqdnPortFromEp(tsFirst, fqdn, &port);
|
||||
|
||||
con = taos_connect(fqdn, tsDefaultUser, tsDefaultPass, NULL, port);
|
||||
con = taos_connect(fqdn, "root", "taosdata", NULL, port);
|
||||
if (con == NULL) {
|
||||
pError("index:%d, failed to connect to DB, reason:%s", pInfo->threadIndex, taos_errstr(con));
|
||||
exit(1);
|
||||
|
|
|
@ -71,7 +71,7 @@ void createDbAndTable() {
|
|||
char fqdn[TSDB_FQDN_LEN];
|
||||
uint16_t port;
|
||||
taosGetFqdnPortFromEp(tsFirst, fqdn, &port);
|
||||
con = taos_connect(fqdn, tsDefaultUser, tsDefaultPass, NULL, port);
|
||||
con = taos_connect(fqdn, "root", "taosdata", NULL, port);
|
||||
if (con == NULL) {
|
||||
pError("failed to connect to DB, reason:%s", taos_errstr(con));
|
||||
exit(1);
|
||||
|
@ -184,7 +184,7 @@ void *syncTest(void *param) {
|
|||
uint16_t port;
|
||||
|
||||
taosGetFqdnPortFromEp(tsFirst, fqdn, &port);
|
||||
con = taos_connect(fqdn, tsDefaultUser, tsDefaultPass, NULL, port);
|
||||
con = taos_connect(fqdn, "root", "taosdata", NULL, port);
|
||||
if (con == NULL) {
|
||||
pError("index:%d, failed to connect to DB, reason:%s", pInfo->threadIndex, taos_errstr(con));
|
||||
exit(1);
|
||||
|
|
|
@ -74,7 +74,7 @@ void createDbAndTable() {
|
|||
|
||||
taosGetFqdnPortFromEp(tsFirst, fqdn, &port);
|
||||
|
||||
con = taos_connect(fqdn, tsDefaultUser, tsDefaultPass, NULL, port);
|
||||
con = taos_connect(fqdn, "root", "taosdata", NULL, port);
|
||||
if (con == NULL) {
|
||||
pError("failed to connect to DB, reason:%s", taos_errstr(con));
|
||||
exit(1);
|
||||
|
@ -222,7 +222,7 @@ void *syncTest(void *param) {
|
|||
|
||||
taosGetFqdnPortFromEp(tsFirst, fqdn, &port);
|
||||
|
||||
con = taos_connect(fqdn, tsDefaultUser, tsDefaultPass, NULL, port);
|
||||
con = taos_connect(fqdn, "root", "taosdata", NULL, port);
|
||||
if (con == NULL) {
|
||||
pError("index:%d, failed to connect to DB, reason:%s", pInfo->threadIndex, taos_errstr(con));
|
||||
exit(1);
|
||||
|
|
|
@ -612,7 +612,7 @@ bool simCreateNativeConnect(SScript *script, char *user, char *pass) {
|
|||
}
|
||||
|
||||
bool simCreateTaosdConnect(SScript *script, char *rest) {
|
||||
char *user = tsDefaultUser;
|
||||
char *user = TSDB_DEFAULT_USER;
|
||||
char *token;
|
||||
int tokenLen;
|
||||
rest = paGetToken(rest, &token, &tokenLen);
|
||||
|
@ -622,9 +622,9 @@ bool simCreateTaosdConnect(SScript *script, char *rest) {
|
|||
}
|
||||
|
||||
if (simAsyncQuery) {
|
||||
return simCreateRestFulConnect(script, user, tsDefaultPass);
|
||||
return simCreateRestFulConnect(script, user, TSDB_DEFAULT_PASS);
|
||||
} else {
|
||||
return simCreateNativeConnect(script, user, tsDefaultPass);
|
||||
return simCreateNativeConnect(script, user, TSDB_DEFAULT_PASS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue