From 024acdda9a5a6eb0d39bda1252f124aa0480582d Mon Sep 17 00:00:00 2001 From: HuangXin Date: Mon, 11 Mar 2019 10:17:00 +0800 Subject: [PATCH] Log hide ProductKey and ProductSecury information --- configure/cfg.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/configure/cfg.c b/configure/cfg.c index 482d1c6..7e38255 100644 --- a/configure/cfg.c +++ b/configure/cfg.c @@ -24,7 +24,6 @@ static int CfgEncrypto(unsigned char* pDest, unsigned char* pSrc, int iSlen); static void __dumpGlobalCfg(void) { -#if !RELEASE_VERSION int err; char *pSerial; @@ -36,8 +35,7 @@ static void __dumpGlobalCfg(void) } LOG_EX(LOG_Debug, "Global Configure Information:\n%s\n", pSerial); - free(pSerial); -#endif + free(pSerial); } PUSER_CONFIG ne_cfg_get_user_cfg(void) @@ -210,10 +208,20 @@ void ne_clear_ssid_psk(void) } } -static void __dumpUserConfig(PUSER_CONFIG pCfg) +static void __dumpUserConfig(PUSER_CONFIG pInCfg) { char* pStr; int i; + USER_CONFIG usrCfg; + PUSER_CONFIG pCfg = &usrCfg; + + memcpy(&usrCfg, pInCfg, sizeof(USER_CONFIG)); + +#if RELEASE_VERSION + pCfg->ServerCfg.ProductKey = "********************************"; + pCfg->ServerCfg.ProductSecury = "********"; +#endif + #if 0 printf("FactoryMode: %d\n", pCfg->FactoryMode); printf("DeviceType: %d\n", pCfg->DeviceType); @@ -242,6 +250,7 @@ static void __dumpUserConfig(PUSER_CONFIG pCfg) printf(" FlowCtrl[%d]: %d\n", i, pCfg->UART[i].FlowCtrl); } #endif + pStr = (char*)Struct2Json(pCfg, JE_USER_CFG, CRYPTO_NONE, &i); if(pStr == NULL || i != ERR_OK) @@ -253,6 +262,7 @@ static void __dumpUserConfig(PUSER_CONFIG pCfg) LOG_EX(LOG_Debug, "User Configure Information:\n%s\n", pStr); free(pStr); + } PUSER_CONFIG CreateDefaultUserCfg(void)