Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7f123214
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看板
提交
7f123214
编写于
6月 10, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-459: TSDB_USER_LEN
上级
b81f7158
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
33 addition
and
33 deletion
+33
-33
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+3
-3
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-1
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+1
-1
src/inc/taosmsg.h
src/inc/taosmsg.h
+7
-7
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+5
-5
src/mnode/inc/mnodeProfile.h
src/mnode/inc/mnodeProfile.h
+1
-1
src/mnode/src/mnodeProfile.c
src/mnode/src/mnodeProfile.c
+4
-4
src/mnode/src/mnodeUser.c
src/mnode/src/mnodeUser.c
+2
-2
src/plugins/http/inc/httpHandle.h
src/plugins/http/inc/httpHandle.h
+2
-2
src/plugins/http/src/gcHandle.c
src/plugins/http/src/gcHandle.c
+1
-1
src/plugins/http/src/httpAuth.c
src/plugins/http/src/httpAuth.c
+1
-1
src/plugins/http/src/restHandle.c
src/plugins/http/src/restHandle.c
+1
-1
src/plugins/http/src/tgHandle.c
src/plugins/http/src/tgHandle.c
+2
-2
src/plugins/monitor/src/monitorMain.c
src/plugins/monitor/src/monitorMain.c
+1
-1
未找到文件。
src/client/src/tscLocal.c
浏览文件 @
7f123214
...
...
@@ -279,7 +279,7 @@ static void tscProcessCurrentUser(SSqlObj *pSql) {
pExpr
->
resType
=
TSDB_DATA_TYPE_BINARY
;
char
*
vx
=
calloc
(
1
,
pExpr
->
resBytes
);
STR_WITH_MAXSIZE_TO_VARSTR
(
vx
,
pSql
->
pTscObj
->
user
,
TSDB_USER_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
vx
,
pSql
->
pTscObj
->
user
,
sizeof
(
pSql
->
pTscObj
->
user
)
);
tscSetLocalQueryResult
(
pSql
,
vx
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
free
(
vx
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
7f123214
...
...
@@ -232,7 +232,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
pzName
->
n
=
strdequote
(
pzName
->
z
);
strncpy
(
pTableMetaInfo
->
name
,
pzName
->
z
,
pzName
->
n
);
}
else
{
// drop user
if
(
pzName
->
n
>
TSDB_USER_LEN
)
{
if
(
pzName
->
n
>
=
TSDB_USER_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
...
...
@@ -317,7 +317,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
TSDB_CODE_TSC_INVALID_SQL
;
}
if
(
pName
->
n
>
TSDB_USER_LEN
)
{
if
(
pName
->
n
>
=
TSDB_USER_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
...
...
@@ -401,7 +401,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SSQLToken
*
pName
=
&
pUser
->
user
;
SSQLToken
*
pPwd
=
&
pUser
->
passwd
;
if
(
pName
->
n
>
TSDB_USER_LEN
)
{
if
(
pName
->
n
>
=
TSDB_USER_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
...
...
src/common/src/tglobal.c
浏览文件 @
7f123214
...
...
@@ -718,7 +718,7 @@ static void doInitGlobalConfig() {
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
0
;
cfg
.
ptrLength
=
TSDB_USER_LEN
;
cfg
.
ptrLength
=
TSDB_USER_LEN
-
1
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
...
...
src/dnode/src/dnodeShell.c
浏览文件 @
7f123214
...
...
@@ -147,7 +147,7 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
if
(
code
!=
TSDB_CODE_RPC_NOT_READY
)
return
code
;
SDMAuthMsg
*
pMsg
=
rpcMallocCont
(
sizeof
(
SDMAuthMsg
));
tstrncpy
(
pMsg
->
user
,
user
,
TSDB_USER_LEN
);
tstrncpy
(
pMsg
->
user
,
user
,
sizeof
(
pMsg
->
user
)
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pMsg
;
...
...
src/inc/taosmsg.h
浏览文件 @
7f123214
...
...
@@ -321,18 +321,18 @@ typedef struct {
}
SAcctCfg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
+
1
];
char
pass
[
TSDB_KEY_LEN
+
1
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
];
SAcctCfg
cfg
;
}
SCMCreateAcctMsg
,
SCMAlterAcctMsg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
+
1
];
char
user
[
TSDB_USER_LEN
];
}
SCMDropUserMsg
,
SCMDropAcctMsg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
+
1
];
char
pass
[
TSDB_KEY_LEN
+
1
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
];
int8_t
privilege
;
int8_t
flag
;
}
SCMCreateUserMsg
,
SCMAlterUserMsg
;
...
...
@@ -501,7 +501,7 @@ typedef struct {
}
SVnodeLoad
;
typedef
struct
{
char
acct
[
TSDB_USER_LEN
+
1
];
char
acct
[
TSDB_USER_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
int32_t
cacheBlockSize
;
//MB
int32_t
totalBlocks
;
...
...
@@ -750,7 +750,7 @@ typedef struct {
}
SMDAlterStreamMsg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
+
1
];
char
user
[
TSDB_USER_LEN
];
char
spi
;
char
encrypt
;
char
secret
[
TSDB_KEY_LEN
+
1
];
...
...
src/mnode/inc/mnodeDef.h
浏览文件 @
7f123214
...
...
@@ -155,7 +155,7 @@ typedef struct {
typedef
struct
SDbObj
{
char
name
[
TSDB_DB_NAME_LEN
];
char
acct
[
TSDB_USER_LEN
+
1
];
char
acct
[
TSDB_USER_LEN
];
int64_t
createdTime
;
int32_t
cfgVersion
;
SDbCfg
cfg
;
...
...
@@ -172,9 +172,9 @@ typedef struct SDbObj {
}
SDbObj
;
typedef
struct
SUserObj
{
char
user
[
TSDB_USER_LEN
+
1
];
char
pass
[
TSDB_KEY_LEN
+
1
];
char
acct
[
TSDB_USER_LEN
+
1
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
];
char
acct
[
TSDB_USER_LEN
];
int64_t
createdTime
;
int8_t
superAuth
;
int8_t
writeAuth
;
...
...
@@ -203,7 +203,7 @@ typedef struct {
}
SAcctInfo
;
typedef
struct
SAcctObj
{
char
user
[
TSDB_USER_LEN
+
1
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
+
1
];
SAcctCfg
cfg
;
int32_t
acctId
;
...
...
src/mnode/inc/mnodeProfile.h
浏览文件 @
7f123214
...
...
@@ -22,7 +22,7 @@ extern "C" {
#include "mnodeDef.h"
typedef
struct
{
char
user
[
TSDB_USER_LEN
+
1
];
char
user
[
TSDB_USER_LEN
];
int8_t
killed
;
uint16_t
port
;
uint32_t
ip
;
...
...
src/mnode/src/mnodeProfile.c
浏览文件 @
7f123214
...
...
@@ -97,7 +97,7 @@ SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port) {
.
connId
=
connId
,
.
stime
=
taosGetTimestampMs
()
};
tstrncpy
(
connObj
.
user
,
user
,
TSDB_USER_LEN
);
tstrncpy
(
connObj
.
user
,
user
,
sizeof
(
connObj
.
user
)
);
char
key
[
10
];
sprintf
(
key
,
"%u"
,
connId
);
...
...
@@ -235,7 +235,7 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pConnObj
->
user
,
TSDB_USER_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pConnObj
->
user
,
sizeof
(
pConnObj
->
user
)
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
@@ -358,7 +358,7 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pConnObj
->
user
,
TSDB_USER_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pConnObj
->
user
,
sizeof
(
pConnObj
->
user
)
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
@@ -479,7 +479,7 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pConnObj
->
user
,
TSDB_USER_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pConnObj
->
user
,
sizeof
(
pConnObj
->
user
)
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
src/mnode/src/mnodeUser.c
浏览文件 @
7f123214
...
...
@@ -315,7 +315,7 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pUser
->
user
,
TSDB_USER_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pUser
->
user
,
sizeof
(
pUser
->
user
)
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
@@ -336,7 +336,7 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pUser
->
acct
,
TSDB_USER_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pUser
->
acct
,
sizeof
(
pUser
->
user
)
);
cols
++
;
numOfRows
++
;
...
...
src/plugins/http/inc/httpHandle.h
浏览文件 @
7f123214
...
...
@@ -67,7 +67,7 @@
#define HTTP_COMPRESS_IDENTITY 0
#define HTTP_COMPRESS_GZIP 2
#define HTTP_SESSION_ID_LEN (TSDB_USER_LEN
* 2 + 1
)
#define HTTP_SESSION_ID_LEN (TSDB_USER_LEN
+ TSDB_PASSWORD_LEN
)
typedef
enum
{
HTTP_CONTEXT_STATE_READY
,
...
...
@@ -84,7 +84,7 @@ typedef struct {
int
expire
;
int
access
;
void
*
taos
;
char
id
[
HTTP_SESSION_ID_LEN
+
1
];
char
id
[
HTTP_SESSION_ID_LEN
];
}
HttpSession
;
typedef
enum
{
...
...
src/plugins/http/src/gcHandle.c
浏览文件 @
7f123214
...
...
@@ -48,7 +48,7 @@ void gcInitHandle(HttpServer* pServer) { httpAddMethod(pServer, &gcDecodeMethod)
bool
gcGetUserFromUrl
(
HttpContext
*
pContext
)
{
HttpParser
*
pParser
=
&
pContext
->
parser
;
if
(
pParser
->
path
[
GC_USER_URL_POS
].
len
>
TSDB_USER_LEN
-
1
||
pParser
->
path
[
GC_USER_URL_POS
].
len
<=
0
)
{
if
(
pParser
->
path
[
GC_USER_URL_POS
].
len
>
=
TSDB_USER_LEN
||
pParser
->
path
[
GC_USER_URL_POS
].
len
<=
0
)
{
return
false
;
}
...
...
src/plugins/http/src/httpAuth.c
浏览文件 @
7f123214
...
...
@@ -101,7 +101,7 @@ bool httpParseTaosdAuthToken(HttpContext *pContext, char *token, int len) {
bool
httpGenTaosdAuthToken
(
HttpContext
*
pContext
,
char
*
token
,
int
maxLen
)
{
char
buffer
[
TSDB_USER_LEN
+
TSDB_PASSWORD_LEN
]
=
{
0
};
strncpy
(
buffer
,
pContext
->
user
,
TSDB_USER_LEN
);
strncpy
(
buffer
,
pContext
->
user
,
sizeof
(
pContext
->
user
)
);
strncpy
(
buffer
+
TSDB_USER_LEN
,
pContext
->
pass
,
TSDB_PASSWORD_LEN
);
char
*
encrypt
=
taosDesEncode
(
KEY_DES_4
,
buffer
,
TSDB_USER_LEN
+
TSDB_PASSWORD_LEN
);
...
...
src/plugins/http/src/restHandle.c
浏览文件 @
7f123214
...
...
@@ -61,7 +61,7 @@ void restInitHandle(HttpServer* pServer) {
bool
restGetUserFromUrl
(
HttpContext
*
pContext
)
{
HttpParser
*
pParser
=
&
pContext
->
parser
;
if
(
pParser
->
path
[
REST_USER_URL_POS
].
len
>
TSDB_USER_LEN
-
1
||
pParser
->
path
[
REST_USER_URL_POS
].
len
<=
0
)
{
if
(
pParser
->
path
[
REST_USER_URL_POS
].
len
>
=
TSDB_USER_LEN
||
pParser
->
path
[
REST_USER_URL_POS
].
len
<=
0
)
{
return
false
;
}
...
...
src/plugins/http/src/tgHandle.c
浏览文件 @
7f123214
...
...
@@ -306,11 +306,11 @@ void tgCleanupHandle() {
bool
tgGetUserFromUrl
(
HttpContext
*
pContext
)
{
HttpParser
*
pParser
=
&
pContext
->
parser
;
if
(
pParser
->
path
[
TG_USER_URL_POS
].
len
>
TSDB_USER_LEN
-
1
||
pParser
->
path
[
TG_USER_URL_POS
].
len
<=
0
)
{
if
(
pParser
->
path
[
TG_USER_URL_POS
].
len
>
=
TSDB_USER_LEN
||
pParser
->
path
[
TG_USER_URL_POS
].
len
<=
0
)
{
return
false
;
}
tstrncpy
(
pContext
->
user
,
pParser
->
path
[
TG_USER_URL_POS
].
pos
,
TSDB_USER_LEN
);
tstrncpy
(
pContext
->
user
,
pParser
->
path
[
TG_USER_URL_POS
].
pos
,
sizeof
(
pContext
->
user
)
);
return
true
;
}
...
...
src/plugins/monitor/src/monitorMain.c
浏览文件 @
7f123214
...
...
@@ -175,7 +175,7 @@ static void dnodeBuildMonitorSql(char *sql, int32_t cmd) {
", totalConns smallint, maxConns smallint"
", accessState smallint"
") tags (acctId binary(%d))"
,
tsMonitorDbName
,
TSDB_USER_LEN
+
1
);
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"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录