diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 95ed21b302..f0dae8fb89 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -299,11 +299,11 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { } //if(req.encryptAlgorithm == DND_CA_SM4){ - // if(strlen(tsEncryptKey) == 0){ - // terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; - // dError("vgId:%d, failed to create vnode since encrypt key is empty", req.vgId); - // return -1; - // } + if(strlen(tsEncryptKey) == 0){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + dError("vgId:%d, failed to create vnode since encrypt key is empty", req.vgId); + return -1; + } //} vmGenerateVnodeCfg(&req, &vnodeCfg); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 67cdf3e77e..75ba0fef10 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -477,16 +477,16 @@ static int32_t mndInitWal(SMnode *pMnode) { }; #if defined(TD_ENTERPRISE) - // if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_MNODE_WAL) == DND_CS_MNODE_WAL){ - // cfg.encryptAlgorithm = (tsiEncryptScope & DND_CS_MNODE_WAL)? tsiEncryptAlgorithm : 0; - // if(tsEncryptKey[0] == '\0'){ - // terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; - // return -1; - // } - // else{ - // strncpy(cfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); - // } - // } + if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_MNODE_WAL) == DND_CS_MNODE_WAL){ + cfg.encryptAlgorithm = (tsiEncryptScope & DND_CS_MNODE_WAL)? tsiEncryptAlgorithm : 0; + if(tsEncryptKey[0] == '\0'){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + return -1; + } + else{ + strncpy(cfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } + } #endif pMnode->pWal = walOpen(path, &cfg); diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index f4e0713ebf..a0da430c6a 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -246,15 +246,15 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { tjsonGetNumberValue(pJson, "tsdb.encryptAlgorithm", pCfg->tsdbCfg.encryptAlgorithm, code); if (code < 0) return -1; #if defined(TD_ENTERPRISE) - // if(pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4){ - // if(tsEncryptKey[0] == 0){ - // terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; - // return -1; - // } - // else{ - // strncpy(pCfg->tsdbCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); - // } - // } + if(pCfg->tsdbCfg.encryptAlgorithm == DND_CA_SM4){ + if(tsEncryptKey[0] == 0){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + return -1; + } + else{ + strncpy(pCfg->tsdbCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } + } #endif tjsonGetNumberValue(pJson, "wal.vgId", pCfg->walCfg.vgId, code); if (code < 0) return -1; @@ -273,28 +273,28 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { tjsonGetNumberValue(pJson, "wal.encryptAlgorithm", pCfg->walCfg.encryptAlgorithm, code); if (code < 0) return -1; #if defined(TD_ENTERPRISE) - // if(pCfg->walCfg.encryptAlgorithm == DND_CA_SM4){ - // if(tsEncryptKey[0] == 0){ - // terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; - // return -1; - // } - // else{ - // strncpy(pCfg->walCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); - // } - // } + if(pCfg->walCfg.encryptAlgorithm == DND_CA_SM4){ + if(tsEncryptKey[0] == 0){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + return -1; + } + else{ + strncpy(pCfg->walCfg.encryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } + } #endif tjsonGetNumberValue(pJson, "tdbEncryptAlgorithm", pCfg->tdbEncryptAlgorithm, code); if (code < 0) return -1; #if defined(TD_ENTERPRISE) - // if(pCfg->tdbEncryptAlgorithm == DND_CA_SM4){ - // if(tsEncryptKey[0] == 0){ - // terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; - // return -1; - // } - // else{ - // strncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); - // } - // } + if(pCfg->tdbEncryptAlgorithm == DND_CA_SM4){ + if(tsEncryptKey[0] == 0){ + terrno = TSDB_CODE_DNODE_INVALID_ENCRYPTKEY; + return -1; + } + else{ + strncpy(pCfg->tdbEncryptKey, tsEncryptKey, ENCRYPT_KEY_LEN); + } + } #endif tjsonGetNumberValue(pJson, "sstTrigger", pCfg->sttTrigger, code); if (code < 0) pCfg->sttTrigger = TSDB_DEFAULT_SST_TRIGGER; diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index bf9a2da671..7c52410ae3 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -338,13 +338,13 @@ class TDTestCase: def run(self): self.prepare_data() - # self.count_check() - # self.ins_columns_check() + self.count_check() + self.ins_columns_check() # self.ins_col_check_4096() - # self.ins_stable_check() - # self.ins_stable_check2() - # self.ins_dnodes_check() - # self.ins_grants_check() + self.ins_stable_check() + self.ins_stable_check2() + self.ins_dnodes_check() + self.ins_grants_check() self.ins_encryptions_check()