From 3db2c59581e6e509b266b43a6fc70ab7a79b3ae3 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 8 Mar 2023 16:10:11 +0800 Subject: [PATCH] fix: check the compatibility of client version and server version --- source/dnode/mnode/impl/test/profile/profile.cpp | 6 ++++-- source/dnode/mnode/impl/test/show/show.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index 2ae113e051..6ab6d364cb 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -32,13 +32,14 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { connectReq.pid = 1234; char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); strcpy(connectReq.app, "mnode_test_profile"); strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); @@ -66,7 +67,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); SConnectReq connectReq = {0}; @@ -75,6 +76,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { strcpy(connectReq.db, "invalid_db"); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index 0ccefa7ca2..2e67ffa946 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -55,7 +55,7 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { TEST_F(MndTestShow, 03_ShowMsg_Conn) { char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); SConnectReq connectReq = {0}; @@ -64,6 +64,7 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) { strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); -- GitLab