Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
821b9ea4
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
821b9ea4
编写于
1月 04, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
bcad6bb5
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
97 addition
and
97 deletion
+97
-97
include/common/tmsg.h
include/common/tmsg.h
+3
-3
source/dnode/mnode/impl/src/mndAcct.c
source/dnode/mnode/impl/src/mndAcct.c
+18
-18
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+21
-21
source/dnode/mnode/impl/test/acct/acct.cpp
source/dnode/mnode/impl/test/acct/acct.cpp
+6
-6
source/dnode/mnode/impl/test/trans/trans.cpp
source/dnode/mnode/impl/test/trans/trans.cpp
+2
-2
source/dnode/mnode/impl/test/user/user.cpp
source/dnode/mnode/impl/test/user/user.cpp
+30
-30
source/libs/parser/inc/astToMsg.h
source/libs/parser/inc/astToMsg.h
+3
-3
source/libs/parser/src/astToMsg.c
source/libs/parser/src/astToMsg.c
+8
-8
src/client/src/tscServer.c
src/client/src/tscServer.c
+6
-6
未找到文件。
include/common/tmsg.h
浏览文件 @
821b9ea4
...
...
@@ -345,18 +345,18 @@ typedef struct {
int32_t
maxStreams
;
int32_t
accessState
;
// Configured only by command
int64_t
maxStorage
;
// In unit of GB
}
SCreateAcct
Msg
,
SAlterAcctMsg
;
}
SCreateAcct
Req
,
SAlterAcctReq
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
}
SDropUser
Msg
,
SDropAcctMsg
;
}
SDropUser
Req
,
SDropAcctReq
;
typedef
struct
{
int8_t
type
;
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
int8_t
superUser
;
// denote if it is a super user or not
}
SCreateUser
Msg
,
SAlterUserMsg
;
}
SCreateUser
Req
,
SAlterUserReq
;
typedef
struct
{
int32_t
contLen
;
...
...
source/dnode/mnode/impl/src/mndAcct.c
浏览文件 @
821b9ea4
...
...
@@ -25,10 +25,10 @@ static SSdbRaw *mndAcctActionEncode(SAcctObj *pAcct);
static
SSdbRow
*
mndAcctActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndAcctActionInsert
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mndAcctActionDelete
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mndAcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
pOld
Acct
,
SAcctObj
*
pNewAcct
);
static
int32_t
mndProcessCreateAcct
Msg
(
SMnodeMsg
*
pMnode
Msg
);
static
int32_t
mndProcessAlterAcct
Msg
(
SMnodeMsg
*
pMnode
Msg
);
static
int32_t
mndProcessDropAcct
Msg
(
SMnodeMsg
*
pMnode
Msg
);
static
int32_t
mndAcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
pOld
,
SAcctObj
*
pNew
);
static
int32_t
mndProcessCreateAcct
Req
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessAlterAcct
Req
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessDropAcct
Req
(
SMnodeMsg
*
p
Msg
);
int32_t
mndInitAcct
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_ACCT
,
...
...
@@ -40,9 +40,9 @@ int32_t mndInitAcct(SMnode *pMnode) {
.
updateFp
=
(
SdbUpdateFp
)
mndAcctActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndAcctActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_ACCT
,
mndProcessCreateAcct
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_ACCT
,
mndProcessAlterAcct
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_ACCT
,
mndProcessDropAcct
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_ACCT
,
mndProcessCreateAcct
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_ACCT
,
mndProcessAlterAcct
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_ACCT
,
mndProcessDropAcct
Req
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
@@ -176,29 +176,29 @@ static int32_t mndAcctActionDelete(SSdb *pSdb, SAcctObj *pAcct) {
return
0
;
}
static
int32_t
mndAcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
pOld
Acct
,
SAcctObj
*
pNewAcct
)
{
mTrace
(
"acct:%s, perform update action, old_row:%p new_row:%p"
,
pOld
Acct
->
acct
,
pOldAcct
,
pNewAcct
);
static
int32_t
mndAcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
pOld
,
SAcctObj
*
pNew
)
{
mTrace
(
"acct:%s, perform update action, old_row:%p new_row:%p"
,
pOld
->
acct
,
pOld
,
pNew
);
pOld
Acct
->
updateTime
=
pNewAcct
->
updateTime
;
pOld
Acct
->
status
=
pNewAcct
->
status
;
memcpy
(
&
pOld
Acct
->
cfg
,
&
pNewAcct
->
cfg
,
sizeof
(
SAcctCfg
));
pOld
->
updateTime
=
pNew
->
updateTime
;
pOld
->
status
=
pNew
->
status
;
memcpy
(
&
pOld
->
cfg
,
&
pNew
->
cfg
,
sizeof
(
SAcctCfg
));
return
0
;
}
static
int32_t
mndProcessCreateAcct
Msg
(
SMnodeMsg
*
pMnode
Msg
)
{
static
int32_t
mndProcessCreateAcct
Req
(
SMnodeMsg
*
p
Msg
)
{
terrno
=
TSDB_CODE_MND_MSG_NOT_PROCESSED
;
mError
(
"failed to process create acct
msg
since %s"
,
terrstr
());
mError
(
"failed to process create acct
request
since %s"
,
terrstr
());
return
-
1
;
}
static
int32_t
mndProcessAlterAcct
Msg
(
SMnodeMsg
*
pMnode
Msg
)
{
static
int32_t
mndProcessAlterAcct
Req
(
SMnodeMsg
*
p
Msg
)
{
terrno
=
TSDB_CODE_MND_MSG_NOT_PROCESSED
;
mError
(
"failed to process create acct
msg
since %s"
,
terrstr
());
mError
(
"failed to process create acct
request
since %s"
,
terrstr
());
return
-
1
;
}
static
int32_t
mndProcessDropAcct
Msg
(
SMnodeMsg
*
pMnode
Msg
)
{
static
int32_t
mndProcessDropAcct
Req
(
SMnodeMsg
*
p
Msg
)
{
terrno
=
TSDB_CODE_MND_MSG_NOT_PROCESSED
;
mError
(
"failed to process create acct
msg
since %s"
,
terrstr
());
mError
(
"failed to process create acct
request
since %s"
,
terrstr
());
return
-
1
;
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
821b9ea4
...
...
@@ -28,11 +28,11 @@ static SSdbRaw *mndUserActionEncode(SUserObj *pUser);
static
SSdbRow
*
mndUserActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndUserActionInsert
(
SSdb
*
pSdb
,
SUserObj
*
pUser
);
static
int32_t
mndUserActionDelete
(
SSdb
*
pSdb
,
SUserObj
*
pUser
);
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
pOld
User
,
SUserObj
*
pNewUser
);
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
pOld
,
SUserObj
*
pNew
);
static
int32_t
mndCreateUser
(
SMnode
*
pMnode
,
char
*
acct
,
char
*
user
,
char
*
pass
,
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessCreateUser
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterUser
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropUser
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessCreateUser
Req
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterUser
Req
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropUser
Req
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetUserMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveUsers
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextUser
(
SMnode
*
pMnode
,
void
*
pIter
);
...
...
@@ -47,9 +47,9 @@ int32_t mndInitUser(SMnode *pMnode) {
.
updateFp
=
(
SdbUpdateFp
)
mndUserActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndUserActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_USER
,
mndProcessCreateUser
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_USER
,
mndProcessAlterUser
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_USER
,
mndProcessDropUser
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_USER
,
mndProcessCreateUser
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_USER
,
mndProcessAlterUser
Req
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_USER
,
mndProcessDropUser
Req
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_USER
,
mndGetUserMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_USER
,
mndRetrieveUsers
);
...
...
@@ -192,10 +192,10 @@ static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) {
return
0
;
}
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
pOld
User
,
SUserObj
*
pNewUser
)
{
mTrace
(
"user:%s, perform update action, old_row:%p new_row:%p"
,
pOld
User
->
user
,
pOldUser
,
pNewUser
);
memcpy
(
pOld
User
->
pass
,
pNewUser
->
pass
,
TSDB_PASSWORD_LEN
);
pOld
User
->
updateTime
=
pNewUser
->
updateTime
;
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
pOld
,
SUserObj
*
pNew
)
{
mTrace
(
"user:%s, perform update action, old_row:%p new_row:%p"
,
pOld
->
user
,
pOld
,
pNew
);
memcpy
(
pOld
->
pass
,
pNew
->
pass
,
TSDB_PASSWORD_LEN
);
pOld
->
updateTime
=
pNew
->
updateTime
;
return
0
;
}
...
...
@@ -247,9 +247,9 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, char *user, char *pass,
return
0
;
}
static
int32_t
mndProcessCreateUser
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessCreateUser
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SCreateUser
Msg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SCreateUser
Req
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"user:%s, start to create"
,
pCreate
->
user
);
...
...
@@ -291,15 +291,15 @@ static int32_t mndProcessCreateUserMsg(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
int32_t
mndUpdateUser
(
SMnode
*
pMnode
,
SUserObj
*
pOld
User
,
SUserObj
*
pNewUser
,
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndUpdateUser
(
SMnode
*
pMnode
,
SUserObj
*
pOld
,
SUserObj
*
pNew
,
SMnodeMsg
*
pMsg
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
&
pMsg
->
rpcMsg
);
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to update since %s"
,
pOld
User
->
user
,
terrstr
());
mError
(
"user:%s, failed to update since %s"
,
pOld
->
user
,
terrstr
());
return
-
1
;
}
mDebug
(
"trans:%d, used to update user:%s"
,
pTrans
->
id
,
pOld
User
->
user
);
mDebug
(
"trans:%d, used to update user:%s"
,
pTrans
->
id
,
pOld
->
user
);
SSdbRaw
*
pRedoRaw
=
mndUserActionEncode
(
pNew
User
);
SSdbRaw
*
pRedoRaw
=
mndUserActionEncode
(
pNew
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append redo log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
...
...
@@ -317,9 +317,9 @@ static int32_t mndUpdateUser(SMnode *pMnode, SUserObj *pOldUser, SUserObj *pNewU
return
0
;
}
static
int32_t
mndProcessAlterUser
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessAlterUser
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SAlterUser
Msg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
SAlterUser
Req
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"user:%s, start to alter"
,
pAlter
->
user
);
...
...
@@ -394,9 +394,9 @@ static int32_t mndDropUser(SMnode *pMnode, SMnodeMsg *pMsg, SUserObj *pUser) {
return
0
;
}
static
int32_t
mndProcessDropUser
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessDropUser
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SDropUser
Msg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SDropUser
Req
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"user:%s, start to drop"
,
pDrop
->
user
);
...
...
source/dnode/mnode/impl/test/acct/acct.cpp
浏览文件 @
821b9ea4
...
...
@@ -26,9 +26,9 @@ class DndTestAcct : public ::testing::Test {
Testbase
DndTestAcct
::
test
;
TEST_F
(
DndTestAcct
,
01
_CreateAcct
)
{
int32_t
contLen
=
sizeof
(
SCreateAcct
Msg
);
int32_t
contLen
=
sizeof
(
SCreateAcct
Req
);
SCreateAcct
Msg
*
pReq
=
(
SCreateAcctMsg
*
)
rpcMallocCont
(
contLen
);
SCreateAcct
Req
*
pReq
=
(
SCreateAcctReq
*
)
rpcMallocCont
(
contLen
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_CREATE_ACCT
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
@@ -36,9 +36,9 @@ TEST_F(DndTestAcct, 01_CreateAcct) {
}
TEST_F
(
DndTestAcct
,
02
_AlterAcct
)
{
int32_t
contLen
=
sizeof
(
SCreateAcct
Msg
);
int32_t
contLen
=
sizeof
(
SCreateAcct
Req
);
SAlterAcct
Msg
*
pReq
=
(
SAlterAcctMsg
*
)
rpcMallocCont
(
contLen
);
SAlterAcct
Req
*
pReq
=
(
SAlterAcctReq
*
)
rpcMallocCont
(
contLen
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_ALTER_ACCT
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
@@ -46,9 +46,9 @@ TEST_F(DndTestAcct, 02_AlterAcct) {
}
TEST_F
(
DndTestAcct
,
03
_DropAcct
)
{
int32_t
contLen
=
sizeof
(
SDropAcct
Msg
);
int32_t
contLen
=
sizeof
(
SDropAcct
Req
);
SDropAcct
Msg
*
pReq
=
(
SDropAcctMsg
*
)
rpcMallocCont
(
contLen
);
SDropAcct
Req
*
pReq
=
(
SDropAcctReq
*
)
rpcMallocCont
(
contLen
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_ACCT
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
...
...
source/dnode/mnode/impl/test/trans/trans.cpp
浏览文件 @
821b9ea4
...
...
@@ -52,9 +52,9 @@ Testbase DndTestTrans::test;
TEST_F
(
DndTestTrans
,
01
_CreateUser_Crash
)
{
{
int32_t
contLen
=
sizeof
(
SCreateUser
Msg
);
int32_t
contLen
=
sizeof
(
SCreateUser
Req
);
SCreateUser
Msg
*
pReq
=
(
SCreateUserMsg
*
)
rpcMallocCont
(
contLen
);
SCreateUser
Req
*
pReq
=
(
SCreateUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
"p1"
);
...
...
source/dnode/mnode/impl/test/user/user.cpp
浏览文件 @
821b9ea4
...
...
@@ -45,9 +45,9 @@ TEST_F(DndTestUser, 01_ShowUser) {
TEST_F
(
DndTestUser
,
02
_Create_User
)
{
{
int32_t
contLen
=
sizeof
(
SCreateUser
Msg
);
int32_t
contLen
=
sizeof
(
SCreateUser
Req
);
SCreateUser
Msg
*
pReq
=
(
SCreateUserMsg
*
)
rpcMallocCont
(
contLen
);
SCreateUser
Req
*
pReq
=
(
SCreateUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
""
);
strcpy
(
pReq
->
pass
,
"p1"
);
...
...
@@ -57,9 +57,9 @@ TEST_F(DndTestUser, 02_Create_User) {
}
{
int32_t
contLen
=
sizeof
(
SCreateUser
Msg
);
int32_t
contLen
=
sizeof
(
SCreateUser
Req
);
SCreateUser
Msg
*
pReq
=
(
SCreateUserMsg
*
)
rpcMallocCont
(
contLen
);
SCreateUser
Req
*
pReq
=
(
SCreateUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
""
);
...
...
@@ -69,9 +69,9 @@ TEST_F(DndTestUser, 02_Create_User) {
}
{
int32_t
contLen
=
sizeof
(
SCreateUser
Msg
);
int32_t
contLen
=
sizeof
(
SCreateUser
Req
);
SCreateUser
Msg
*
pReq
=
(
SCreateUserMsg
*
)
rpcMallocCont
(
contLen
);
SCreateUser
Req
*
pReq
=
(
SCreateUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"root"
);
strcpy
(
pReq
->
pass
,
"1"
);
...
...
@@ -81,9 +81,9 @@ TEST_F(DndTestUser, 02_Create_User) {
}
{
int32_t
contLen
=
sizeof
(
SCreateUser
Msg
);
int32_t
contLen
=
sizeof
(
SCreateUser
Req
);
SCreateUser
Msg
*
pReq
=
(
SCreateUserMsg
*
)
rpcMallocCont
(
contLen
);
SCreateUser
Req
*
pReq
=
(
SCreateUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
"p1"
);
...
...
@@ -101,9 +101,9 @@ TEST_F(DndTestUser, 02_Create_User) {
TEST_F
(
DndTestUser
,
03
_Alter_User
)
{
{
int32_t
contLen
=
sizeof
(
SAlterUser
Msg
);
int32_t
contLen
=
sizeof
(
SAlterUser
Req
);
SAlterUser
Msg
*
pReq
=
(
SAlterUserMsg
*
)
rpcMallocCont
(
contLen
);
SAlterUser
Req
*
pReq
=
(
SAlterUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
""
);
strcpy
(
pReq
->
pass
,
"p1"
);
...
...
@@ -113,9 +113,9 @@ TEST_F(DndTestUser, 03_Alter_User) {
}
{
int32_t
contLen
=
sizeof
(
SAlterUser
Msg
);
int32_t
contLen
=
sizeof
(
SAlterUser
Req
);
SAlterUser
Msg
*
pReq
=
(
SAlterUserMsg
*
)
rpcMallocCont
(
contLen
);
SAlterUser
Req
*
pReq
=
(
SAlterUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
""
);
...
...
@@ -125,9 +125,9 @@ TEST_F(DndTestUser, 03_Alter_User) {
}
{
int32_t
contLen
=
sizeof
(
SAlterUser
Msg
);
int32_t
contLen
=
sizeof
(
SAlterUser
Req
);
SAlterUser
Msg
*
pReq
=
(
SAlterUserMsg
*
)
rpcMallocCont
(
contLen
);
SAlterUser
Req
*
pReq
=
(
SAlterUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u4"
);
strcpy
(
pReq
->
pass
,
"1"
);
...
...
@@ -137,9 +137,9 @@ TEST_F(DndTestUser, 03_Alter_User) {
}
{
int32_t
contLen
=
sizeof
(
SAlterUser
Msg
);
int32_t
contLen
=
sizeof
(
SAlterUser
Req
);
SAlterUser
Msg
*
pReq
=
(
SAlterUserMsg
*
)
rpcMallocCont
(
contLen
);
SAlterUser
Req
*
pReq
=
(
SAlterUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
"1"
);
...
...
@@ -151,9 +151,9 @@ TEST_F(DndTestUser, 03_Alter_User) {
TEST_F
(
DndTestUser
,
04
_Drop_User
)
{
{
int32_t
contLen
=
sizeof
(
SDropUser
Msg
);
int32_t
contLen
=
sizeof
(
SDropUser
Req
);
SDropUser
Msg
*
pReq
=
(
SDropUserMsg
*
)
rpcMallocCont
(
contLen
);
SDropUser
Req
*
pReq
=
(
SDropUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
""
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_USER
,
pReq
,
contLen
);
...
...
@@ -162,9 +162,9 @@ TEST_F(DndTestUser, 04_Drop_User) {
}
{
int32_t
contLen
=
sizeof
(
SDropUser
Msg
);
int32_t
contLen
=
sizeof
(
SDropUser
Req
);
SDropUser
Msg
*
pReq
=
(
SDropUserMsg
*
)
rpcMallocCont
(
contLen
);
SDropUser
Req
*
pReq
=
(
SDropUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u4"
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_USER
,
pReq
,
contLen
);
...
...
@@ -173,9 +173,9 @@ TEST_F(DndTestUser, 04_Drop_User) {
}
{
int32_t
contLen
=
sizeof
(
SDropUser
Msg
);
int32_t
contLen
=
sizeof
(
SDropUser
Req
);
SDropUser
Msg
*
pReq
=
(
SDropUserMsg
*
)
rpcMallocCont
(
contLen
);
SDropUser
Req
*
pReq
=
(
SDropUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u1"
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_USER
,
pReq
,
contLen
);
...
...
@@ -192,9 +192,9 @@ TEST_F(DndTestUser, 04_Drop_User) {
TEST_F
(
DndTestUser
,
05
_Create_Drop_Alter_User
)
{
{
int32_t
contLen
=
sizeof
(
SCreateUser
Msg
);
int32_t
contLen
=
sizeof
(
SCreateUser
Req
);
SCreateUser
Msg
*
pReq
=
(
SCreateUserMsg
*
)
rpcMallocCont
(
contLen
);
SCreateUser
Req
*
pReq
=
(
SCreateUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
"p1"
);
...
...
@@ -204,9 +204,9 @@ TEST_F(DndTestUser, 05_Create_Drop_Alter_User) {
}
{
int32_t
contLen
=
sizeof
(
SCreateUser
Msg
);
int32_t
contLen
=
sizeof
(
SCreateUser
Req
);
SCreateUser
Msg
*
pReq
=
(
SCreateUserMsg
*
)
rpcMallocCont
(
contLen
);
SCreateUser
Req
*
pReq
=
(
SCreateUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u2"
);
strcpy
(
pReq
->
pass
,
"p2"
);
...
...
@@ -235,9 +235,9 @@ TEST_F(DndTestUser, 05_Create_Drop_Alter_User) {
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
{
int32_t
contLen
=
sizeof
(
SAlterUser
Msg
);
int32_t
contLen
=
sizeof
(
SAlterUser
Req
);
SAlterUser
Msg
*
pReq
=
(
SAlterUserMsg
*
)
rpcMallocCont
(
contLen
);
SAlterUser
Req
*
pReq
=
(
SAlterUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u1"
);
strcpy
(
pReq
->
pass
,
"p2"
);
...
...
@@ -266,9 +266,9 @@ TEST_F(DndTestUser, 05_Create_Drop_Alter_User) {
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
{
int32_t
contLen
=
sizeof
(
SDropUser
Msg
);
int32_t
contLen
=
sizeof
(
SDropUser
Req
);
SDropUser
Msg
*
pReq
=
(
SDropUserMsg
*
)
rpcMallocCont
(
contLen
);
SDropUser
Req
*
pReq
=
(
SDropUserReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
user
,
"u1"
);
SRpcMsg
*
pMsg
=
test
.
SendMsg
(
TDMT_MND_DROP_USER
,
pReq
,
contLen
);
...
...
source/libs/parser/inc/astToMsg.h
浏览文件 @
821b9ea4
...
...
@@ -5,9 +5,9 @@
#include "tmsg.h"
SCreateUser
Msg
*
buildUserManipulationMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SCreateAcct
Msg
*
buildAcctManipulationMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SDropUser
Msg
*
buildDropUserMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SCreateUser
Req
*
buildUserManipulationMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SCreateAcct
Req
*
buildAcctManipulationMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SDropUser
Req
*
buildDropUserMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SShowMsg
*
buildShowMsg
(
SShowInfo
*
pShowInfo
,
SParseBasicCtx
*
pParseCtx
,
char
*
msgBuf
,
int32_t
msgLen
);
SCreateDbMsg
*
buildCreateDbMsg
(
SCreateDbInfo
*
pCreateDbInfo
,
SParseBasicCtx
*
pCtx
,
SMsgBuf
*
pMsgBuf
);
SCreateStbMsg
*
buildCreateTableMsg
(
SCreateTableSql
*
pCreateTableSql
,
int32_t
*
len
,
SParseBasicCtx
*
pParseCtx
,
SMsgBuf
*
pMsgBuf
);
...
...
source/libs/parser/src/astToMsg.c
浏览文件 @
821b9ea4
...
...
@@ -2,8 +2,8 @@
#include "astGenerator.h"
#include "parserUtil.h"
SCreateUser
Msg
*
buildUserManipulationMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
)
{
SCreateUser
Msg
*
pMsg
=
(
SCreateUserMsg
*
)
calloc
(
1
,
sizeof
(
SCreateUserMsg
));
SCreateUser
Req
*
buildUserManipulationMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
)
{
SCreateUser
Req
*
pMsg
=
(
SCreateUserReq
*
)
calloc
(
1
,
sizeof
(
SCreateUserReq
));
if
(
pMsg
==
NULL
)
{
// tscError("0x%" PRIx64 " failed to malloc for query msg", id);
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
@@ -25,8 +25,8 @@ SCreateUserMsg* buildUserManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, in
return
pMsg
;
}
SCreateAcct
Msg
*
buildAcctManipulationMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
)
{
SCreateAcct
Msg
*
pCreateMsg
=
(
SCreateAcctMsg
*
)
calloc
(
1
,
sizeof
(
SCreateAcctMsg
));
SCreateAcct
Req
*
buildAcctManipulationMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
outputLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
)
{
SCreateAcct
Req
*
pCreateMsg
=
(
SCreateAcctReq
*
)
calloc
(
1
,
sizeof
(
SCreateAcctReq
));
if
(
pCreateMsg
==
NULL
)
{
qError
(
"0x%"
PRIx64
" failed to malloc for query msg"
,
id
);
terrno
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
...
...
@@ -64,24 +64,24 @@ SCreateAcctMsg* buildAcctManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, in
}
}
*
outputLen
=
sizeof
(
SCreateAcct
Msg
);
*
outputLen
=
sizeof
(
SCreateAcct
Req
);
return
pCreateMsg
;
}
SDropUser
Msg
*
buildDropUserMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
msgLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
SDropUser
Req
*
buildDropUserMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
msgLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
SToken
*
pName
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
pName
->
n
>=
TSDB_USER_LEN
)
{
return
NULL
;
}
SDropUser
Msg
*
pMsg
=
calloc
(
1
,
sizeof
(
SDropUserMsg
));
SDropUser
Req
*
pMsg
=
calloc
(
1
,
sizeof
(
SDropUserReq
));
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
return
NULL
;
}
strncpy
(
pMsg
->
user
,
pName
->
z
,
pName
->
n
);
*
msgLen
=
sizeof
(
SDropUser
Msg
);
*
msgLen
=
sizeof
(
SDropUser
Req
);
return
pMsg
;
}
...
...
src/client/src/tscServer.c
浏览文件 @
821b9ea4
...
...
@@ -1210,13 +1210,13 @@ int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildAcctMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SCreateAcct
Msg
);
pCmd
->
payloadLen
=
sizeof
(
SCreateAcct
Req
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"0x%"
PRIx64
" failed to malloc for query msg"
,
pSql
->
self
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
SCreateAcct
Msg
*
pAlterMsg
=
(
SCreateAcctMsg
*
)
pCmd
->
payload
;
SCreateAcct
Req
*
pAlterMsg
=
(
SCreateAcctReq
*
)
pCmd
->
payload
;
SStrToken
*
pName
=
&
pInfo
->
pMiscInfo
->
user
.
user
;
SStrToken
*
pPwd
=
&
pInfo
->
pMiscInfo
->
user
.
passwd
;
...
...
@@ -1255,14 +1255,14 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildUserMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SCreateUser
Msg
);
pCmd
->
payloadLen
=
sizeof
(
SCreateUser
Req
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"0x%"
PRIx64
" failed to malloc for query msg"
,
pSql
->
self
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
SCreateUser
Msg
*
pAlterMsg
=
(
SCreateUserMsg
*
)
pCmd
->
payload
;
SCreateUser
Req
*
pAlterMsg
=
(
SCreateUserReq
*
)
pCmd
->
payload
;
SUserInfo
*
pUser
=
&
pInfo
->
pMiscInfo
->
user
;
strncpy
(
pAlterMsg
->
user
,
pUser
->
user
.
z
,
pUser
->
user
.
n
);
...
...
@@ -1369,7 +1369,7 @@ int32_t tscBuildDropUserAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
char
user
[
TSDB_USER_LEN
]
=
{
0
};
tstrncpy
(
user
,
pCmd
->
payload
,
TSDB_USER_LEN
);
pCmd
->
payloadLen
=
sizeof
(
SDropUser
Msg
);
pCmd
->
payloadLen
=
sizeof
(
SDropUser
Req
);
pCmd
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_DROP_USER
)
?
TDMT_MND_DROP_USER
:
TDMT_MND_DROP_ACCT
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
...
...
@@ -1377,7 +1377,7 @@ int32_t tscBuildDropUserAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
SDropUser
Msg
*
pDropMsg
=
(
SDropUserMsg
*
)
pCmd
->
payload
;
SDropUser
Req
*
pDropMsg
=
(
SDropUserReq
*
)
pCmd
->
payload
;
tstrncpy
(
pDropMsg
->
user
,
user
,
tListLen
(
user
));
return
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录