Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
cba224d4
T
TDengine
项目概览
哥们要飞
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cba224d4
编写于
1月 12, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2720]<fix>: change the password length by using another macro definition.
上级
74903336
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
35 addition
and
45 deletion
+35
-45
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-2
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+2
-2
src/client/src/tscSql.c
src/client/src/tscSql.c
+4
-4
src/cq/src/cqMain.c
src/cq/src/cqMain.c
+1
-1
src/inc/taosdef.h
src/inc/taosdef.h
+4
-14
src/inc/taosmsg.h
src/inc/taosmsg.h
+6
-6
src/inc/tcq.h
src/inc/tcq.h
+1
-1
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+2
-2
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+1
-1
src/plugins/http/inc/httpInt.h
src/plugins/http/inc/httpInt.h
+2
-2
src/plugins/http/src/httpAuth.c
src/plugins/http/src/httpAuth.c
+4
-4
src/plugins/http/src/httpGcHandle.c
src/plugins/http/src/httpGcHandle.c
+2
-2
src/plugins/http/src/httpRestHandle.c
src/plugins/http/src/httpRestHandle.c
+2
-2
src/plugins/http/src/httpTgHandle.c
src/plugins/http/src/httpTgHandle.c
+1
-1
src/vnode/inc/vnodeInt.h
src/vnode/inc/vnodeInt.h
+1
-1
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
cba224d4
...
...
@@ -300,8 +300,8 @@ typedef struct STscObj {
void
*
pTimer
;
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
];
char
acctId
[
TSDB_ACCT_LEN
];
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
acctId
[
TSDB_ACCT_
ID_
LEN
];
char
db
[
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
];
char
sversion
[
TSDB_VERSION_LEN
];
char
writeAuth
:
1
;
char
superAuth
:
1
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
cba224d4
...
...
@@ -221,7 +221,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
pPwd
->
n
>=
TSDB_
PASSWORD
_LEN
)
{
if
(
pPwd
->
n
>=
TSDB_
KEY
_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -1242,7 +1242,7 @@ int32_t setObjFullName(char* fullName, const char* account, SStrToken* pDB, SStr
/* db name is not specified, the tableName dose not include db name */
if
(
pDB
!=
NULL
)
{
if
(
pDB
->
n
>=
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
||
pDB
->
n
==
0
)
{
if
(
pDB
->
n
>=
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
||
pDB
->
n
==
0
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
...
...
src/client/src/tscSql.c
浏览文件 @
cba224d4
...
...
@@ -47,7 +47,7 @@ static bool validUserName(const char* user) {
}
static
bool
validPassword
(
const
char
*
passwd
)
{
return
validImpl
(
passwd
,
TSDB_
PASSWORD
_LEN
-
1
);
return
validImpl
(
passwd
,
TSDB_
KEY
_LEN
-
1
);
}
static
SSqlObj
*
taosConnectImpl
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
...
...
@@ -238,11 +238,11 @@ TAOS *taos_connect_c(const char *ip, uint8_t ipLen, const char *user, uint8_t us
uint8_t
passLen
,
const
char
*
db
,
uint8_t
dbLen
,
uint16_t
port
)
{
char
ipBuf
[
TSDB_EP_LEN
]
=
{
0
};
char
userBuf
[
TSDB_USER_LEN
]
=
{
0
};
char
passBuf
[
TSDB_
PASSWORD
_LEN
]
=
{
0
};
char
passBuf
[
TSDB_
KEY
_LEN
]
=
{
0
};
char
dbBuf
[
TSDB_DB_NAME_LEN
]
=
{
0
};
strncpy
(
ipBuf
,
ip
,
MIN
(
TSDB_EP_LEN
-
1
,
ipLen
));
strncpy
(
userBuf
,
user
,
MIN
(
TSDB_USER_LEN
-
1
,
userLen
));
strncpy
(
passBuf
,
pass
,
MIN
(
TSDB_
PASSWORD
_LEN
-
1
,
passLen
));
strncpy
(
passBuf
,
pass
,
MIN
(
TSDB_
KEY
_LEN
-
1
,
passLen
));
strncpy
(
dbBuf
,
db
,
MIN
(
TSDB_DB_NAME_LEN
-
1
,
dbLen
));
return
taos_connect
(
ipBuf
,
userBuf
,
passBuf
,
dbBuf
,
port
);
}
...
...
@@ -978,7 +978,7 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t
return
code
;
}
if
(
++
pCmd
->
count
>
TSDB_MULTI_
METER
META_MAX_NUM
)
{
if
(
++
pCmd
->
count
>
TSDB_MULTI_
TABLE
META_MAX_NUM
)
{
code
=
TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH
;
sprintf
(
pCmd
->
payload
,
"tables over the max number"
);
return
code
;
...
...
src/cq/src/cqMain.c
浏览文件 @
cba224d4
...
...
@@ -43,7 +43,7 @@ typedef struct {
int32_t
master
;
int32_t
num
;
// number of continuous streams
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
PASSWORD
_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
FCqWrite
cqWrite
;
struct
SCqObj
*
pHead
;
...
...
src/inc/taosdef.h
浏览文件 @
cba224d4
...
...
@@ -256,10 +256,8 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_USER_LEN TSDB_UNI_LEN
// ACCOUNT is a 32 bit positive integer
// this is the length of its string representation
// including the terminator zero
#define TSDB_ACCT_LEN 11
#define TSDB_PASSWORD_LEN TSDB_UNI_LEN
// this is the length of its string representation, including the terminator zero
#define TSDB_ACCT_ID_LEN 11
#define TSDB_MAX_COLUMNS 1024
#define TSDB_MIN_COLUMNS 2 //PRIMARY COLUMN(timestamp) + other columns
...
...
@@ -267,7 +265,7 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_NODE_NAME_LEN 64
#define TSDB_TABLE_NAME_LEN 193 // it is a null-terminated string
#define TSDB_DB_NAME_LEN 33
#define TSDB_TABLE_FNAME_LEN (TSDB_ACCT_LEN + TSDB_DB_NAME_LEN + TSDB_TABLE_NAME_LEN)
#define TSDB_TABLE_FNAME_LEN (TSDB_ACCT_
ID_
LEN + TSDB_DB_NAME_LEN + TSDB_TABLE_NAME_LEN)
#define TSDB_COL_NAME_LEN 65
#define TSDB_MAX_SAVED_SQL_LEN TSDB_MAX_COLUMNS * 64
#define TSDB_MAX_SQL_LEN TSDB_PAYLOAD_SIZE
...
...
@@ -293,11 +291,6 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_EP_LEN (TSDB_FQDN_LEN+6)
#define TSDB_IPv4ADDR_LEN 16
#define TSDB_FILENAME_LEN 128
#define TSDB_METER_VNODE_BITS 20
#define TSDB_METER_SID_MASK 0xFFFFF
#define TSDB_SHELL_VNODE_BITS 24
#define TSDB_SHELL_SID_MASK 0xFF
#define TSDB_HTTP_TOKEN_LEN 20
#define TSDB_SHOW_SQL_LEN 512
#define TSDB_SLOW_QUERY_SQL_LEN 512
...
...
@@ -311,9 +304,6 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_MQTT_TOPIC_LEN 64
#define TSDB_MQTT_CLIENT_ID_LEN 32
#define TSDB_METER_STATE_OFFLINE 0
#define TSDB_METER_STATE_ONLLINE 1
#define TSDB_DEFAULT_PKT_SIZE 65480 //same as RPC_MAX_UDP_SIZE
#define TSDB_PAYLOAD_SIZE TSDB_DEFAULT_PKT_SIZE
...
...
@@ -333,7 +323,7 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_TBNAME_COLUMN_INDEX (-1)
#define TSDB_UD_COLUMN_INDEX (-100)
#define TSDB_MULTI_
METERMETA_MAX_NUM 100000 // maximum batch size allowed to load meter
meta
#define TSDB_MULTI_
TABLEMETA_MAX_NUM 100000 // maximum batch size allowed to load table
meta
#define TSDB_MIN_CACHE_BLOCK_SIZE 1
#define TSDB_MAX_CACHE_BLOCK_SIZE 128 // 128MB for each vnode
...
...
src/inc/taosmsg.h
浏览文件 @
cba224d4
...
...
@@ -268,7 +268,7 @@ typedef struct {
typedef
struct
{
int32_t
len
;
// one create table message
char
tableId
[
TSDB_TABLE_FNAME_LEN
];
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
];
int8_t
igExists
;
int8_t
getMeta
;
int16_t
numOfTags
;
...
...
@@ -290,7 +290,7 @@ typedef struct {
typedef
struct
{
char
tableId
[
TSDB_TABLE_FNAME_LEN
];
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
];
int16_t
type
;
/* operation type */
int16_t
numOfCols
;
/* number of schema */
int32_t
tagValLen
;
...
...
@@ -322,7 +322,7 @@ typedef struct {
}
SConnectMsg
;
typedef
struct
{
char
acctId
[
TSDB_ACCT_LEN
];
char
acctId
[
TSDB_ACCT_
ID_
LEN
];
char
serverVersion
[
TSDB_VERSION_LEN
];
char
clusterId
[
TSDB_CLUSTER_ID_LEN
];
int8_t
writeAuth
;
...
...
@@ -534,7 +534,7 @@ typedef struct {
}
SVnodeLoad
;
typedef
struct
{
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
];
int32_t
cacheBlockSize
;
//MB
int32_t
totalBlocks
;
int32_t
maxTables
;
...
...
@@ -682,7 +682,7 @@ typedef struct {
}
SVnodeDesc
;
typedef
struct
{
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
];
SVnodeCfg
cfg
;
SVnodeDesc
nodes
[
TSDB_MAX_REPLICA
];
}
SCreateVnodeMsg
,
SAlterVnodeMsg
;
...
...
@@ -761,7 +761,7 @@ typedef struct {
*/
typedef
struct
{
int8_t
type
;
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
];
uint16_t
payloadLen
;
char
payload
[];
}
SShowMsg
;
...
...
src/inc/tcq.h
浏览文件 @
cba224d4
...
...
@@ -26,7 +26,7 @@ typedef int32_t (*FCqWrite)(int32_t vgId, void *pHead, int32_t qtype, void *pMsg
typedef
struct
{
int32_t
vgId
;
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
PASSWORD
_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
FCqWrite
cqWrite
;
}
SCqCfg
;
...
...
src/mnode/inc/mnodeDef.h
浏览文件 @
cba224d4
...
...
@@ -138,7 +138,7 @@ typedef struct SVgObj {
int64_t
createdTime
;
int32_t
lbDnodeId
;
int32_t
lbTime
;
char
dbName
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
dbName
[
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
];
int8_t
inUse
;
int8_t
accessState
;
int8_t
status
;
...
...
@@ -179,7 +179,7 @@ typedef struct {
}
SDbCfg
;
typedef
struct
SDbObj
{
char
name
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
name
[
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
];
int8_t
reserved0
[
4
];
char
acct
[
TSDB_USER_LEN
];
int64_t
createdTime
;
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
cba224d4
...
...
@@ -565,7 +565,7 @@ int32_t mnodeCreateVgroup(SMnodeMsg *pMsg) {
SDbObj
*
pDb
=
pMsg
->
pDb
;
SVgObj
*
pVgroup
=
(
SVgObj
*
)
calloc
(
1
,
sizeof
(
SVgObj
));
tstrncpy
(
pVgroup
->
dbName
,
pDb
->
name
,
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
);
tstrncpy
(
pVgroup
->
dbName
,
pDb
->
name
,
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
);
pVgroup
->
numOfVnodes
=
pDb
->
cfg
.
replications
;
pVgroup
->
createdTime
=
taosGetTimestampMs
();
pVgroup
->
accessState
=
TSDB_VN_ALL_ACCCESS
;
...
...
src/plugins/http/inc/httpInt.h
浏览文件 @
cba224d4
...
...
@@ -39,7 +39,7 @@
#define HTTP_GC_TARGET_SIZE 512
#define HTTP_WRITE_RETRY_TIMES 500
#define HTTP_WRITE_WAIT_TIME_MS 5
#define HTTP_SESSION_ID_LEN (TSDB_USER_LEN + TSDB_
PASSWORD
_LEN)
#define HTTP_SESSION_ID_LEN (TSDB_USER_LEN + TSDB_
KEY
_LEN)
typedef
enum
HttpReqType
{
HTTP_REQTYPE_OTHERS
=
0
,
...
...
@@ -147,7 +147,7 @@ typedef struct HttpContext {
uint8_t
parsed
;
char
ipstr
[
22
];
char
user
[
TSDB_USER_LEN
];
// parsed from auth token or login message
char
pass
[
TSDB_
PASSWORD
_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
TAOS
*
taos
;
void
*
ppContext
;
HttpSession
*
session
;
...
...
src/plugins/http/src/httpAuth.c
浏览文件 @
cba224d4
...
...
@@ -51,7 +51,7 @@ int32_t httpParseBasicAuthToken(HttpContext *pContext, char *token, int32_t len)
char
*
password
=
user
+
1
;
int32_t
pass_len
=
(
int32_t
)((
base64
+
outlen
)
-
password
);
if
(
pass_len
<
1
||
pass_len
>=
TSDB_
PASSWORD
_LEN
)
{
if
(
pass_len
<
1
||
pass_len
>=
TSDB_
KEY
_LEN
)
{
httpError
(
"context:%p, fd:%d, basic token:%s parse password error"
,
pContext
,
pContext
->
fd
,
token
);
free
(
base64
);
return
-
1
;
...
...
@@ -73,7 +73,7 @@ int32_t httpParseTaosdAuthToken(HttpContext *pContext, char *token, int32_t len)
if
(
base64
)
free
(
base64
);
return
01
;
}
if
(
outlen
!=
(
TSDB_USER_LEN
+
TSDB_
PASSWORD
_LEN
))
{
if
(
outlen
!=
(
TSDB_USER_LEN
+
TSDB_
KEY
_LEN
))
{
httpError
(
"context:%p, fd:%d, taosd token:%s length error"
,
pContext
,
pContext
->
fd
,
token
);
free
(
base64
);
return
-
1
;
...
...
@@ -103,8 +103,8 @@ int32_t httpGenTaosdAuthToken(HttpContext *pContext, char *token, int32_t maxLen
size
=
sizeof
(
pContext
->
pass
);
tstrncpy
(
buffer
+
sizeof
(
pContext
->
user
),
pContext
->
pass
,
size
);
char
*
encrypt
=
taosDesEncode
(
KEY_DES_4
,
buffer
,
TSDB_USER_LEN
+
TSDB_
PASSWORD
_LEN
);
char
*
base64
=
base64_encode
((
const
unsigned
char
*
)
encrypt
,
TSDB_USER_LEN
+
TSDB_
PASSWORD
_LEN
);
char
*
encrypt
=
taosDesEncode
(
KEY_DES_4
,
buffer
,
TSDB_USER_LEN
+
TSDB_
KEY
_LEN
);
char
*
base64
=
base64_encode
((
const
unsigned
char
*
)
encrypt
,
TSDB_USER_LEN
+
TSDB_
KEY
_LEN
);
size_t
len
=
strlen
(
base64
);
tstrncpy
(
token
,
base64
,
len
+
1
);
...
...
src/plugins/http/src/httpGcHandle.c
浏览文件 @
cba224d4
...
...
@@ -59,11 +59,11 @@ bool gcGetUserFromUrl(HttpContext* pContext) {
bool
gcGetPassFromUrl
(
HttpContext
*
pContext
)
{
HttpParser
*
pParser
=
pContext
->
parser
;
if
(
pParser
->
path
[
GC_PASS_URL_POS
].
pos
>=
TSDB_
PASSWORD
_LEN
||
pParser
->
path
[
GC_PASS_URL_POS
].
pos
<=
0
)
{
if
(
pParser
->
path
[
GC_PASS_URL_POS
].
pos
>=
TSDB_
KEY
_LEN
||
pParser
->
path
[
GC_PASS_URL_POS
].
pos
<=
0
)
{
return
false
;
}
tstrncpy
(
pContext
->
pass
,
pParser
->
path
[
GC_PASS_URL_POS
].
str
,
TSDB_
PASSWORD
_LEN
);
tstrncpy
(
pContext
->
pass
,
pParser
->
path
[
GC_PASS_URL_POS
].
str
,
TSDB_
KEY
_LEN
);
return
true
;
}
...
...
src/plugins/http/src/httpRestHandle.c
浏览文件 @
cba224d4
...
...
@@ -72,11 +72,11 @@ bool restGetUserFromUrl(HttpContext* pContext) {
bool
restGetPassFromUrl
(
HttpContext
*
pContext
)
{
HttpParser
*
pParser
=
pContext
->
parser
;
if
(
pParser
->
path
[
REST_PASS_URL_POS
].
pos
>=
TSDB_
PASSWORD
_LEN
||
pParser
->
path
[
REST_PASS_URL_POS
].
pos
<=
0
)
{
if
(
pParser
->
path
[
REST_PASS_URL_POS
].
pos
>=
TSDB_
KEY
_LEN
||
pParser
->
path
[
REST_PASS_URL_POS
].
pos
<=
0
)
{
return
false
;
}
tstrncpy
(
pContext
->
pass
,
pParser
->
path
[
REST_PASS_URL_POS
].
str
,
TSDB_
PASSWORD
_LEN
);
tstrncpy
(
pContext
->
pass
,
pParser
->
path
[
REST_PASS_URL_POS
].
str
,
TSDB_
KEY
_LEN
);
return
true
;
}
...
...
src/plugins/http/src/httpTgHandle.c
浏览文件 @
cba224d4
...
...
@@ -324,7 +324,7 @@ bool tgGetUserFromUrl(HttpContext *pContext) {
bool
tgGetPassFromUrl
(
HttpContext
*
pContext
)
{
HttpParser
*
pParser
=
pContext
->
parser
;
if
(
pParser
->
path
[
TG_PASS_URL_POS
].
pos
>=
TSDB_
PASSWORD
_LEN
||
pParser
->
path
[
TG_PASS_URL_POS
].
pos
<=
0
)
{
if
(
pParser
->
path
[
TG_PASS_URL_POS
].
pos
>=
TSDB_
KEY
_LEN
||
pParser
->
path
[
TG_PASS_URL_POS
].
pos
<=
0
)
{
return
false
;
}
...
...
src/vnode/inc/vnodeInt.h
浏览文件 @
cba224d4
...
...
@@ -67,7 +67,7 @@ typedef struct {
void
*
qMgmt
;
char
*
rootDir
;
tsem_t
sem
;
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_ACCT_
ID_
LEN
+
TSDB_DB_NAME_LEN
];
pthread_mutex_t
statusMutex
;
}
SVnodeObj
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录