Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8c416a5e
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看板
提交
8c416a5e
编写于
12月 10, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-10564] refactor and add test cases.
上级
bf97ce3d
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
95 addition
and
78 deletion
+95
-78
include/common/taosmsg.h
include/common/taosmsg.h
+4
-4
include/util/tdef.h
include/util/tdef.h
+1
-1
include/util/tutil.h
include/util/tutil.h
+13
-1
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+2
-2
source/client/src/client.c
source/client/src/client.c
+2
-2
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+4
-4
source/client/src/clientmain.c
source/client/src/clientmain.c
+4
-0
source/client/src/tscEnv.c
source/client/src/tscEnv.c
+38
-38
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+1
-0
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+6
-6
source/dnode/mgmt/impl/test/sut/deploy.cpp
source/dnode/mgmt/impl/test/sut/deploy.cpp
+1
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-1
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+3
-3
source/libs/sync/src/sync.c
source/libs/sync/src/sync.c
+1
-1
source/libs/transport/src/rpcMain.c
source/libs/transport/src/rpcMain.c
+9
-9
source/os/src/osString.c
source/os/src/osString.c
+3
-3
src/inc/tcq.h
src/inc/tcq.h
+2
-2
未找到文件。
include/common/taosmsg.h
浏览文件 @
8c416a5e
...
...
@@ -379,7 +379,7 @@ typedef struct {
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
pass
[
TSDB_
PASSWORD
_LEN
];
int32_t
maxUsers
;
int32_t
maxDbs
;
int32_t
maxTimeSeries
;
...
...
@@ -394,7 +394,7 @@ typedef struct {
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
pass
[
TSDB_
PASSWORD
_LEN
];
}
SCreateUserMsg
,
SAlterUserMsg
;
typedef
struct
{
...
...
@@ -912,8 +912,8 @@ typedef struct {
char
user
[
TSDB_USER_LEN
];
char
spi
;
char
encrypt
;
char
secret
[
TSDB_
KEY
_LEN
];
char
ckey
[
TSDB_
KEY
_LEN
];
char
secret
[
TSDB_
PASSWORD
_LEN
];
char
ckey
[
TSDB_
PASSWORD
_LEN
];
}
SAuthMsg
,
SAuthRsp
;
typedef
struct
{
...
...
include/util/tdef.h
浏览文件 @
8c416a5e
...
...
@@ -188,7 +188,7 @@ do { \
#define TSDB_MAX_TAG_CONDITIONS 1024
#define TSDB_AUTH_LEN 16
#define TSDB_
KEY_LEN
64
#define TSDB_
PASSWORD_LEN
64
#define TSDB_VERSION_LEN 12
#define TSDB_LABEL_LEN 8
...
...
include/util/tutil.h
浏览文件 @
8c416a5e
...
...
@@ -51,7 +51,19 @@ static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, size_t inLen, char *tar
MD5Init
(
&
context
);
MD5Update
(
&
context
,
inBuf
,
(
unsigned
int
)
inLen
);
MD5Final
(
&
context
);
memcpy
(
target
,
context
.
digest
,
TSDB_KEY_LEN
);
memcpy
(
target
,
context
.
digest
,
tListLen
(
context
.
digest
));
}
static
FORCE_INLINE
void
taosEncryptPass_c
(
uint8_t
*
inBuf
,
size_t
len
,
char
*
target
)
{
MD5_CTX
context
;
MD5Init
(
&
context
);
MD5Update
(
&
context
,
inBuf
,
(
unsigned
int
)
len
);
MD5Final
(
&
context
);
sprintf
(
target
,
"%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x"
,
context
.
digest
[
0
],
context
.
digest
[
1
],
context
.
digest
[
2
],
context
.
digest
[
3
],
context
.
digest
[
4
],
context
.
digest
[
5
],
context
.
digest
[
6
],
context
.
digest
[
7
],
context
.
digest
[
8
],
context
.
digest
[
9
],
context
.
digest
[
10
],
context
.
digest
[
11
],
context
.
digest
[
12
],
context
.
digest
[
13
],
context
.
digest
[
14
],
context
.
digest
[
15
]);
}
#ifdef __cplusplus
...
...
source/client/inc/clientInt.h
浏览文件 @
8c416a5e
...
...
@@ -71,7 +71,7 @@ typedef struct SAppInfo {
typedef
struct
STscObj
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
pass
[
TSDB_
PASSWORD
_LEN
];
char
acctId
[
TSDB_ACCT_ID_LEN
];
char
db
[
TSDB_ACCT_ID_LEN
+
TSDB_DB_NAME_LEN
];
uint32_t
connId
;
...
...
@@ -117,7 +117,7 @@ void destroyRequest(void* p);
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
void
taos_init_imp
(
void
);
int
taos_options_imp
(
TSDB_OPTION
option
,
const
char
*
pS
tr
);
int
taos_options_imp
(
TSDB_OPTION
option
,
const
char
*
s
tr
);
#ifdef __cplusplus
}
...
...
source/client/src/client.c
浏览文件 @
8c416a5e
...
...
@@ -53,11 +53,11 @@ TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, c
char
ipStr
[
TSDB_EP_LEN
]
=
{
0
};
char
dbStr
[
TSDB_DB_NAME_LEN
]
=
{
0
};
char
userStr
[
TSDB_USER_LEN
]
=
{
0
};
char
passStr
[
TSDB_
KEY
_LEN
]
=
{
0
};
char
passStr
[
TSDB_
PASSWORD
_LEN
]
=
{
0
};
strncpy
(
ipStr
,
ip
,
MIN
(
TSDB_EP_LEN
-
1
,
ipLen
));
strncpy
(
userStr
,
user
,
MIN
(
TSDB_USER_LEN
-
1
,
userLen
));
strncpy
(
passStr
,
pass
,
MIN
(
TSDB_
KEY
_LEN
-
1
,
passLen
));
strncpy
(
passStr
,
pass
,
MIN
(
TSDB_
PASSWORD
_LEN
-
1
,
passLen
));
strncpy
(
dbStr
,
db
,
MIN
(
TSDB_DB_NAME_LEN
-
1
,
dbLen
));
return
taos_connect
(
ipStr
,
userStr
,
passStr
,
dbStr
,
port
);
}
...
...
source/client/src/clientImpl.c
浏览文件 @
8c416a5e
...
...
@@ -26,7 +26,7 @@ static bool validateUserName(const char* user) {
}
static
bool
validatePassword
(
const
char
*
passwd
)
{
return
stringLengthCheck
(
passwd
,
TSDB_
KEY
_LEN
-
1
);
return
stringLengthCheck
(
passwd
,
TSDB_
PASSWORD
_LEN
-
1
);
}
static
bool
validateDbName
(
const
char
*
db
)
{
...
...
@@ -52,14 +52,14 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
strdequote
(
tmp
);
}
char
secretEncrypt
[
32
]
=
{
0
};
char
secretEncrypt
[
64
]
=
{
0
};
if
(
auth
==
NULL
)
{
if
(
!
validatePassword
(
pass
))
{
terrno
=
TSDB_CODE_TSC_INVALID_PASS_LENGTH
;
return
NULL
;
}
taosEncryptPass
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
taosEncryptPass
_c
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
}
else
{
tstrncpy
(
secretEncrypt
,
auth
,
tListLen
(
secretEncrypt
));
}
...
...
@@ -79,7 +79,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
}
}
return
taosConnectImpl
(
ip
,
user
,
auth
,
db
,
port
,
NULL
,
NULL
);
return
taosConnectImpl
(
ip
,
user
,
&
secretEncrypt
[
0
]
,
db
,
port
,
NULL
,
NULL
);
}
int
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SRpcCorEpSet
*
pEpSet
)
{
...
...
source/client/src/clientmain.c
浏览文件 @
8c416a5e
...
...
@@ -74,6 +74,10 @@ void taos_cleanup(void) {
}
void
taos_close
(
TAOS
*
taos
)
{
if
(
taos
==
NULL
)
{
return
;
}
}
...
...
source/client/src/tscEnv.c
浏览文件 @
8c416a5e
...
...
@@ -70,6 +70,22 @@ static void deregisterRequest(SRequestObj* pRequest) {
taosReleaseRef
(
tscConnRef
,
pTscObj
->
id
);
}
static
void
tscInitLogFile
()
{
taosReadGlobalLogCfg
();
if
(
mkdir
(
tsLogDir
,
0755
)
!=
0
&&
errno
!=
EEXIST
)
{
printf
(
"failed to create log dir:%s
\n
"
,
tsLogDir
);
}
const
char
*
defaultLogFileNamePrefix
=
"taoslog"
;
const
int32_t
maxLogFileNum
=
10
;
char
temp
[
128
]
=
{
0
};
sprintf
(
temp
,
"%s/%s"
,
tsLogDir
,
defaultLogFileNamePrefix
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
void
tscFreeRpcObj
(
void
*
param
)
{
#if 0
assert(param);
...
...
@@ -200,22 +216,6 @@ void destroyRequest(void* p) {
deregisterRequest
(
pRequest
);
}
static
void
tscInitLogFile
()
{
taosReadGlobalLogCfg
();
if
(
mkdir
(
tsLogDir
,
0755
)
!=
0
&&
errno
!=
EEXIST
)
{
printf
(
"failed to create log dir:%s
\n
"
,
tsLogDir
);
}
const
char
*
defaultLogFileNamePrefix
=
"taoslog"
;
const
int32_t
maxLogFileNum
=
10
;
char
temp
[
128
]
=
{
0
};
sprintf
(
temp
,
"%s/%s"
,
tsLogDir
,
defaultLogFileNamePrefix
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
void
taos_init_imp
(
void
)
{
// In the APIs of other program language, taos_cleanup is not available yet.
// So, to make sure taos_cleanup will be invoked to clean up the allocated resource to suppress the valgrind warning.
...
...
@@ -268,7 +268,7 @@ void taos_init_imp(void) {
tscDebug
(
"client is initialized successfully"
);
}
int
taos_options_imp
(
TSDB_OPTION
option
,
const
char
*
pS
tr
)
{
int
taos_options_imp
(
TSDB_OPTION
option
,
const
char
*
s
tr
)
{
SGlobalCfg
*
cfg
=
NULL
;
switch
(
option
)
{
...
...
@@ -277,11 +277,11 @@ int taos_options_imp(TSDB_OPTION option, const char *pStr) {
assert
(
cfg
!=
NULL
);
if
(
cfg
->
cfgStatus
<=
TAOS_CFG_CSTATUS_OPTION
)
{
tstrncpy
(
configDir
,
pS
tr
,
TSDB_FILENAME_LEN
);
tstrncpy
(
configDir
,
s
tr
,
TSDB_FILENAME_LEN
);
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_OPTION
;
tscInfo
(
"set config file directory:%s"
,
pS
tr
);
tscInfo
(
"set config file directory:%s"
,
s
tr
);
}
else
{
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %s"
,
cfg
->
option
,
pS
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
(
char
*
)
cfg
->
ptr
);
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %s"
,
cfg
->
option
,
s
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
(
char
*
)
cfg
->
ptr
);
}
break
;
...
...
@@ -290,13 +290,13 @@ int taos_options_imp(TSDB_OPTION option, const char *pStr) {
assert
(
cfg
!=
NULL
);
if
(
cfg
->
cfgStatus
<=
TAOS_CFG_CSTATUS_OPTION
)
{
tsShellActivityTimer
=
atoi
(
pS
tr
);
tsShellActivityTimer
=
atoi
(
s
tr
);
if
(
tsShellActivityTimer
<
1
)
tsShellActivityTimer
=
1
;
if
(
tsShellActivityTimer
>
3600
)
tsShellActivityTimer
=
3600
;
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_OPTION
;
tscInfo
(
"set shellActivityTimer:%d"
,
tsShellActivityTimer
);
}
else
{
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %d"
,
cfg
->
option
,
pS
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
*
(
int32_t
*
)
cfg
->
ptr
);
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %d"
,
cfg
->
option
,
s
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
*
(
int32_t
*
)
cfg
->
ptr
);
}
break
;
...
...
@@ -304,9 +304,9 @@ int taos_options_imp(TSDB_OPTION option, const char *pStr) {
cfg
=
taosGetConfigOption
(
"locale"
);
assert
(
cfg
!=
NULL
);
size_t
len
=
strlen
(
pS
tr
);
size_t
len
=
strlen
(
s
tr
);
if
(
len
==
0
||
len
>
TSDB_LOCALE_LEN
)
{
tscInfo
(
"Invalid locale:%s, use default"
,
pS
tr
);
tscInfo
(
"Invalid locale:%s, use default"
,
s
tr
);
return
-
1
;
}
...
...
@@ -327,14 +327,14 @@ int taos_options_imp(TSDB_OPTION option, const char *pStr) {
}
// set the user specified locale
char
*
locale
=
setlocale
(
LC_CTYPE
,
pS
tr
);
char
*
locale
=
setlocale
(
LC_CTYPE
,
s
tr
);
if
(
locale
!=
NULL
)
{
// failed to set the user specified locale
tscInfo
(
"locale set, prev locale:%s, new locale:%s"
,
tsLocale
,
locale
);
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_OPTION
;
}
else
{
// set the user specified locale failed, use default LC_CTYPE as current locale
locale
=
setlocale
(
LC_CTYPE
,
tsLocale
);
tscInfo
(
"failed to set locale:%s, current locale:%s"
,
pS
tr
,
tsLocale
);
tscInfo
(
"failed to set locale:%s, current locale:%s"
,
s
tr
,
tsLocale
);
}
tstrncpy
(
tsLocale
,
locale
,
TSDB_LOCALE_LEN
);
...
...
@@ -364,7 +364,7 @@ int taos_options_imp(TSDB_OPTION option, const char *pStr) {
tscInfo
(
"charset remains:%s"
,
tsCharset
);
}
}
else
{
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %s"
,
cfg
->
option
,
pS
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
(
char
*
)
cfg
->
ptr
);
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %s"
,
cfg
->
option
,
s
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
(
char
*
)
cfg
->
ptr
);
}
break
;
}
...
...
@@ -374,27 +374,27 @@ int taos_options_imp(TSDB_OPTION option, const char *pStr) {
cfg
=
taosGetConfigOption
(
"charset"
);
assert
(
cfg
!=
NULL
);
size_t
len
=
strlen
(
pS
tr
);
size_t
len
=
strlen
(
s
tr
);
if
(
len
==
0
||
len
>
TSDB_LOCALE_LEN
)
{
tscInfo
(
"failed to set charset:%s"
,
pS
tr
);
tscInfo
(
"failed to set charset:%s"
,
s
tr
);
return
-
1
;
}
if
(
cfg
->
cfgStatus
<=
TAOS_CFG_CSTATUS_OPTION
)
{
if
(
taosValidateEncodec
(
pS
tr
))
{
if
(
taosValidateEncodec
(
s
tr
))
{
if
(
strlen
(
tsCharset
)
==
0
)
{
tscInfo
(
"charset is set:%s"
,
pS
tr
);
tscInfo
(
"charset is set:%s"
,
s
tr
);
}
else
{
tscInfo
(
"charset changed from %s to %s"
,
tsCharset
,
pS
tr
);
tscInfo
(
"charset changed from %s to %s"
,
tsCharset
,
s
tr
);
}
tstrncpy
(
tsCharset
,
pS
tr
,
TSDB_LOCALE_LEN
);
tstrncpy
(
tsCharset
,
s
tr
,
TSDB_LOCALE_LEN
);
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_OPTION
;
}
else
{
tscInfo
(
"charset:%s not valid"
,
pS
tr
);
tscInfo
(
"charset:%s not valid"
,
s
tr
);
}
}
else
{
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %s"
,
cfg
->
option
,
pS
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
(
char
*
)
cfg
->
ptr
);
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %s"
,
cfg
->
option
,
s
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
(
char
*
)
cfg
->
ptr
);
}
break
;
...
...
@@ -405,12 +405,12 @@ int taos_options_imp(TSDB_OPTION option, const char *pStr) {
assert
(
cfg
!=
NULL
);
if
(
cfg
->
cfgStatus
<=
TAOS_CFG_CSTATUS_OPTION
)
{
tstrncpy
(
tsTimezone
,
pS
tr
,
TSDB_TIMEZONE_LEN
);
tstrncpy
(
tsTimezone
,
s
tr
,
TSDB_TIMEZONE_LEN
);
tsSetTimeZone
();
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_OPTION
;
tscDebug
(
"timezone set:%s, input:%s by taos_options"
,
tsTimezone
,
pS
tr
);
tscDebug
(
"timezone set:%s, input:%s by taos_options"
,
tsTimezone
,
s
tr
);
}
else
{
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %s"
,
cfg
->
option
,
pS
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
(
char
*
)
cfg
->
ptr
);
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %s"
,
cfg
->
option
,
s
tr
,
tsCfgStatusStr
[
cfg
->
cfgStatus
],
(
char
*
)
cfg
->
ptr
);
}
break
;
...
...
source/client/test/clientTests.cpp
浏览文件 @
8c416a5e
...
...
@@ -34,4 +34,5 @@ int main(int argc, char** argv) {
TEST
(
testCase
,
driverInit_Test
)
{
taos_init
();
TAOS
*
pTaos
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
}
\ No newline at end of file
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
8c416a5e
...
...
@@ -240,18 +240,18 @@ static void dndSendMsgToMnodeRecv(SDnode *pDnode, SRpcMsg *pRpcMsg, SRpcMsg *pRp
static
int32_t
dndAuthInternalMsg
(
SDnode
*
pDnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
if
(
strcmp
(
user
,
INTERNAL_USER
)
==
0
)
{
// A simple temporary implementation
char
pass
[
32
]
=
{
0
};
char
pass
[
TSDB_PASSWORD_LEN
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)(
INTERNAL_SECRET
),
strlen
(
INTERNAL_SECRET
),
pass
);
memcpy
(
secret
,
pass
,
TSDB_
KEY
_LEN
);
memcpy
(
secret
,
pass
,
TSDB_
PASSWORD
_LEN
);
*
spi
=
0
;
*
encrypt
=
0
;
*
ckey
=
0
;
return
0
;
}
else
if
(
strcmp
(
user
,
TSDB_NETTEST_USER
)
==
0
)
{
// A simple temporary implementation
char
pass
[
32
]
=
{
0
};
char
pass
[
TSDB_PASSWORD_LEN
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)(
TSDB_NETTEST_USER
),
strlen
(
TSDB_NETTEST_USER
),
pass
);
memcpy
(
secret
,
pass
,
TSDB_
KEY
_LEN
);
memcpy
(
secret
,
pass
,
TSDB_
PASSWORD
_LEN
);
*
spi
=
0
;
*
encrypt
=
0
;
*
ckey
=
0
;
...
...
@@ -293,8 +293,8 @@ static int32_t dndRetrieveUserAuthInfo(void *parent, char *user, char *spi, char
dError
(
"user:%s, failed to get user auth from other mnodes since %s"
,
user
,
terrstr
());
}
else
{
SAuthRsp
*
pRsp
=
rpcRsp
.
pCont
;
memcpy
(
secret
,
pRsp
->
secret
,
TSDB_
KEY
_LEN
);
memcpy
(
ckey
,
pRsp
->
ckey
,
TSDB_
KEY
_LEN
);
memcpy
(
secret
,
pRsp
->
secret
,
TSDB_
PASSWORD
_LEN
);
memcpy
(
ckey
,
pRsp
->
ckey
,
TSDB_
PASSWORD
_LEN
);
*
spi
=
pRsp
->
spi
;
*
encrypt
=
pRsp
->
encrypt
;
dDebug
(
"user:%s, success to get user auth from other mnodes"
,
user
);
...
...
source/dnode/mgmt/impl/test/sut/deploy.cpp
浏览文件 @
8c416a5e
...
...
@@ -107,7 +107,7 @@ SClient* createClient(const char* user, const char* pass, const char* fqdn, uint
SClient
*
pClient
=
(
SClient
*
)
calloc
(
1
,
sizeof
(
SClient
));
ASSERT
(
pClient
);
char
secretEncrypt
[
32
]
=
{
0
};
char
secretEncrypt
[
TSDB_PASSWORD_LEN
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)
pass
,
strlen
(
pass
),
secretEncrypt
);
SRpcInit
rpcInit
;
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
8c416a5e
...
...
@@ -181,7 +181,7 @@ typedef struct SAcctObj {
typedef
struct
SUserObj
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
pass
[
TSDB_
PASSWORD
_LEN
];
char
acct
[
TSDB_USER_LEN
];
int64_t
createdTime
;
int64_t
updateTime
;
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
8c416a5e
...
...
@@ -92,7 +92,7 @@ static SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
int32_t
dataPos
=
0
;
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
user
,
TSDB_USER_LEN
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
pass
,
TSDB_
KEY
_LEN
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
pass
,
TSDB_
PASSWORD
_LEN
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pUser
->
acct
,
TSDB_USER_LEN
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
createdTime
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
updateTime
)
...
...
@@ -120,7 +120,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
int32_t
dataPos
=
0
;
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pUser
->
user
,
TSDB_USER_LEN
)
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pUser
->
pass
,
TSDB_
KEY
_LEN
)
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pUser
->
pass
,
TSDB_
PASSWORD
_LEN
)
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pUser
->
acct
,
TSDB_USER_LEN
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
createdTime
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
updateTime
)
...
...
@@ -165,7 +165,7 @@ static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) {
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
pSrcUser
,
SUserObj
*
pDstUser
)
{
mTrace
(
"user:%s, perform update action"
,
pSrcUser
->
user
);
memcpy
(
pSrcUser
->
user
,
pDstUser
->
user
,
TSDB_USER_LEN
);
memcpy
(
pSrcUser
->
pass
,
pDstUser
->
pass
,
TSDB_
KEY
_LEN
);
memcpy
(
pSrcUser
->
pass
,
pDstUser
->
pass
,
TSDB_
PASSWORD
_LEN
);
memcpy
(
pSrcUser
->
acct
,
pDstUser
->
acct
,
TSDB_USER_LEN
);
pSrcUser
->
createdTime
=
pDstUser
->
createdTime
;
pSrcUser
->
updateTime
=
pDstUser
->
updateTime
;
...
...
source/libs/sync/src/sync.c
浏览文件 @
8c416a5e
...
...
@@ -228,7 +228,7 @@ static int syncInitRpcServer(SSyncManager* syncManager, const SSyncCluster* pSyn
}
static
int
syncInitRpcClient
(
SSyncManager
*
syncManager
)
{
char
secret
[
TSDB_
KEY
_LEN
]
=
"secret"
;
char
secret
[
TSDB_
PASSWORD
_LEN
]
=
"secret"
;
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
label
=
"sync-client"
;
...
...
source/libs/transport/src/rpcMain.c
浏览文件 @
8c416a5e
...
...
@@ -51,8 +51,8 @@ typedef struct {
char
user
[
TSDB_UNI_LEN
];
// meter ID
char
spi
;
// security parameter index
char
encrypt
;
// encrypt algorithm
char
secret
[
TSDB_
KEY
_LEN
];
// secret for the link
char
ckey
[
TSDB_
KEY_LEN
];
// ciphering key
char
secret
[
TSDB_
PASSWORD
_LEN
];
// secret for the link
char
ckey
[
TSDB_
PASSWORD_LEN
];
// ciphering key
void
(
*
cfp
)(
void
*
parent
,
SRpcMsg
*
,
SEpSet
*
);
int
(
*
afp
)(
void
*
parent
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
...
...
@@ -97,8 +97,8 @@ typedef struct SRpcConn {
char
user
[
TSDB_UNI_LEN
];
// user ID for the link
char
spi
;
// security parameter index
char
encrypt
;
// encryption, 0:1
char
secret
[
TSDB_
KEY
_LEN
];
// secret for the link
char
ckey
[
TSDB_
KEY_LEN
];
// ciphering key
char
secret
[
TSDB_
PASSWORD
_LEN
];
// secret for the link
char
ckey
[
TSDB_
PASSWORD_LEN
];
// ciphering key
char
secured
;
// if set to 1, no authentication
uint16_t
localPort
;
// for UDP only
uint32_t
linkUid
;
// connection unique ID assigned by client
...
...
@@ -698,7 +698,7 @@ static SRpcConn *rpcAllocateClientConn(SRpcInfo *pRpc) {
pConn
->
linkUid
=
(
uint32_t
)((
int64_t
)
pConn
+
taosGetPid
()
+
(
int64_t
)
pConn
->
tranId
);
pConn
->
spi
=
pRpc
->
spi
;
pConn
->
encrypt
=
pRpc
->
encrypt
;
if
(
pConn
->
spi
)
memcpy
(
pConn
->
secret
,
pRpc
->
secret
,
TSDB_
KEY
_LEN
);
if
(
pConn
->
spi
)
memcpy
(
pConn
->
secret
,
pRpc
->
secret
,
TSDB_
PASSWORD
_LEN
);
tDebug
(
"%s %p client connection is allocated, uid:0x%x"
,
pRpc
->
label
,
pConn
,
pConn
->
linkUid
);
}
...
...
@@ -1527,9 +1527,9 @@ static int rpcAuthenticateMsg(void *pMsg, int msgLen, void *pAuth, void *pKey) {
int
ret
=
-
1
;
MD5Init
(
&
context
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_
KEY
_LEN
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_
PASSWORD
_LEN
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pMsg
,
msgLen
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_
KEY
_LEN
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_
PASSWORD
_LEN
);
MD5Final
(
&
context
);
if
(
memcmp
(
context
.
digest
,
pAuth
,
sizeof
(
context
.
digest
))
==
0
)
ret
=
0
;
...
...
@@ -1541,9 +1541,9 @@ static void rpcBuildAuthHead(void *pMsg, int msgLen, void *pAuth, void *pKey) {
MD5_CTX
context
;
MD5Init
(
&
context
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_
KEY
_LEN
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_
PASSWORD
_LEN
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pMsg
,
msgLen
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_
KEY
_LEN
);
MD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_
PASSWORD
_LEN
);
MD5Final
(
&
context
);
memcpy
(
pAuth
,
context
.
digest
,
sizeof
(
context
.
digest
));
...
...
source/os/src/osString.c
浏览文件 @
8c416a5e
...
...
@@ -275,13 +275,13 @@ char *strsep(char **stringp, const char *delim) {
}
char
*
getpass
(
const
char
*
prefix
)
{
static
char
passwd
[
TSDB_
KEY
_LEN
]
=
{
0
};
memset
(
passwd
,
0
,
TSDB_
KEY
_LEN
);
static
char
passwd
[
TSDB_
PASSWORD
_LEN
]
=
{
0
};
memset
(
passwd
,
0
,
TSDB_
PASSWORD
_LEN
);
//printf("%s", prefix);
int32_t
index
=
0
;
char
ch
;
while
(
index
<
TSDB_
KEY
_LEN
)
{
while
(
index
<
TSDB_
PASSWORD
_LEN
)
{
ch
=
getch
();
if
(
ch
==
'\n'
||
ch
==
'\r'
)
{
break
;
...
...
src/inc/tcq.h
浏览文件 @
8c416a5e
...
...
@@ -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_
KEY
_LEN
];
char
pass
[
TSDB_
PASSWORD
_LEN
];
char
db
[
TSDB_ACCT_ID_LEN
+
TSDB_DB_NAME_LEN
];
// size must same with SVnodeObj.db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN]
FCqWrite
cqWrite
;
}
SCqCfg
;
...
...
@@ -37,7 +37,7 @@ typedef struct {
int32_t
master
;
int32_t
num
;
// number of continuous streams
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_
KEY
_LEN
];
char
pass
[
TSDB_
PASSWORD
_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
FCqWrite
cqWrite
;
struct
SCqObj
*
pHead
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录