Synchronize_241120

Signed-off-by: kehongxu <kehongxu@huawei.com>
This commit is contained in:
kehongxu 2024-11-20 17:13:44 +08:00
parent 94dcb838f3
commit 91b1bca09c

View File

@ -21,8 +21,6 @@
#define LOG_PRINT_MAX_LEN 2048
static const char *SENSITIVE_WORDS[] = { "droid" };
#ifdef DEV_AUTH_DEBUG_PRINTF
#include <stdio.h>
@ -67,23 +65,6 @@ static void DevAuthOutPrint(const char *buf, DevAuthLogLevel level)
}
}
static void ReplaceSensitiveWord(char *msg, const char *sensitiveWord)
{
uint32_t len = HcStrlen(sensitiveWord);
char *ptr = strstr(msg, sensitiveWord);
while (ptr != NULL) {
(void)memset_s(ptr, len, '*', len);
ptr = strstr(ptr + 1, sensitiveWord);
}
}
static void DesensitizeLogMsg(char *msg)
{
for (uint32_t i = 0; i < sizeof(SENSITIVE_WORDS) / sizeof(SENSITIVE_WORDS[0]); i++) {
ReplaceSensitiveWord(msg, SENSITIVE_WORDS[i]);
}
}
void DevAuthLogPrint(DevAuthLogLevel level, const char *funName, const char *fmt, ...)
{
int32_t ulPos = 0;
@ -105,7 +86,6 @@ void DevAuthLogPrint(DevAuthLogLevel level, const char *funName, const char *fmt
if (res < 0) {
return;
}
DesensitizeLogMsg(outStr);
DevAuthOutPrint(outStr, level);
}