Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a3bdfdbb
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a3bdfdbb
编写于
6月 19, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'freemine/un-hard-coded-username/password' into develop
上级
ae360ecb
e6df8151
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
68 addition
and
98 deletion
+68
-98
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+6
-6
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+0
-4
src/common/src/tglobal.c
src/common/src/tglobal.c
+0
-35
src/cq/test/cqtest.c
src/cq/test/cqtest.c
+2
-2
src/inc/taosdef.h
src/inc/taosdef.h
+3
-0
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+2
-2
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+1
-1
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+4
-2
src/mnode/src/mnodeAcct.c
src/mnode/src/mnodeAcct.c
+5
-3
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+6
-6
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+7
-7
src/mnode/src/mnodeMnode.c
src/mnode/src/mnodeMnode.c
+3
-1
src/mnode/src/mnodeProfile.c
src/mnode/src/mnodeProfile.c
+6
-6
src/mnode/src/mnodeUser.c
src/mnode/src/mnodeUser.c
+11
-11
src/plugins/monitor/src/monitorMain.c
src/plugins/monitor/src/monitorMain.c
+2
-2
tests/test/c/importOneRow.c
tests/test/c/importOneRow.c
+1
-1
tests/test/c/importPerTable.c
tests/test/c/importPerTable.c
+2
-2
tests/test/c/insertPerRow.c
tests/test/c/insertPerRow.c
+2
-2
tests/test/c/insertPerTable.c
tests/test/c/insertPerTable.c
+2
-2
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+3
-3
未找到文件。
src/client/src/TSDBJNIConnector.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
;
}
...
...
src/common/inc/tglobal.h
浏览文件 @
a3bdfdbb
...
...
@@ -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
[];
...
...
src/common/src/tglobal.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
;
...
...
src/cq/test/cqtest.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
;
...
...
src/inc/taosdef.h
浏览文件 @
a3bdfdbb
...
...
@@ -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
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
();
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
a3bdfdbb
...
...
@@ -306,7 +306,7 @@ double getCurrentTime();
void
callBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
);
int
main
(
int
argc
,
char
*
argv
[])
{
SDemoArguments
arguments
=
{
NULL
,
// host
SDemoArguments
arguments
=
{
NULL
,
// host
0
,
// port
"root"
,
// user
"taosdata"
,
// password
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
]);
...
...
src/mnode/src/mnodeAcct.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
,
...
...
@@ -207,4 +209,4 @@ int32_t acctInit() { return TSDB_CODE_SUCCESS; }
void
acctCleanUp
()
{}
int32_t
acctCheck
(
void
*
pAcct
,
EAcctGrantType
type
)
{
return
TSDB_CODE_SUCCESS
;
}
#endif
\ No newline at end of file
#endif
src/mnode/src/mnodeDb.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
;
}
...
...
src/mnode/src/mnodeMnode.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
;
}
...
...
src/mnode/src/mnodeProfile.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
);
...
...
src/mnode/src/mnodeUser.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
;
...
...
src/plugins/monitor/src/monitorMain.c
浏览文件 @
a3bdfdbb
...
...
@@ -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 "
...
...
tests/test/c/importOneRow.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
};
...
...
tests/test/c/importPerTable.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
);
...
...
tests/test/c/insertPerRow.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
);
...
...
tests/test/c/insertPerTable.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
);
...
...
tests/tsim/src/simExe.c
浏览文件 @
a3bdfdbb
...
...
@@ -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
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录