Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6c4e6e7f
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6c4e6e7f
编写于
1月 23, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
1月 23, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9978 from taosdata/feature/warning
check password
上级
d44039e4
8364c807
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
45 addition
and
23 deletion
+45
-23
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+1
-1
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+11
-9
source/dnode/mgmt/impl/test/sut/src/client.cpp
source/dnode/mgmt/impl/test/sut/src/client.cpp
+3
-3
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+19
-1
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+6
-5
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+1
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-1
tools/shell/src/backup/tnettest.c
tools/shell/src/backup/tnettest.c
+2
-2
未找到文件。
source/client/src/clientEnv.c
浏览文件 @
6c4e6e7f
...
...
@@ -110,7 +110,7 @@ void* openTransporter(const char *user, const char *auth, int32_t numOfThread) {
rpcInit
.
user
=
(
char
*
)
user
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
ckey
=
"key"
;
//
rpcInit.spi = 1;
rpcInit
.
spi
=
1
;
rpcInit
.
secret
=
(
char
*
)
auth
;
void
*
pDnodeConn
=
rpcOpen
(
&
rpcInit
);
...
...
source/client/src/clientImpl.c
浏览文件 @
6c4e6e7f
...
...
@@ -562,7 +562,7 @@ STscObj* taosConnectImpl(const char *user, const char *auth, const char *db, uin
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
const
char
*
errorMsg
=
(
pRequest
->
code
==
TSDB_CODE_RPC_FQDN_ERROR
)
?
taos_errstr
(
pRequest
)
:
tstrerror
(
terrno
);
const
char
*
errorMsg
=
(
pRequest
->
code
==
TSDB_CODE_RPC_FQDN_ERROR
)
?
taos_errstr
(
pRequest
)
:
tstrerror
(
pRequest
->
code
);
printf
(
"failed to connect to server, reason: %s
\n\n
"
,
errorMsg
);
destroyRequest
(
pRequest
);
...
...
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
6c4e6e7f
...
...
@@ -179,9 +179,13 @@ static int32_t dndInitClient(SDnode *pDnode) {
rpcInit
.
idleTime
=
pDnode
->
cfg
.
shellActivityTimer
*
1000
;
rpcInit
.
user
=
INTERNAL_USER
;
rpcInit
.
ckey
=
INTERNAL_CKEY
;
rpcInit
.
s
ecret
=
INTERNAL_SECRET
;
rpcInit
.
s
pi
=
1
;
rpcInit
.
parent
=
pDnode
;
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)(
INTERNAL_SECRET
),
strlen
(
INTERNAL_SECRET
),
pass
);
rpcInit
.
secret
=
pass
;
pMgmt
->
clientRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pMgmt
->
clientRpc
==
NULL
)
{
dError
(
"failed to init rpc client"
);
...
...
@@ -256,20 +260,18 @@ static void dndSendMsgToMnodeRecv(SDnode *pDnode, SRpcMsg *pRpcMsg, SRpcMsg *pRp
static
int32_t
dndAuthInternalReq
(
SDnode
*
pDnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
if
(
strcmp
(
user
,
INTERNAL_USER
)
==
0
)
{
// A simple temporary implementation
char
pass
[
TSDB_PASSWORD_LEN
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)(
INTERNAL_SECRET
),
strlen
(
INTERNAL_SECRET
),
pass
);
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)(
INTERNAL_SECRET
),
strlen
(
INTERNAL_SECRET
),
pass
);
memcpy
(
secret
,
pass
,
TSDB_PASSWORD_LEN
);
*
spi
=
0
;
*
spi
=
1
;
*
encrypt
=
0
;
*
ckey
=
0
;
return
0
;
}
else
if
(
strcmp
(
user
,
TSDB_NETTEST_USER
)
==
0
)
{
// A simple temporary implementation
char
pass
[
TSDB_PASSWORD_LEN
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)(
TSDB_NETTEST_USER
),
strlen
(
TSDB_NETTEST_USER
),
pass
);
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)(
TSDB_NETTEST_USER
),
strlen
(
TSDB_NETTEST_USER
),
pass
);
memcpy
(
secret
,
pass
,
TSDB_PASSWORD_LEN
);
*
spi
=
0
;
*
spi
=
1
;
*
encrypt
=
0
;
*
ckey
=
0
;
return
0
;
...
...
source/dnode/mgmt/impl/test/sut/src/client.cpp
浏览文件 @
6c4e6e7f
...
...
@@ -27,8 +27,8 @@ void TestClient::SetRpcRsp(SRpcMsg* pRsp) { this->pRsp = pRsp; };
tsem_t
*
TestClient
::
GetSem
()
{
return
&
sem
;
}
bool
TestClient
::
Init
(
const
char
*
user
,
const
char
*
pass
,
const
char
*
fqdn
,
uint16_t
port
)
{
char
secretEncrypt
[
TSDB_PASSWORD_LEN
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
char
secretEncrypt
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass
_c
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
...
...
@@ -42,7 +42,7 @@ bool TestClient::Init(const char* user, const char* pass, const char* fqdn, uint
rpcInit
.
ckey
=
(
char
*
)
"key"
;
rpcInit
.
parent
=
this
;
rpcInit
.
secret
=
(
char
*
)
secretEncrypt
;
//
rpcInit.spi = 1;
rpcInit
.
spi
=
1
;
clientRpc
=
rpcOpen
(
&
rpcInit
);
ASSERT
(
clientRpc
);
...
...
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
6c4e6e7f
...
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "mndAuth.h"
#include "mndUser.h"
static
int32_t
mndProcessAuthReq
(
SMnodeMsg
*
pReq
);
...
...
@@ -25,7 +26,24 @@ int32_t mndInitAuth(SMnode *pMnode) {
void
mndCleanupAuth
(
SMnode
*
pMnode
)
{}
int32_t
mndRetriveAuth
(
SMnode
*
pMnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
return
0
;
}
int32_t
mndRetriveAuth
(
SMnode
*
pMnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
user
);
if
(
pUser
==
NULL
)
{
*
secret
=
0
;
mError
(
"user:%s, failed to auth user since %s"
,
user
,
terrstr
());
return
-
1
;
}
*
spi
=
1
;
*
encrypt
=
0
;
*
ckey
=
0
;
memcpy
(
secret
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
);
mndReleaseUser
(
pMnode
,
pUser
);
mDebug
(
"user:%s, auth info is returned"
,
user
);
return
0
;
}
static
int32_t
mndProcessAuthReq
(
SMnodeMsg
*
pReq
)
{
SAuthReq
*
pAuth
=
pReq
->
rpcMsg
.
pCont
;
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
6c4e6e7f
...
...
@@ -60,9 +60,9 @@ void mndCleanupUser(SMnode *pMnode) {}
static
int32_t
mndCreateDefaultUser
(
SMnode
*
pMnode
,
char
*
acct
,
char
*
user
,
char
*
pass
)
{
SUserObj
userObj
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
pass
,
strlen
(
pass
),
userObj
.
pass
);
tstrncpy
(
userObj
.
user
,
user
,
TSDB_USER_LEN
);
tstrncpy
(
userObj
.
acct
,
acct
,
TSDB_USER_LEN
);
taosEncryptPass
((
uint8_t
*
)
pass
,
strlen
(
pass
),
userObj
.
pass
);
userObj
.
createdTime
=
taosGetTimestampMs
();
userObj
.
updateTime
=
userObj
.
createdTime
;
...
...
@@ -202,7 +202,7 @@ SUserObj *mndAcquireUser(SMnode *pMnode, char *userName) {
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SUserObj
*
pUser
=
sdbAcquire
(
pSdb
,
SDB_USER
,
userName
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_
DB
_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_
USER
_NOT_EXIST
;
}
return
pUser
;
}
...
...
@@ -214,9 +214,9 @@ void mndReleaseUser(SMnode *pMnode, SUserObj *pUser) {
static
int32_t
mndCreateUser
(
SMnode
*
pMnode
,
char
*
acct
,
char
*
user
,
char
*
pass
,
SMnodeMsg
*
pReq
)
{
SUserObj
userObj
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
pass
,
strlen
(
pass
),
userObj
.
pass
);
tstrncpy
(
userObj
.
user
,
user
,
TSDB_USER_LEN
);
tstrncpy
(
userObj
.
acct
,
acct
,
TSDB_USER_LEN
);
taosEncryptPass
((
uint8_t
*
)
pass
,
strlen
(
pass
),
userObj
.
pass
);
userObj
.
createdTime
=
taosGetTimestampMs
();
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
superUser
=
0
;
...
...
@@ -351,8 +351,9 @@ static int32_t mndProcessAlterUserReq(SMnodeMsg *pReq) {
SUserObj
newUser
=
{
0
};
memcpy
(
&
newUser
,
pUser
,
sizeof
(
SUserObj
));
memset
(
pUser
->
pass
,
0
,
sizeof
(
pUser
->
pass
));
taosEncryptPass
((
uint8_t
*
)
pAlter
->
pass
,
strlen
(
pAlter
->
pass
),
pUser
->
pass
);
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
pAlter
->
pass
,
strlen
(
pAlter
->
pass
),
pass
);
memcpy
(
pUser
->
pass
,
pass
,
TSDB_PASSWORD_LEN
);
newUser
.
updateTime
=
taosGetTimestampMs
();
int32_t
code
=
mndUpdateUser
(
pMnode
,
pUser
,
&
newUser
,
pReq
);
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
6c4e6e7f
...
...
@@ -152,6 +152,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
if
(
insertFp
!=
NULL
)
{
code
=
(
*
insertFp
)(
pSdb
,
pRow
->
pObj
);
if
(
code
!=
0
)
{
code
=
terrno
;
taosWLockLatch
(
pLock
);
taosHashRemove
(
hash
,
pRow
->
pObj
,
keySize
);
taosWUnLockLatch
(
pLock
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
6c4e6e7f
...
...
@@ -5302,7 +5302,7 @@ SOperatorInfo* createExchangeOperatorInfo(const SArray* pSources, const SArray*
rpcInit
.
user
=
(
char
*
)
"root"
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
ckey
=
"key"
;
//
rpcInit.spi = 1;
rpcInit
.
spi
=
1
;
rpcInit
.
secret
=
(
char
*
)
"dcc5bed04851fec854c035b2e40263b6"
;
pInfo
->
pTransporter
=
rpcOpen
(
&
rpcInit
);
...
...
tools/shell/src/backup/tnettest.c
浏览文件 @
6c4e6e7f
...
...
@@ -319,7 +319,7 @@ void *taosNetInitRpc(char *secretEncrypt, char spi) {
char
user
[]
=
"nettestinternal"
;
char
pass
[]
=
"nettestinternal"
;
taosEncryptPass
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
taosEncryptPass
_c
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localPort
=
0
;
...
...
@@ -344,7 +344,7 @@ static int32_t taosNetCheckRpc(const char* serverFqdn, uint16_t port, uint16_t p
SRpcMsg
rspMsg
;
void
*
pRpcConn
;
char
secretEncrypt
[
32
]
=
{
0
};
char
secretEncrypt
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
pRpcConn
=
taosNetInitRpc
(
secretEncrypt
,
spi
);
if
(
NULL
==
pRpcConn
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录