bug fix: Adding non null judgment to lnn log printing

Signed-off-by: y30033032 <yuanmeng36@huawei.com>
This commit is contained in:
y30033032 2024-09-26 18:11:49 +08:00
parent 0d79ec4845
commit 9811566e55
42 changed files with 332 additions and 266 deletions

View File

@ -127,7 +127,7 @@ int32_t LnnNetManagerListener::OnInterfaceAddressUpdated(
{
char *anonyAddr = NULL;
Anonymize(addr.c_str(), &anonyAddr);
LNN_LOGI(LNN_BUILDER, "ifName=%{public}s, addr=%{public}s", ifName.c_str(), anonyAddr);
LNN_LOGI(LNN_BUILDER, "ifName=%{public}s, addr=%{public}s", ifName.c_str(), AnonymizeWrapper(anonyAddr));
AnonymizeFree(anonyAddr);
if (strstr(ifName.c_str(), "eth") == NULL) {
return SOFTBUS_INVALID_PARAM;
@ -166,7 +166,7 @@ int32_t LnnNetManagerListener::OnInterfaceAddressRemoved(
{
char *anonyAddr = NULL;
Anonymize(addr.c_str(), &anonyAddr);
LNN_LOGI(LNN_BUILDER, "ifName=%{public}s, addr=%{public}s", ifName.c_str(), anonyAddr);
LNN_LOGI(LNN_BUILDER, "ifName=%{public}s, addr=%{public}s", ifName.c_str(), AnonymizeWrapper(anonyAddr));
AnonymizeFree(anonyAddr);
return SOFTBUS_OK;
}

View File

@ -124,8 +124,8 @@ static int32_t SoftBusGetOsType(void)
strcmp(osVersion, UNDEFINED_VALUE) != 0) {
char *anonyBootSN = NULL;
Anonymize(bootSN, &anonyBootSN);
LNN_LOGI(LNN_STATE, "apiVersion: %{public}s bootSN: %{public}s osVersion: %{public}s", apiVersion, anonyBootSN,
osVersion);
LNN_LOGI(LNN_STATE, "apiVersion: %{public}s bootSN: %{public}s osVersion: %{public}s",
apiVersion, AnonymizeWrapper(anonyBootSN), osVersion);
AnonymizeFree(anonyBootSN);
return OH_OS_TYPE;
}

View File

@ -114,7 +114,7 @@ static int32_t GetDeviceNameFromDataShareHelper(std::shared_ptr<DataShare::DataS
}
char *anonyDeviceName = NULL;
Anonymize(deviceName, &anonyDeviceName);
LNN_LOGI(LNN_STATE, "deviceName=%{public}s.", anonyDeviceName);
LNN_LOGI(LNN_STATE, "deviceName=%{public}s.", AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyDeviceName);
resultSet->Close();
return SOFTBUS_OK;

View File

@ -273,7 +273,7 @@ int32_t KVAdapter::Get(const std::string &key, std::string &value)
{
char *anonyKey = nullptr;
Anonymize(key.c_str(), &anonyKey);
LNN_LOGI(LNN_LEDGER, "Get data by key: %{public}s", anonyKey);
LNN_LOGI(LNN_LEDGER, "Get data by key: %{public}s", AnonymizeWrapper(anonyKey));
AnonymizeFree(anonyKey);
DistributedKv::Key kvKey(key);
DistributedKv::Value kvValue;
@ -289,7 +289,7 @@ int32_t KVAdapter::Get(const std::string &key, std::string &value)
if (status != DistributedKv::Status::SUCCESS) {
anonyKey = nullptr;
Anonymize(key.c_str(), &anonyKey);
LNN_LOGE(LNN_LEDGER, "Get data from kv failed, key=%{public}s", anonyKey);
LNN_LOGE(LNN_LEDGER, "Get data from kv failed, key=%{public}s", AnonymizeWrapper(anonyKey));
AnonymizeFree(anonyKey);
return SOFTBUS_KV_GET_DB_FAIL;
}

View File

@ -80,7 +80,7 @@ std::vector<DistributedKv::Entry> KvDataChangeListener::ConvertCloudChangeDataTo
if (LnnGetDBData(dbId, key.c_str(), key.length(), &value) != SOFTBUS_OK) {
anonyKey = nullptr;
Anonymize(key.c_str(), &anonyKey);
LNN_LOGE(LNN_LEDGER, "get value failed, key = %{public}s", anonyKey);
LNN_LOGE(LNN_LEDGER, "get value failed, key = %{public}s", AnonymizeWrapper(anonyKey));
AnonymizeFree(anonyKey);
continue;
}

View File

@ -530,12 +530,12 @@ void PrintAuthConnInfo(const AuthConnInfo *connInfo)
switch (connInfo->type) {
case AUTH_LINK_TYPE_WIFI:
Anonymize(connInfo->info.ipInfo.ip, &anonyIp);
AUTH_LOGD(AUTH_CONN, "print AuthConninfo ip=*.*.*%{public}s", anonyIp);
AUTH_LOGD(AUTH_CONN, "print AuthConninfo ip=*.*.*%{public}s", AnonymizeWrapper(anonyIp));
AnonymizeFree(anonyIp);
break;
case AUTH_LINK_TYPE_BR:
Anonymize(connInfo->info.brInfo.brMac, &anonyMac);
AUTH_LOGD(AUTH_CONN, "print AuthConninfo brMac=**:**:**:**:%{public}s", anonyMac);
AUTH_LOGD(AUTH_CONN, "print AuthConninfo brMac=**:**:**:**:%{public}s", AnonymizeWrapper(anonyMac));
AnonymizeFree(anonyMac);
break;
case AUTH_LINK_TYPE_BLE:
@ -546,8 +546,8 @@ void PrintAuthConnInfo(const AuthConnInfo *connInfo)
}
Anonymize(udidHash, &anonyUdidHash);
Anonymize(connInfo->info.bleInfo.bleMac, &anonyMac);
AUTH_LOGD(AUTH_CONN, "print AuthConninfo bleMac=**:**:**:**:%{public}s, udidhash=%{public}s", anonyMac,
anonyUdidHash);
AUTH_LOGD(AUTH_CONN, "print AuthConninfo bleMac=**:**:**:**:%{public}s, udidhash=%{public}s",
AnonymizeWrapper(anonyMac), AnonymizeWrapper(anonyUdidHash));
AnonymizeFree(anonyMac);
AnonymizeFree(anonyUdidHash);
break;

View File

@ -97,7 +97,8 @@ static bool IsTrustDevice(std::vector<OHOS::DistributedDeviceProfile::AccessCont
}
char *anonyUdid = nullptr;
Anonymize(trustDevice.GetTrustDeviceId().c_str(), &anonyUdid);
LNN_LOGI(LNN_STATE, "udid=%{public}s, deviceIdHash=%{public}s", anonyUdid, anonyDeviceIdHash);
LNN_LOGI(LNN_STATE, "udid=%{public}s, deviceIdHash=%{public}s",
AnonymizeWrapper(anonyUdid), anonyDeviceIdHash);
AnonymizeFree(anonyUdid);
uint8_t udidHash[SHA_256_HASH_LEN] = {0};
char hashStr[CUST_UDID_LEN + 1] = {0};
@ -145,7 +146,7 @@ bool IsPotentialTrustedDeviceDp(const char *deviceIdHash)
}
InsertNotTrustDevice(deviceIdHash);
LNN_LOGI(LNN_STATE, "device is not trusted in dp, deviceIdHash=%{public}s, callCount=%{public}u",
anonyDeviceIdHash, callCount++);
AnonymizeWrapper(anonyDeviceIdHash), callCount++);
AnonymizeFree(anonyDeviceIdHash);
return false;
}
@ -228,7 +229,7 @@ static void InsertDpSameAccount(const std::string udid)
}
char *anonyUdid = nullptr;
Anonymize(udid.c_str(), &anonyUdid);
LNN_LOGI(LNN_STATE, "insert dp same account succ, udid=%{public}s", anonyUdid);
LNN_LOGI(LNN_STATE, "insert dp same account succ, udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
}

View File

@ -274,7 +274,8 @@ static void OnDeviceBound(const char *udid, const char *groupInfo)
}
char *anonyUdid = NULL;
Anonymize(udid, &anonyUdid);
AUTH_LOGI(AUTH_HICHAIN, "hichain onDeviceBound, udid=%{public}s, type=%{public}d", anonyUdid, info.groupType);
AUTH_LOGI(AUTH_HICHAIN, "hichain onDeviceBound, udid=%{public}s, type=%{public}d",
AnonymizeWrapper(anonyUdid), info.groupType);
AnonymizeFree(anonyUdid);
if (info.groupType == AUTH_IDENTICAL_ACCOUNT_GROUP) {
AUTH_LOGI(AUTH_HICHAIN, "ignore same account udid");
@ -316,7 +317,7 @@ static void OnDeviceNotTrusted(const char *udid)
}
char *anonyUdid = NULL;
Anonymize(udid, &anonyUdid);
AUTH_LOGI(AUTH_HICHAIN, "hichain OnDeviceNotTrusted, udid=%{public}s", anonyUdid);
AUTH_LOGI(AUTH_HICHAIN, "hichain OnDeviceNotTrusted, udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
if (g_dataChangeListener.onDeviceNotTrusted != NULL) {
g_dataChangeListener.onDeviceNotTrusted(udid);

View File

@ -87,7 +87,7 @@ AuthManager *NewAuthManager(int64_t authSeq, const AuthSessionInfo *info)
char *anonyUuid = NULL;
Anonymize(auth->uuid, &anonyUuid);
AUTH_LOGI(AUTH_FSM, "create auth manager, uuid=%{public}s, side=%{public}s, authId=%{public}" PRId64,
anonyUuid, GetAuthSideStr(auth->isServer), auth->authId);
AnonymizeWrapper(anonyUuid), GetAuthSideStr(auth->isServer), auth->authId);
AnonymizeFree(anonyUuid);
return auth;
}
@ -140,13 +140,14 @@ void DelAuthManager(AuthManager *auth, int32_t type)
}
ClearSessionkeyByAuthLinkType(auth->authId, &auth->sessionKeyList, (AuthLinkType)type);
AUTH_LOGI(AUTH_FSM, "only clear connInfo, udid=%{public}s, side=%{public}s, type=%{public}d,"
" authId=%{public}" PRId64, anonyUdid, GetAuthSideStr(auth->isServer), type, auth->authId);
" authId=%{public}" PRId64, AnonymizeWrapper(anonyUdid),
GetAuthSideStr(auth->isServer), type, auth->authId);
AnonymizeFree(anonyUdid);
return;
}
}
AUTH_LOGI(AUTH_FSM, "delete auth manager, udid=%{public}s, side=%{public}s, authId=%{public}" PRId64, anonyUdid,
GetAuthSideStr(auth->isServer), auth->authId);
AUTH_LOGI(AUTH_FSM, "delete auth manager, udid=%{public}s, side=%{public}s, authId=%{public}" PRId64,
AnonymizeWrapper(anonyUdid), GetAuthSideStr(auth->isServer), auth->authId);
AnonymizeFree(anonyUdid);
ListDelete(&auth->node);
CancelUpdateSessionKey(auth->authId);
@ -399,7 +400,8 @@ int32_t GetAuthConnInfoByUuid(const char *uuid, AuthLinkType type, AuthConnInfo
char *anonyUuid = NULL;
Anonymize(uuid, &anonyUuid);
if (auth == NULL) {
AUTH_LOGI(AUTH_CONN, "auth not found by uuid, connType=%{public}d, uuid=%{public}s", type, anonyUuid);
AUTH_LOGI(AUTH_CONN, "auth not found by uuid, connType=%{public}d, uuid=%{public}s",
type, AnonymizeWrapper(anonyUuid));
AnonymizeFree(anonyUuid);
ReleaseAuthLock();
return SOFTBUS_AUTH_NOT_FOUND;
@ -422,13 +424,15 @@ static int32_t GetAvailableAuthConnInfoByUuid(const char *uuid, AuthLinkType typ
char *anonyUuid = NULL;
Anonymize(uuid, &anonyUuid);
if (auth == NULL) {
AUTH_LOGI(AUTH_CONN, "auth not found by uuid, connType=%{public}d, uuid=%{public}s", type, anonyUuid);
AUTH_LOGI(AUTH_CONN, "auth not found by uuid, connType=%{public}d, uuid=%{public}s",
type, AnonymizeWrapper(anonyUuid));
AnonymizeFree(anonyUuid);
ReleaseAuthLock();
return SOFTBUS_AUTH_NOT_FOUND;
}
if (GetLatestAvailableSessionKeyTime(&auth->sessionKeyList, type) == 0) {
AUTH_LOGI(AUTH_FSM, "not available session key, connType=%{public}d, uuid=%{public}s", type, anonyUuid);
AUTH_LOGI(AUTH_FSM, "not available session key, connType=%{public}d, uuid=%{public}s",
type, AnonymizeWrapper(anonyUuid));
AnonymizeFree(anonyUuid);
ReleaseAuthLock();
return SOFTBUS_AUTH_SESSION_KEY_INVALID;
@ -621,7 +625,7 @@ static AuthManager *GetExistAuthManager(int64_t authSeq, const AuthSessionInfo *
if (strcpy_s(auth->uuid, UUID_BUF_LEN, info->uuid) != EOK) {
char *anonyUuid = NULL;
Anonymize(info->uuid, &anonyUuid);
AUTH_LOGE(AUTH_FSM, "str copy uuid fail, uuid=%{public}s", anonyUuid);
AUTH_LOGE(AUTH_FSM, "str copy uuid fail, uuid=%{public}s", AnonymizeWrapper(anonyUuid));
AnonymizeFree(anonyUuid);
}
if (memcpy_s(&auth->connInfo[info->connInfo.type], sizeof(AuthConnInfo),
@ -655,7 +659,8 @@ AuthManager *GetDeviceAuthManager(int64_t authSeq, const AuthSessionInfo *info,
}
char *anonyUuid = NULL;
Anonymize(auth->uuid, &anonyUuid);
AUTH_LOGI(AUTH_FSM, "uuid=%{public}s, authId=%{public}" PRId64, anonyUuid, auth->authId);
AUTH_LOGI(AUTH_FSM, "uuid=%{public}s, authId=%{public}" PRId64,
AnonymizeWrapper(anonyUuid), auth->authId);
AnonymizeFree(anonyUuid);
} else {
auth = GetExistAuthManager(authSeq, info);
@ -1836,7 +1841,7 @@ int32_t AuthGetLatestAuthSeqList(const char *udid, int64_t *seqList, uint32_t nu
ReleaseAuthLock();
char *anonyUdid = NULL;
Anonymize(udid, &anonyUdid);
AUTH_LOGE(AUTH_CONN, "not found active authManager, udid=%{public}s", anonyUdid);
AUTH_LOGE(AUTH_CONN, "not found active authManager, udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
return SOFTBUS_AUTH_NOT_FOUND;
}
@ -1957,7 +1962,7 @@ void AuthDeviceGetLatestIdByUuid(const char *uuid, AuthLinkType type, AuthHandle
AUTH_LOGI(AUTH_CONN,
"latest auth manager found, latestAuthId=%{public}" PRId64 ", lastVerifyTime=%{public}" PRIu64
", uuid=%{public}s, type=%{public}d",
authHandle->authId, latestVerifyTime, anonyUuid, authHandle->type);
authHandle->authId, latestVerifyTime, AnonymizeWrapper(anonyUuid), authHandle->type);
AnonymizeFree(anonyUuid);
}
@ -1987,7 +1992,7 @@ int64_t AuthDeviceGetIdByUuid(const char *uuid, AuthLinkType type, bool isServer
char *anoyUuid = NULL;
Anonymize(uuid, &anoyUuid);
AUTH_LOGE(AUTH_CONN, "not found auth manager, uuid=%{public}s, connType=%{public}d, side=%{public}s",
anoyUuid, type, GetAuthSideStr(isServer));
AnonymizeWrapper(anoyUuid), type, GetAuthSideStr(isServer));
AnonymizeFree(anoyUuid);
return AUTH_INVALID_ID;
}

View File

@ -34,7 +34,7 @@ static uint32_t GetSameRequestNum(char *udidHash)
NormalizeRequest *item = NULL;
char *anonyUdidHash = NULL;
Anonymize(udidHash, &anonyUdidHash);
AUTH_LOGI(AUTH_HICHAIN, "udidHash=%{public}s", anonyUdidHash);
AUTH_LOGI(AUTH_HICHAIN, "udidHash=%{public}s", AnonymizeWrapper(anonyUdidHash));
AnonymizeFree(anonyUdidHash);
LIST_FOR_EACH_ENTRY(item, &g_normalizeRequestList, NormalizeRequest, node) {
if (strncmp(item->udidHash, udidHash, UDID_SHORT_HASH_STR) != 0) {

View File

@ -576,7 +576,8 @@ static uint32_t AddConcurrentAuthRequest(AuthFsm *authFsm)
num = AddNormalizeRequest(&normalizeRequest);
char *anonyUdidHash = NULL;
Anonymize(normalizeRequest.udidHash, &anonyUdidHash);
AUTH_LOGI(AUTH_CONN, "add normalize queue, num=%{public}d, udidHash=%{public}s", num, anonyUdidHash);
AUTH_LOGI(AUTH_CONN, "add normalize queue, num=%{public}d, udidHash=%{public}s",
num, AnonymizeWrapper(anonyUdidHash));
AnonymizeFree(anonyUdidHash);
return num;
}
@ -743,14 +744,14 @@ static void AuditReportSetPeerDevInfo(LnnAuditExtra *lnnAuditExtra, AuthSessionI
switch (info->connInfo.type) {
case AUTH_LINK_TYPE_BR:
Anonymize(info->connInfo.info.brInfo.brMac, &anonyBrMac);
if (strcpy_s((char *)lnnAuditExtra->peerBrMac, BT_MAC_LEN, anonyBrMac) != EOK) {
if (strcpy_s((char *)lnnAuditExtra->peerBrMac, BT_MAC_LEN, AnonymizeWrapper(anonyBrMac)) != EOK) {
AUTH_LOGE(AUTH_FSM, "BR MAC COPY ERROR");
}
AnonymizeFree(anonyBrMac);
break;
case AUTH_LINK_TYPE_BLE:
Anonymize(info->connInfo.info.bleInfo.bleMac, &anonyBleMac);
if (strcpy_s((char *)lnnAuditExtra->peerBleMac, BT_MAC_LEN, anonyBleMac) != EOK) {
if (strcpy_s((char *)lnnAuditExtra->peerBleMac, BT_MAC_LEN, AnonymizeWrapper(anonyBleMac)) != EOK) {
AUTH_LOGE(AUTH_FSM, "BLE MAC COPY ERROR");
}
AnonymizeFree(anonyBleMac);
@ -759,7 +760,7 @@ static void AuditReportSetPeerDevInfo(LnnAuditExtra *lnnAuditExtra, AuthSessionI
case AUTH_LINK_TYPE_P2P:
case AUTH_LINK_TYPE_ENHANCED_P2P:
Anonymize(info->connInfo.info.ipInfo.ip, &anonyIp);
if (strcpy_s((char *)lnnAuditExtra->peerIp, IP_STR_MAX_LEN, anonyIp) != EOK) {
if (strcpy_s((char *)lnnAuditExtra->peerIp, IP_STR_MAX_LEN, AnonymizeWrapper(anonyIp)) != EOK) {
AUTH_LOGE(AUTH_FSM, "IP COPY ERROR");
}
AnonymizeFree(anonyIp);
@ -776,7 +777,7 @@ static void GetLocalDevReportInfo(AuditReportDevInfo *reportInfo, LnnAuditExtra
(void)LnnGetLocalStrInfo(STRING_KEY_WLAN_IP, reportInfo->localIp, IP_LEN);
char *anonyLocalIp = NULL;
Anonymize(reportInfo->localIp, &anonyLocalIp);
if (strcpy_s((char *)lnnAuditExtra->localIp, IP_LEN, anonyLocalIp) != EOK) {
if (strcpy_s((char *)lnnAuditExtra->localIp, IP_LEN, AnonymizeWrapper(anonyLocalIp)) != EOK) {
AUTH_LOGE(AUTH_FSM, "LOCAL IP COPY ERROR");
}
AnonymizeFree(anonyLocalIp);
@ -784,7 +785,7 @@ static void GetLocalDevReportInfo(AuditReportDevInfo *reportInfo, LnnAuditExtra
(void)LnnGetLocalStrInfo(STRING_KEY_BT_MAC, reportInfo->localBrMac, MAC_LEN);
char *anonyLocalBrMac = NULL;
Anonymize(reportInfo->localBrMac, &anonyLocalBrMac);
if (strcpy_s((char *)lnnAuditExtra->localBrMac, MAC_LEN, anonyLocalBrMac) != EOK) {
if (strcpy_s((char *)lnnAuditExtra->localBrMac, MAC_LEN, AnonymizeWrapper(anonyLocalBrMac)) != EOK) {
AUTH_LOGE(AUTH_FSM, "LOCAL BR MAC COPY ERROR");
}
AnonymizeFree(anonyLocalBrMac);
@ -792,7 +793,7 @@ static void GetLocalDevReportInfo(AuditReportDevInfo *reportInfo, LnnAuditExtra
(void)LnnGetLocalStrInfo(STRING_KEY_BLE_MAC, reportInfo->localBleMac, MAC_LEN);
char *anonyLocalBleMac = NULL;
Anonymize(reportInfo->localBleMac, &anonyLocalBleMac);
if (strcpy_s((char *)lnnAuditExtra->localBleMac, MAC_LEN, anonyLocalBleMac) != EOK) {
if (strcpy_s((char *)lnnAuditExtra->localBleMac, MAC_LEN, AnonymizeWrapper(anonyLocalBleMac)) != EOK) {
AUTH_LOGE(AUTH_FSM, "LOCAL BLE MAC COPY ERROR");
}
AnonymizeFree(anonyLocalBleMac);
@ -800,7 +801,8 @@ static void GetLocalDevReportInfo(AuditReportDevInfo *reportInfo, LnnAuditExtra
(void)LnnGetLocalStrInfo(STRING_KEY_NETWORKID, reportInfo->localNetworkId, NETWORK_ID_BUF_LEN);
char *anonyLocalNetworkId = NULL;
Anonymize(reportInfo->localNetworkId, &anonyLocalNetworkId);
if (strcpy_s((char *)lnnAuditExtra->localNetworkId, NETWORK_ID_BUF_LEN, anonyLocalNetworkId) != EOK) {
if (strcpy_s((char *)lnnAuditExtra->localNetworkId, NETWORK_ID_BUF_LEN,
AnonymizeWrapper(anonyLocalNetworkId)) != EOK) {
AUTH_LOGE(AUTH_FSM, "LOCAL NETWORKID COPY ERROR");
}
AnonymizeFree(anonyLocalNetworkId);
@ -808,7 +810,8 @@ static void GetLocalDevReportInfo(AuditReportDevInfo *reportInfo, LnnAuditExtra
(void)LnnGetLocalStrInfo(STRING_KEY_DEV_NAME, reportInfo->localDevName, DEVICE_NAME_BUF_LEN);
char *anonyLocalDevName = NULL;
Anonymize(reportInfo->localDevName, &anonyLocalDevName);
if (strcpy_s((char *)lnnAuditExtra->localDevName, DEVICE_NAME_BUF_LEN, anonyLocalDevName) != EOK) {
if (strcpy_s((char *)lnnAuditExtra->localDevName, DEVICE_NAME_BUF_LEN,
AnonymizeWrapper(anonyLocalDevName)) != EOK) {
AUTH_LOGE(AUTH_FSM, "LOCAL DEVICE NAME COPY ERROR");
}
AnonymizeFree(anonyLocalDevName);
@ -844,7 +847,7 @@ static void AuditReportSetLocalDevInfo(LnnAuditExtra *lnnAuditExtra)
}
char *anonyLocalUdid = NULL;
Anonymize(reportInfo.localUdid, &anonyLocalUdid);
if (strcpy_s((char *)lnnAuditExtra->localUdid, SHA_256_HEX_HASH_LEN, anonyLocalUdid) != EOK) {
if (strcpy_s((char *)lnnAuditExtra->localUdid, SHA_256_HEX_HASH_LEN, AnonymizeWrapper(anonyLocalUdid)) != EOK) {
AUTH_LOGE(AUTH_FSM, "LOCAL UDID COPY ERROR");
}
AnonymizeFree(anonyLocalUdid);
@ -886,7 +889,7 @@ static void UpdateUdidHashIfEmpty(AuthFsm *authFsm, AuthSessionInfo *info)
authFsm->info.connInfo.info.bleInfo.deviceIdHash[0] == '\0') {
char *anonyUdid = NULL;
Anonymize(info->udid, &anonyUdid);
AUTH_LOGW(AUTH_FSM, "udidhash is empty, udid=%{public}s", anonyUdid);
AUTH_LOGW(AUTH_FSM, "udidhash is empty, udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
if (SoftBusGenerateStrHash((unsigned char *)info->udid, strlen(info->udid),
(unsigned char *)authFsm->info.connInfo.info.bleInfo.deviceIdHash) != SOFTBUS_OK) {
@ -1183,7 +1186,7 @@ static int32_t ProcessClientAuthState(AuthFsm *authFsm)
}
char *anonyUdid = NULL;
Anonymize(authFsm->info.udid, &anonyUdid);
AUTH_LOGI(AUTH_FSM, "start auth send udid=%{public}s", anonyUdid);
AUTH_LOGI(AUTH_FSM, "start auth send udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
return HichainStartAuth(authFsm->authSeq, authFsm->info.udid, authFsm->info.connInfo.peerUid);
}

View File

@ -404,7 +404,7 @@ static void PackFastAuth(JsonObj *obj, AuthSessionInfo *info)
}
char *anonyUdidHash = NULL;
Anonymize(udidHashHexStr, &anonyUdidHash);
AUTH_LOGI(AUTH_FSM, "udidHashHexStr=%{public}s", anonyUdidHash);
AUTH_LOGI(AUTH_FSM, "udidHashHexStr=%{public}s", AnonymizeWrapper(anonyUdidHash));
AnonymizeFree(anonyUdidHash);
if (info->connInfo.type != AUTH_LINK_TYPE_ENHANCED_P2P &&
!IsPotentialTrustedDevice(ID_TYPE_DEVID, (const char *)udidHashHexStr, false, false)) {
@ -759,7 +759,8 @@ static bool VerifySessionInfoIdType(const AuthSessionInfo *info, JsonObj *obj, c
}
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
AUTH_LOGI(AUTH_FSM, "exchangeIdType=%{public}d, networkid=%{public}s", info->idType, anonyNetworkId);
AUTH_LOGI(AUTH_FSM, "exchangeIdType=%{public}d, networkid=%{public}s",
info->idType, AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
} else {
if (!JSON_AddStringToObject(obj, DEVICE_ID_TAG, udid)) {
@ -768,7 +769,8 @@ static bool VerifySessionInfoIdType(const AuthSessionInfo *info, JsonObj *obj, c
}
char *anonyUdid = NULL;
Anonymize(udid, &anonyUdid);
AUTH_LOGI(AUTH_FSM, "exchangeIdType=%{public}d, udid=%{public}s", info->idType, anonyUdid);
AUTH_LOGI(AUTH_FSM, "exchangeIdType=%{public}d, udid=%{public}s",
info->idType, AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
}
@ -975,7 +977,8 @@ static int32_t SetExchangeIdTypeAndValue(JsonObj *obj, AuthSessionInfo *info)
char *anonyUdid = NULL;
Anonymize(info->udid, &anonyUdid);
AUTH_LOGI(AUTH_FSM,
"oldIdType=%{public}d, exchangeIdType=%{public}d, deviceId=%{public}s", info->idType, idType, anonyUdid);
"oldIdType=%{public}d, exchangeIdType=%{public}d, deviceId=%{public}s",
info->idType, idType, AnonymizeWrapper(anonyUdid));
if (idType == EXCHANGE_UDID) {
info->idType = EXCHANGE_UDID;
AnonymizeFree(anonyUdid);
@ -1175,7 +1178,7 @@ static void AuthPrintBase64Ptk(const char *ptk)
{
char *anonyPtk = NULL;
Anonymize(ptk, &anonyPtk);
AUTH_LOGD(AUTH_FSM, "base Ptk=%{public}s", anonyPtk);
AUTH_LOGD(AUTH_FSM, "base Ptk=%{public}s", AnonymizeWrapper(anonyPtk));
AnonymizeFree(anonyPtk);
}
@ -1255,7 +1258,7 @@ static void DumpRpaCipherKey(char *cipherKey, char *cipherIv, const char *peerIr
Anonymize(cipherIv, &anonyCipherIv);
Anonymize(peerIrk, &anonyIrk);
AUTH_LOGI(AUTH_FSM, "log=%{public}s, cipherKey=%{public}s, cipherIv=%{public}s, peerIrk=%{public}s", log,
anonyCipherKey, anonyCipherIv, anonyIrk);
AnonymizeWrapper(anonyCipherKey), AnonymizeWrapper(anonyCipherIv), AnonymizeWrapper(anonyIrk));
AnonymizeFree(anonyCipherKey);
AnonymizeFree(anonyCipherIv);
AnonymizeFree(anonyIrk);
@ -1959,7 +1962,7 @@ static void UpdateLocalNetBrMac(void)
}
char *anonyMac = NULL;
Anonymize(brMac, &anonyMac);
AUTH_LOGI(AUTH_FSM, "update local brmac=%{public}s", anonyMac);
AUTH_LOGI(AUTH_FSM, "update local brmac=%{public}s", AnonymizeWrapper(anonyMac));
AnonymizeFree(anonyMac);
}
}
@ -2042,7 +2045,9 @@ static void UpdatePeerDeviceName(NodeInfo *peerNodeInfo)
AUTH_LOGD(AUTH_FSM,
"peer tmpDeviceName=%{public}s, deviceName=%{public}s, unifiedName=%{public}s, "
"unifiedDefaultName=%{public}s, nickName=%{public}s",
anonyDeviceName, anonyPeerDeviceName, anonyUnifiedName, anonyUnifiedDefaultName, anonyNickName);
AnonymizeWrapper(anonyDeviceName), AnonymizeWrapper(anonyPeerDeviceName),
AnonymizeWrapper(anonyUnifiedName), AnonymizeWrapper(anonyUnifiedDefaultName),
AnonymizeWrapper(anonyNickName));
AnonymizeFree(anonyDeviceName);
AnonymizeFree(anonyPeerDeviceName);
AnonymizeFree(anonyUnifiedName);

View File

@ -92,11 +92,12 @@ static void DeviceFound(const DeviceInfo *device, const InnerDeviceInfoAddtions
Anonymize(device->devName, &anonyDevName);
// devId format is hex hash string here
LNN_LOGI(LNN_BUILDER, "DeviceFound devName=%{public}s, devId=%{public}s, devType=%{public}03X, port=%{public}u",
anonyDevName, anonyDevId, device->devType, device->addr[0].info.ip.port);
AnonymizeWrapper(anonyDevName), AnonymizeWrapper(anonyDevId), device->devType, device->addr[0].info.ip.port);
AnonymizeFree(anonyDevName);
if (!AuthIsPotentialTrusted(device)) {
LNN_LOGW(LNN_BUILDER, "discovery device is not potential trusted, devId=%{public}s, "
"accountHash=%{public}02X%{public}02X", anonyDevId, device->accountHash[0], device->accountHash[1]);
"accountHash=%{public}02X%{public}02X", AnonymizeWrapper(anonyDevId),
device->accountHash[0], device->accountHash[1]);
AnonymizeFree(anonyDevId);
return;
}

View File

@ -448,7 +448,8 @@ static void HbRemoveCheckOffLineMessage(LnnHeartbeatType hbType)
if (LnnStopScreenChangeOfflineTiming(info[i].networkId, LnnConvertHbTypeToConnAddrType(hbType)) != SOFTBUS_OK) {
char *anonyNetworkId = NULL;
Anonymize(info[i].networkId, &anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "stop check offline target msg failed, networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "stop check offline target msg failed, networkId=%{public}s",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
}
}
@ -920,7 +921,7 @@ int32_t LnnOfflineTimingByHeartbeat(const char *networkId, ConnectionAddrType ad
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_HEART_BEAT, "heartbeat(HB) start offline countdown, networkId=%{public}s, timeStamp=%{public}" PRIu64,
anonyNetworkId, timeStamp);
AnonymizeWrapper(anonyNetworkId), timeStamp);
AnonymizeFree(anonyNetworkId);
if (SoftBusGetBtState() == BLE_ENABLE) {
g_hbConditionState.btState = SOFTBUS_BLE_TURN_ON;
@ -941,7 +942,8 @@ void LnnStopOfflineTimingByHeartbeat(const char *networkId, ConnectionAddrType a
}
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "heartbeat(HB) stop offline timing, networkId:%{public}s", anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "heartbeat(HB) stop offline timing, networkId:%{public}s",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
(void)LnnStopScreenChangeOfflineTiming(networkId, addrType);
(void)LnnStopOfflineTimingStrategy(networkId, addrType);
@ -971,13 +973,13 @@ int32_t LnnShiftLNNGear(const char *pkgName, const char *callerId, const char *t
}
Anonymize(targetNetworkId, &anonyNetworkId);
if (targetNetworkId != NULL && !LnnGetOnlineStateById(targetNetworkId, CATEGORY_NETWORK_ID)) {
LNN_LOGD(LNN_HEART_BEAT, "target is offline, networkId=%{public}s", anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "target is offline, networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
}
LNN_LOGD(LNN_HEART_BEAT,
"shift lnn gear mode, callerId=%{public}s, networkId=%{public}s, cycle=%{public}d, "
"duration=%{public}d, wakeupFlag=%{public}d, action=%{public}d",
callerId, targetNetworkId != NULL ? anonyNetworkId : "", mode->cycle, mode->duration, mode->wakeupFlag,
mode->action);
callerId, targetNetworkId != NULL ? AnonymizeWrapper(anonyNetworkId) : "", mode->cycle, mode->duration,
mode->wakeupFlag, mode->action);
AnonymizeFree(anonyNetworkId);
char uuid[UUID_BUF_LEN] = { 0 };
if (targetNetworkId != NULL) {
@ -1053,7 +1055,8 @@ int32_t LnnShiftLNNGearWithoutPkgName(const char *callerId, const GearMode *mode
if (AuthFlushDevice(uuid) != SOFTBUS_OK) {
char *anonyUuid = NULL;
Anonymize(uuid, &anonyUuid);
LNN_LOGE(LNN_HEART_BEAT, "tcp flush failed, wifi will offline, uuid=%{public}s", anonyUuid);
LNN_LOGE(LNN_HEART_BEAT, "tcp flush failed, wifi will offline, uuid=%{public}s",
AnonymizeWrapper(anonyUuid));
AnonymizeFree(anonyUuid);
LnnRequestLeaveSpecific(info[i].networkId, CONNECTION_ADDR_WLAN);
}

View File

@ -774,13 +774,15 @@ static int32_t ProcessLostHeartbeat(const char *networkId, LnnHeartbeatType type
}
if (!LnnGetOnlineStateById(networkId, CATEGORY_NETWORK_ID)) {
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_HEART_BEAT, "process dev lost is offline, networkId=%{public}s", anonyNetworkId);
LNN_LOGI(LNN_HEART_BEAT, "process dev lost is offline, networkId=%{public}s",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_OK;
}
if (LnnHasActiveConnection(networkId, addrType)) {
Anonymize(networkId, &anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "process dev lost in next period, networkId=%{public}s", anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "process dev lost in next period, networkId=%{public}s",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
if (LnnOfflineTimingByHeartbeat(networkId, addrType) != SOFTBUS_OK) {
LNN_LOGE(LNN_HEART_BEAT, "process dev lost start new offline timing err");
@ -798,7 +800,7 @@ static int32_t ProcessLostHeartbeat(const char *networkId, LnnHeartbeatType type
Anonymize(udidHash, &anonyUdidHash);
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_HEART_BEAT, "process dev lost, udidHash=%{public}s, networkId=%{public}s",
anonyUdidHash, anonyNetworkId);
AnonymizeWrapper(anonyUdidHash), AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
AnonymizeFree(anonyUdidHash);
if (LnnRequestLeaveSpecific(networkId, addrType) != SOFTBUS_OK) {
@ -856,13 +858,13 @@ static void CheckDevStatusByNetworkId(LnnHeartbeatFsm *hbFsm, const char *networ
Anonymize(networkId, &anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT,
"check dev status node doesn't have discType. networkId=%{public}s, discType=%{public}d",
anonyNetworkId, discType);
AnonymizeWrapper(anonyNetworkId), discType);
AnonymizeFree(anonyNetworkId);
return;
}
if (LnnGetDLHeartbeatTimestamp(networkId, &oldTimeStamp) != SOFTBUS_OK) {
Anonymize(networkId, &anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "check dev status get timestamp err, networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "get timestamp err, networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return;
}
@ -870,21 +872,21 @@ static void CheckDevStatusByNetworkId(LnnHeartbeatFsm *hbFsm, const char *networ
nowTime = (uint64_t)times.sec * HB_TIME_FACTOR + (uint64_t)times.usec / HB_TIME_FACTOR;
if (!IsTimestampExceedLimit(nowTime, oldTimeStamp, hbType, msgPara->checkDelay)) {
Anonymize(networkId, &anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "check dev status receive heartbeat in time, networkId=%{public}s, "
"nowTime=%{public}" PRIu64 ", oldTimeStamp=%{public}" PRIu64, anonyNetworkId, nowTime, oldTimeStamp);
LNN_LOGD(LNN_HEART_BEAT, "receive heartbeat in time, networkId=%{public}s, nowTime=%{public}" PRIu64 ", "
"oldTimeStamp=%{public}" PRIu64, AnonymizeWrapper(anonyNetworkId), nowTime, oldTimeStamp);
AnonymizeFree(anonyNetworkId);
return;
}
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_HEART_BEAT, "notify node lost heartbeat, networkId=%{public}s, oldTimeStamp=%{public}" PRIu64 ", "
"nowTime=%{public}" PRIu64, anonyNetworkId, oldTimeStamp, nowTime);
"nowTime=%{public}" PRIu64, AnonymizeWrapper(anonyNetworkId), oldTimeStamp, nowTime);
if (LnnStopOfflineTimingStrategy(networkId, LnnConvertHbTypeToConnAddrType(hbType)) != SOFTBUS_OK) {
LNN_LOGE(LNN_HEART_BEAT, "check dev status stop offline timing fail");
AnonymizeFree(anonyNetworkId);
return;
}
if (ProcessLostHeartbeat(networkId, hbType, msgPara->isWakeUp) != SOFTBUS_OK) {
LNN_LOGE(LNN_HEART_BEAT, "process dev lost err, networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "process dev lost err, networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
}
AnonymizeFree(anonyNetworkId);
}
@ -897,7 +899,8 @@ static void CheckDevStatusForScreenOff(LnnHeartbeatFsm *hbFsm, const char *netwo
char *anonyNetworkId = NULL;
if (LnnHasActiveConnection(networkId, LnnConvertHbTypeToConnAddrType(hbType))) {
Anonymize(networkId, &anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "process screen off dev lost in next period, networkId=%{public}s", anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "process screen off dev lost in next period, networkId=%{public}s",
AnonymizeWrapper(anonyNetworkId));
if (LnnStartScreenChangeOfflineTiming(networkId, LnnConvertHbTypeToConnAddrType(hbType)) != SOFTBUS_OK) {
LNN_LOGE(LNN_HEART_BEAT, "process screen off dev lost start new offline timing err");
}
@ -918,9 +921,10 @@ static void CheckDevStatusForScreenOff(LnnHeartbeatFsm *hbFsm, const char *netwo
}
Anonymize(networkId, &anonyNetworkId);
LNN_LOGW(LNN_HEART_BEAT, "the screen has been closed for more than 2 cycles, will offline, networkId=%{public}s",
anonyNetworkId);
AnonymizeWrapper(anonyNetworkId));
if (!LnnGetOnlineStateById(networkId, CATEGORY_NETWORK_ID)) {
LNN_LOGI(LNN_HEART_BEAT, "process dev lost is offline, networkId=%{public}s", anonyNetworkId);
LNN_LOGI(LNN_HEART_BEAT, "process dev lost is offline, networkId=%{public}s",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return;
}

View File

@ -138,7 +138,7 @@ static int32_t HbSaveRecvTimeToRemoveRepeat(
if (ret != SOFTBUS_OK) {
char *anonyUdid = NULL;
Anonymize(device->devId, &anonyUdid);
LNN_LOGE(LNN_HEART_BEAT, "save recv time fail, udidHash=%{public}s", anonyUdid);
LNN_LOGE(LNN_HEART_BEAT, "save recv time fail, udidHash=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
}
return ret;
@ -204,8 +204,8 @@ static void UpdateOnlineInfoNoConnection(const char *networkId, HbRespData *hbRe
}
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_HEART_BEAT, "networkId=%{public}s capability change:%{public}u->%{public}u", anonyNetworkId,
oldNetCapa, nodeInfo.netCapacity);
LNN_LOGI(LNN_HEART_BEAT, "networkId=%{public}s capability change:%{public}u->%{public}u",
AnonymizeWrapper(anonyNetworkId), oldNetCapa, nodeInfo.netCapacity);
AnonymizeFree(anonyNetworkId);
}
@ -215,15 +215,11 @@ static int32_t HbGetOnlineNodeByRecvInfo(
int32_t infoNum = 0;
NodeBasicInfo *info = NULL;
char udidHash[HB_SHORT_UDID_HASH_HEX_LEN + 1] = { 0 };
if (LnnGetAllOnlineNodeInfo(&info, &infoNum) != SOFTBUS_OK) {
LNN_LOGE(LNN_HEART_BEAT, "get all online node info fail");
return SOFTBUS_ERR;
}
if (info == NULL || infoNum == 0) {
LNN_LOGD(LNN_HEART_BEAT, "none online node");
return SOFTBUS_ERR;
}
int32_t ret = LnnGetAllOnlineNodeInfo(&info, &infoNum);
LNN_CHECK_AND_RETURN_RET_LOGE(ret == SOFTBUS_OK, SOFTBUS_NETWORK_GET_ALL_NODE_INFO_ERR, LNN_HEART_BEAT,
"get all online node info fail");
LNN_CHECK_AND_RETURN_RET_LOGE(info != NULL, SOFTBUS_NO_ONLINE_DEVICE, LNN_HEART_BEAT, "none online node");
LNN_CHECK_AND_RETURN_RET_LOGE(infoNum != 0, SOFTBUS_NO_ONLINE_DEVICE, LNN_HEART_BEAT, "none online node");
DiscoveryType discType = LnnConvAddrTypeToDiscType(recvAddrType);
for (int32_t i = 0; i < infoNum; ++i) {
if (LnnIsLSANode(&info[i])) {
@ -237,7 +233,7 @@ static int32_t HbGetOnlineNodeByRecvInfo(
char *anonyNetworkId = NULL;
Anonymize(info[i].networkId, &anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "node online not have discType. networkId=%{public}s, discType=%{public}d",
anonyNetworkId, discType);
AnonymizeWrapper(anonyNetworkId), discType);
AnonymizeFree(anonyNetworkId);
continue;
}
@ -250,8 +246,8 @@ static int32_t HbGetOnlineNodeByRecvInfo(
char *anonyUdid = NULL;
Anonymize(udidHash, &anonyUdid);
Anonymize(info[i].networkId, &anonyNetworkId);
LNN_LOGD(
LNN_HEART_BEAT, "node is online. udidHash=%{public}s, networkId=%{public}s", anonyUdid, anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "node is online. udidHash=%{public}s, networkId=%{public}s",
AnonymizeWrapper(anonyUdid), AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
AnonymizeFree(anonyUdid);
UpdateOnlineInfoNoConnection(info[i].networkId, hbResp);
@ -270,32 +266,32 @@ static int32_t HbUpdateOfflineTimingByRecvInfo(
char *anonyNetworkId = NULL;
if (LnnGetDLHeartbeatTimestamp(networkId, &oldTimestamp) != SOFTBUS_OK) {
Anonymize(networkId, &anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "get timestamp err, networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "get timestamp err, networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_ERR;
}
if (LnnSetDLHeartbeatTimestamp(networkId, updateTime) != SOFTBUS_OK) {
Anonymize(networkId, &anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "update timestamp err, networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "update timestamp err, networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_ERR;
}
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_HEART_BEAT,
"recv to update timestamp, networkId=%{public}s, timestamp:%{public}" PRIu64 "->%{public}" PRIu64,
anonyNetworkId, oldTimestamp, updateTime);
AnonymizeWrapper(anonyNetworkId), oldTimestamp, updateTime);
if (hbType != HEARTBEAT_TYPE_BLE_V1 && hbType != HEARTBEAT_TYPE_BLE_V0) {
LNN_LOGD(LNN_HEART_BEAT, "only BLE_V1 and BLE_V0 support offline timing");
AnonymizeFree(anonyNetworkId);
return SOFTBUS_ERR;
}
if (LnnStopOfflineTimingStrategy(networkId, type) != SOFTBUS_OK) {
LNN_LOGE(LNN_HEART_BEAT, "remove offline check err, networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "remove offline check err, networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_ERR;
}
if (LnnStartOfflineTimingStrategy(networkId, type) != SOFTBUS_OK) {
LNN_LOGE(LNN_HEART_BEAT, "set new offline check err, networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_HEART_BEAT, "set new offline check err, networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_ERR;
}
@ -356,8 +352,9 @@ static bool HbIsNeedReAuth(const NodeInfo *nodeInfo, const char *newAccountHash)
char *anonyNetworkId = NULL;
Anonymize(nodeInfo->networkId, &anonyNetworkId);
LNN_LOGI(LNN_HEART_BEAT,
"peer networkId=%{public}s, accountHash:%{public}02X%{public}02X->%{public}02X%{public}02X", anonyNetworkId,
nodeInfo->accountHash[0], nodeInfo->accountHash[1], newAccountHash[0], newAccountHash[1]);
"peer networkId=%{public}s, accountHash:%{public}02X%{public}02X->%{public}02X%{public}02X",
AnonymizeWrapper(anonyNetworkId), nodeInfo->accountHash[0], nodeInfo->accountHash[1],
newAccountHash[0], newAccountHash[1]);
AnonymizeFree(anonyNetworkId);
return memcmp(nodeInfo->accountHash, newAccountHash, HB_SHORT_ACCOUNT_HASH_LEN) != 0;
}
@ -372,7 +369,8 @@ static void HbDumpRecvDeviceInfo(
"heartbeat(HB) OnTock, udidHash=%{public}s, accountHash=%{public}02X%{public}02X, hbType=%{public}d, "
"devTypeStr=%{public}s, peerWeight=%{public}d, masterWeight=%{public}d, devTypeHex=%{public}02X, "
"ConnectionAddrType=%{public}d, nowTime=%{public}" PRIu64,
anonyUdid, device->accountHash[0], device->accountHash[1], hbType, devTypeStr != NULL ? devTypeStr : "", weight,
AnonymizeWrapper(anonyUdid), device->accountHash[0], device->accountHash[1],
hbType, devTypeStr != NULL ? devTypeStr : "", weight,
masterWeight, device->devType, device->addr[0].type, nowTime);
AnonymizeFree(anonyUdid);
}
@ -565,7 +563,8 @@ static bool HbIsValidJoinLnnRequest(DeviceInfo *device, HbRespData *hbResp)
if ((nodeInfo.feature & (1 << BIT_SUPPORT_THREE_STATE)) == 0 && SoftBusGetBrState() == BR_DISABLE) {
char *anonyUdid = NULL;
Anonymize(device->devId, &anonyUdid);
LNN_LOGI(LNN_HEART_BEAT, "peer udidHash=%{public}s don't support three state and local br off", anonyUdid);
LNN_LOGI(LNN_HEART_BEAT, "peer udidHash=%{public}s don't support three state and local br off",
AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
return false;
}
@ -692,8 +691,8 @@ static int32_t SoftBusNetNodeResult(DeviceInfo *device, HbRespData *hbResp,
Anonymize(device->devId, &anonyUdid);
LNN_LOGI(LNN_HEART_BEAT,
"heartbeat(HB) find device, udidHash=%{public}s, ConnectionAddrType=%{public}02X, isConnect=%{public}d, "
"connectReason=%{public}u",
anonyUdid, device->addr[0].type, connectCondition->isConnect, connectCondition->connectReason);
"connectReason=%{public}u", AnonymizeWrapper(anonyUdid),
device->addr[0].type, connectCondition->isConnect, connectCondition->connectReason);
AnonymizeFree(anonyUdid);
LnnDfxDeviceInfoReport info;
@ -781,7 +780,7 @@ static int32_t HbSuspendReAuth(DeviceInfo *device)
char *anonyUdidHash = NULL;
Anonymize(udidHash, &anonyUdidHash);
LNN_LOGI(LNN_HEART_BEAT, "current device need delay authentication, type=%{public}d, udidHash=%{public}s",
device->addr[0].type, anonyUdidHash);
device->addr[0].type, AnonymizeWrapper(anonyUdidHash));
AnonymizeFree(anonyUdidHash);
return SOFTBUS_NETWORK_BLE_CONNECT_SUSPEND;
}
@ -957,7 +956,7 @@ static int32_t HbMediumMgrRecvProcess(DeviceInfo *device, const LnnHeartbeatWeig
Anonymize(device->devId, &anonyUdid);
LNN_LOGW(LNN_HEART_BEAT,
">> heartbeat(HB) OnTock is not potential trusted, udid=%{public}s, accountHash=%{public}02X%{public}02X",
anonyUdid, device->accountHash[0], device->accountHash[1]);
AnonymizeWrapper(anonyUdid), device->accountHash[0], device->accountHash[1]);
AnonymizeFree(anonyUdid);
return SOFTBUS_NETWORK_HEARTBEAT_UNTRUSTED;
}
@ -980,7 +979,8 @@ static int32_t HbMediumMgrRecvHigherWeight(
if (HbGetOnlineNodeByRecvInfo(udidHash, type, &nodeInfo, NULL) != SOFTBUS_OK) {
char *anonyUdid = NULL;
Anonymize(udidHash, &anonyUdid);
LNN_LOGD(LNN_HEART_BEAT, "recv higher weight is not online yet. udidhash=%{public}s", anonyUdid);
LNN_LOGD(LNN_HEART_BEAT, "recv higher weight is not online yet. udidhash=%{public}s",
AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
return SOFTBUS_OK;
}
@ -1002,7 +1002,7 @@ static int32_t HbMediumMgrRecvHigherWeight(
char *anonyMasterUdid = NULL;
Anonymize(masterUdid, &anonyMasterUdid);
LNN_LOGI(LNN_HEART_BEAT, "recv higher weight udidHash=%{public}s, weight=%{public}d, masterUdid=%{public}s",
anonyUdid, weight, anonyMasterUdid);
AnonymizeWrapper(anonyUdid), weight, AnonymizeWrapper(anonyMasterUdid));
AnonymizeFree(anonyUdid);
AnonymizeFree(anonyMasterUdid);
return SOFTBUS_OK;
@ -1025,7 +1025,8 @@ static void HbMediumMgrRelayProcess(const char *udidHash, ConnectionAddrType typ
}
char *anonyUdid = NULL;
Anonymize(udidHash, &anonyUdid);
LNN_LOGD(LNN_HEART_BEAT, "mgr relay process, udidhash=%{public}s, hbType=%{public}d", anonyUdid, hbType);
LNN_LOGD(LNN_HEART_BEAT, "mgr relay process, udidhash=%{public}s, hbType=%{public}d",
AnonymizeWrapper(anonyUdid), hbType);
AnonymizeFree(anonyUdid);
if (LnnStartHbByTypeAndStrategy(hbType | HEARTBEAT_TYPE_BLE_V3, STRATEGY_HB_SEND_SINGLE, true) != SOFTBUS_OK) {
LNN_LOGE(LNN_HEART_BEAT, "mgr relay process fail");
@ -1115,7 +1116,7 @@ void LnnDumpHbMgrRecvList(void)
deviceType = LnnConvertIdToDeviceType((uint16_t)item->device->devType);
if (deviceType == NULL) {
Anonymize(item->device->devId, &anonyUdid);
LNN_LOGE(LNN_HEART_BEAT, "get deviceType fail, udidHash=%{public}s", anonyUdid);
LNN_LOGE(LNN_HEART_BEAT, "get deviceType fail, udidHash=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
continue;
}
@ -1123,8 +1124,8 @@ void LnnDumpHbMgrRecvList(void)
LNN_LOGD(LNN_HEART_BEAT,
"DumpRecvList count=%{public}d, i=%{public}d, udidHash=%{public}s, deviceType=%{public}s, "
"ConnectionAddrType=%{public}02X, weight=%{public}d, masterWeight=%{public}d, "
"lastRecvTime=%{public}" PRIu64,
g_hbRecvList->cnt, dumpCount, anonyUdid, deviceType, item->device->addr[0].type, item->weight,
"lastRecvTime=%{public}" PRIu64, g_hbRecvList->cnt, dumpCount,
AnonymizeWrapper(anonyUdid), deviceType, item->device->addr[0].type, item->weight,
item->masterWeight, item->lastRecvTime);
AnonymizeFree(anonyUdid);
}
@ -1166,7 +1167,7 @@ void LnnDumpHbOnlineNodeList(void)
"DumpOnlineNodeList count=%{public}d, i=%{public}d, deviceName=%{public}s, deviceTypeId=%{public}d, "
"deviceTypeStr=%{public}s, masterWeight=%{public}d, discoveryType=%{public}d, "
"oldTimestamp=%{public}" PRIu64 "",
infoNum, i + 1, anonyDeviceName, nodeInfo.deviceInfo.deviceTypeId,
infoNum, i + 1, AnonymizeWrapper(anonyDeviceName), nodeInfo.deviceInfo.deviceTypeId,
deviceTypeStr != NULL ? deviceTypeStr : "", nodeInfo.masterWeight, nodeInfo.discoveryType, oldTimestamp);
AnonymizeFree(anonyDeviceName);
}

View File

@ -939,7 +939,8 @@ int32_t LnnStartOfflineTimingStrategy(const char *networkId, ConnectionAddrType
char *anonyNetworkId = NULL;
if (LnnIsSupportBurstFeature(networkId)) {
Anonymize(networkId, &anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "%{public}s support burst, dont't need post offline info", anonyNetworkId);
LNN_LOGD(LNN_HEART_BEAT, "%{public}s support burst, dont't need post offline info",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_OK;
}

View File

@ -196,7 +196,7 @@ bool LnnHasActiveConnection(const char *networkId, ConnectionAddrType addrType)
LNN_LOGI(LNN_HEART_BEAT,
"HB check active connection networkId=%{public}s, "
"BR=%{public}d, BLE=%{public}d, P2P=%{public}d, HML=%{public}d",
anonyNetworkId, hasBrConn, hasBleConn, hasP2pConn, hasHmlConn);
AnonymizeWrapper(anonyNetworkId), hasBrConn, hasBleConn, hasP2pConn, hasHmlConn);
AnonymizeFree(anonyNetworkId);
return hasBrConn || hasBleConn || hasP2pConn || hasHmlConn;
default:
@ -318,7 +318,7 @@ int32_t LnnGenerateBtMacHash(const char *btMac, int32_t brMacLen, char *brMacHas
}
char *anonyMac = NULL;
Anonymize(brMacUpper, &anonyMac);
LNN_LOGI(LNN_HEART_BEAT, "upper BrMac=**:**:**:**:%{public}s", anonyMac);
LNN_LOGI(LNN_HEART_BEAT, "upper BrMac=**:**:**:**:%{public}s", AnonymizeWrapper(anonyMac));
AnonymizeFree(anonyMac);
if (SoftBusGenerateStrHash((const unsigned char *)brMacUpper, strlen(brMacUpper), (unsigned char *)hash)) {
LNN_LOGE(LNN_HEART_BEAT, "Generate brMac hash fail");
@ -334,7 +334,7 @@ int32_t LnnGenerateBtMacHash(const char *btMac, int32_t brMacLen, char *brMacHas
}
char *anonyUdid = NULL;
Anonymize(brMacHash, &anonyUdid);
LNN_LOGI(LNN_HEART_BEAT, "brmacHash=%{public}s", anonyUdid);
LNN_LOGI(LNN_HEART_BEAT, "brmacHash=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
return SOFTBUS_OK;
}
@ -392,9 +392,9 @@ void LnnDumpLocalBasicInfo(void)
Anonymize(localUuid, &anonyUuid);
Anonymize(localUdid, &anonyUdid);
Anonymize(localInfo.networkId, &anonyNetworkId);
LNN_LOGW(LNN_HEART_BEAT,
"local DeviceInfo, uuid=%{public}s, udid=%{public}s, udidShortHash=%{public}s, networkId=%{public}s",
anonyUuid, anonyUdid, anonyUdidHash, anonyNetworkId);
LNN_LOGW(LNN_HEART_BEAT, "local DeviceInfo, uuid=%{public}s, udid=%{public}s, udidShortHash=%{public}s, "
"networkId=%{public}s", AnonymizeWrapper(anonyUuid), AnonymizeWrapper(anonyUdid),
AnonymizeWrapper(anonyUdidHash), AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyUuid);
AnonymizeFree(anonyUdid);
AnonymizeFree(anonyUdidHash);
@ -408,10 +408,10 @@ void LnnDumpLocalBasicInfo(void)
Anonymize(localBtMac, &anonyBtMac);
Anonymize(localP2PMac, &anonyP2pMac);
Anonymize(localInfo.deviceName, &anonyDeviceName);
LNN_LOGI(LNN_HEART_BEAT,
"devType=%{public}s, deviceTypeId=%{public}hu, deviceName=%{public}s, ip=..%{public}s, brMac=::%{public}s, "
"p2pMac=::%{public}s, onlineNodeNum=%{public}d",
devTypeStr, localInfo.deviceTypeId, anonyDeviceName, anonyIp, anonyBtMac, anonyP2pMac, onlineNodeNum);
LNN_LOGI(LNN_HEART_BEAT, "devType=%{public}s, deviceTypeId=%{public}hu, deviceName=%{public}s, ip=..%{public}s, "
"brMac=::%{public}s, p2pMac=::%{public}s, onlineNodeNum=%{public}d", devTypeStr, localInfo.deviceTypeId,
AnonymizeWrapper(anonyDeviceName), AnonymizeWrapper(anonyIp), AnonymizeWrapper(anonyBtMac),
AnonymizeWrapper(anonyP2pMac), onlineNodeNum);
AnonymizeFree(anonyDeviceName);
AnonymizeFree(anonyIp);
AnonymizeFree(anonyBtMac);
@ -427,7 +427,7 @@ static int32_t LnnDumpPrintUdid(const char *networkId)
}
char *tmpUdid = NULL;
Anonymize(udid, &tmpUdid);
LNN_LOGI(LNN_HEART_BEAT, "Udid=%{public}s", tmpUdid);
LNN_LOGI(LNN_HEART_BEAT, "Udid=%{public}s", AnonymizeWrapper(tmpUdid));
AnonymizeFree(tmpUdid);
return SOFTBUS_OK;
}
@ -441,7 +441,7 @@ static int32_t LnnDumpPrintUuid(const char *networkId)
}
char *tmpUuid = NULL;
Anonymize(uuid, &tmpUuid);
LNN_LOGI(LNN_HEART_BEAT, "Uuid=%{public}s", tmpUuid);
LNN_LOGI(LNN_HEART_BEAT, "Uuid=%{public}s", AnonymizeWrapper(tmpUuid));
AnonymizeFree(tmpUuid);
return SOFTBUS_OK;
}
@ -455,7 +455,7 @@ static int32_t LnnDumpPrintMac(const char *networkId)
}
char *tmpBrMac = NULL;
Anonymize(brMac, &tmpBrMac);
LNN_LOGI(LNN_HEART_BEAT, "BrMac=%{public}s", tmpBrMac);
LNN_LOGI(LNN_HEART_BEAT, "BrMac=%{public}s", AnonymizeWrapper(tmpBrMac));
AnonymizeFree(tmpBrMac);
return SOFTBUS_OK;
}
@ -469,7 +469,7 @@ static int32_t LnnDumpPrintIp(const char *networkId)
}
char *tmpIpAddr = NULL;
Anonymize(ipAddr, &tmpIpAddr);
LNN_LOGI(LNN_HEART_BEAT, "IpAddr=%{public}s", tmpIpAddr);
LNN_LOGI(LNN_HEART_BEAT, "IpAddr=%{public}s", AnonymizeWrapper(tmpIpAddr));
AnonymizeFree(tmpIpAddr);
return SOFTBUS_OK;
}
@ -504,11 +504,11 @@ static void LnnDumpOnlinePrintInfo(NodeBasicInfo *nodeInfo)
}
char *anonyDeviceName = NULL;
Anonymize(nodeInfo->deviceName, &anonyDeviceName);
LNN_LOGI(LNN_HEART_BEAT, "DeviceName=%{public}s", anonyDeviceName);
LNN_LOGI(LNN_HEART_BEAT, "DeviceName=%{public}s", AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyDeviceName);
char *tmpNetWorkId = NULL;
Anonymize(nodeInfo->networkId, &tmpNetWorkId);
LNN_LOGI(LNN_HEART_BEAT, "NetworkId=%{public}s", tmpNetWorkId);
LNN_LOGI(LNN_HEART_BEAT, "NetworkId=%{public}s", AnonymizeWrapper(tmpNetWorkId));
AnonymizeFree(tmpNetWorkId);
if (LnnDumpPrintUdid(nodeInfo->networkId) != SOFTBUS_OK) {
LNN_LOGE(LNN_HEART_BEAT, "LnnDumpPrintUdid failed");

View File

@ -1067,7 +1067,7 @@ static int32_t BleDirectOnline(LnnConntionInfo *connInfo, AuthConnInfo *authConn
(const unsigned char *)connInfo->addr.info.ble.udidHash, HB_SHORT_UDID_HASH_LEN);
char *anonyUdidHash = NULL;
Anonymize(udidHash, &anonyUdidHash);
LNN_LOGI(LNN_BUILDER, "join udidHash=%{public}s", anonyUdidHash);
LNN_LOGI(LNN_BUILDER, "join udidHash=%{public}s", AnonymizeWrapper(anonyUdidHash));
AnonymizeFree(anonyUdidHash);
if (ret == SOFTBUS_OK) {
if ((dupOk || LnnRetrieveDeviceInfo(udidHash, deviceInfo) == SOFTBUS_OK) &&
@ -1280,7 +1280,8 @@ static bool IsBasicNodeInfoChanged(const NodeInfo *oldNodeInfo, const NodeInfo *
char *oldNetworkId = NULL;
Anonymize(newNodeInfo->networkId, &newNetworkId);
Anonymize(oldNodeInfo->networkId, &oldNetworkId);
LNN_LOGI(LNN_BUILDER, "networkId changed %{public}s -> %{public}s", oldNetworkId, newNetworkId);
LNN_LOGI(LNN_BUILDER, "networkId changed %{public}s -> %{public}s",
AnonymizeWrapper(oldNetworkId), AnonymizeWrapper(newNetworkId));
AnonymizeFree(newNetworkId);
AnonymizeFree(oldNetworkId);
if (isUpdate) {
@ -1293,7 +1294,8 @@ static bool IsBasicNodeInfoChanged(const NodeInfo *oldNodeInfo, const NodeInfo *
char *oldUuid = NULL;
Anonymize(newNodeInfo->uuid, &newUuid);
Anonymize(oldNodeInfo->uuid, &oldUuid);
LNN_LOGI(LNN_BUILDER, "uuid changed %{public}s -> %{public}s", oldUuid, newUuid);
LNN_LOGI(LNN_BUILDER, "uuid changed %{public}s -> %{public}s",
AnonymizeWrapper(oldUuid), AnonymizeWrapper(newUuid));
AnonymizeFree(newUuid);
AnonymizeFree(oldUuid);
return true;
@ -1303,7 +1305,8 @@ static bool IsBasicNodeInfoChanged(const NodeInfo *oldNodeInfo, const NodeInfo *
char *oldSoftBusVersion = NULL;
Anonymize(newNodeInfo->softBusVersion, &newSoftBusVersion);
Anonymize(oldNodeInfo->softBusVersion, &oldSoftBusVersion);
LNN_LOGI(LNN_BUILDER, "uuid changed %{public}s -> %{public}s", oldSoftBusVersion, newSoftBusVersion);
LNN_LOGI(LNN_BUILDER, "uuid changed %{public}s -> %{public}s",
AnonymizeWrapper(oldSoftBusVersion), AnonymizeWrapper(newSoftBusVersion));
AnonymizeFree(newSoftBusVersion);
AnonymizeFree(oldSoftBusVersion);
}
@ -1321,7 +1324,8 @@ static bool IsWifiConnectInfoChanged(const NodeInfo *oldNodeInfo, const NodeInfo
char *oldIp = NULL;
Anonymize(newNodeInfo->connectInfo.deviceIp, &newIp);
Anonymize(oldNodeInfo->connectInfo.deviceIp, &oldIp);
LNN_LOGI(LNN_BUILDER, "peer ip changed %{public}s -> %{public}s", oldIp, newIp);
LNN_LOGI(LNN_BUILDER, "peer ip changed %{public}s -> %{public}s",
AnonymizeWrapper(oldIp), AnonymizeWrapper(newIp));
AnonymizeFree(newIp);
AnonymizeFree(oldIp);
return true;
@ -1466,8 +1470,9 @@ static void OnlineStateEnter(FsmStateMachine *fsm)
LNN_LOGI(LNN_BUILDER,
"online state enter. [id=%{public}u], networkId=%{public}s, udid=%{public}s, "
"uuid=%{public}s, deviceName=%{public}s, peer%{public}s",
connFsm->id, anonyNetworkId, isNodeInfoValid ? anonyUdid : "", isNodeInfoValid ? anonyUuid : "",
isNodeInfoValid ? anonyDeviceName : "",
connFsm->id, anonyNetworkId, isNodeInfoValid ? AnonymizeWrapper(anonyUdid) : "",
isNodeInfoValid ? AnonymizeWrapper(anonyUuid) : "",
isNodeInfoValid ? AnonymizeWrapper(anonyDeviceName) : "",
LnnPrintConnectionAddr(&connFsm->connInfo.addr));
if (isNodeInfoValid) {
AnonymizeFree(anonyUdid);
@ -1582,8 +1587,8 @@ static void LeavingStateEnter(FsmStateMachine *fsm)
LNN_LOGI(LNN_BUILDER,
"leaving state enter. [id=%{public}u], networkId=%{public}s, udid=%{public}s, deviceName=%{public}s, "
"peer%{public}s",
connFsm->id, anonyNetworkId, isNodeInfoValid ? anonyUdid : "",
isNodeInfoValid ? anonyDeviceName : "",
connFsm->id, anonyNetworkId, isNodeInfoValid ? AnonymizeWrapper(anonyUdid) : "",
isNodeInfoValid ? AnonymizeWrapper(anonyDeviceName) : "",
LnnPrintConnectionAddr(&connFsm->connInfo.addr));
if (isNodeInfoValid) {
AnonymizeFree(anonyUdid);

View File

@ -91,7 +91,7 @@ static int32_t DBDeviceNameInfoSyncToCache(NodeInfo *cacheInfo, char *fieldName,
}
char *anonyDeviceName = NULL;
Anonymize(cacheInfo->deviceInfo.deviceName, &anonyDeviceName);
LNN_LOGI(LNN_BUILDER, "success. deviceName=%{public}s", anonyDeviceName);
LNN_LOGI(LNN_BUILDER, "success. deviceName=%{public}s", AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyDeviceName);
} else if (strcmp(fieldName, DEVICE_INFO_UNIFIED_DEVICE_NAME) == 0 && valueLength < DEVICE_NAME_BUF_LEN) {
if (strcpy_s(cacheInfo->deviceInfo.unifiedName, DEVICE_NAME_BUF_LEN, value) != EOK) {
@ -124,7 +124,7 @@ static int32_t DBDeviceBasicInfoSyncToCache(NodeInfo *cacheInfo, char *fieldName
}
char *anonyUdid = NULL;
Anonymize(cacheInfo->deviceInfo.deviceUdid, &anonyUdid);
LNN_LOGI(LNN_BUILDER, "success, udid=%{public}s", anonyUdid);
LNN_LOGI(LNN_BUILDER, "success, udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
} else if (strcmp(fieldName, DEVICE_INFO_DEVICE_TYPE) == 0) {
cacheInfo->deviceInfo.deviceTypeId = atoi(value);
@ -142,7 +142,7 @@ static int32_t DBDeviceBasicInfoSyncToCache(NodeInfo *cacheInfo, char *fieldName
}
char *anoyUuid = NULL;
Anonymize(cacheInfo->uuid, &anoyUuid);
LNN_LOGI(LNN_BUILDER, "success, uuid=%{public}s", anoyUuid);
LNN_LOGI(LNN_BUILDER, "success, uuid=%{public}s", AnonymizeWrapper(anoyUuid));
AnonymizeFree(anoyUuid);
} else if (DBDeviceNameInfoSyncToCache(cacheInfo, fieldName, value, valueLength) != SOFTBUS_OK) {
LNN_LOGE(LNN_BUILDER, "fail:DB device name info sync to cache fail");
@ -222,7 +222,7 @@ static int32_t DBConnectInfoSyncToCache(NodeInfo *cacheInfo, char *fieldName, co
}
char *anonyNetworkId = NULL;
Anonymize(cacheInfo->networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "success. networkId=%{public}s", anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "success. networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
} else if (strcmp(fieldName, DEVICE_INFO_PKG_VERSION) == 0 && valueLength < VERSION_MAX_LEN) {
if (strcpy_s(cacheInfo->pkgVersion, VERSION_MAX_LEN, value) != EOK) {
@ -627,7 +627,7 @@ static int32_t HandleDBUpdateChangeInternal(const char *key, const char *value)
Anonymize(trueValue, &anonyTrueValue);
LNN_LOGI(LNN_BUILDER,
"deviceUdid=%{public}s, fieldName=%{public}s update to %{public}s success, stateVersion=%{public}d",
anonyDeviceUdid, fieldName, anonyTrueValue, parseValue.stateVersion);
AnonymizeWrapper(anonyDeviceUdid), fieldName, AnonymizeWrapper(anonyTrueValue), parseValue.stateVersion);
AnonymizeFree(anonyDeviceUdid);
AnonymizeFree(anonyTrueValue);
(void)memset_s(trueValue, strlen(trueValue), 0, strlen(trueValue));
@ -726,7 +726,8 @@ int32_t LnnDBDataAddChangeSyncToCache(const char **key, const char **value, int3
Anonymize(cacheInfo.deviceInfo.deviceUdid, &anonyUdid);
LNN_LOGI(LNN_BUILDER,
"success. udid=%{public}s, stateVersion=%{public}d, localStateVersion=%{public}d, updateTimestamp=%{public}"
"" PRIu64, anonyUdid, cacheInfo.stateVersion, cacheInfo.localStateVersion, cacheInfo.updateTimestamp);
"" PRIu64, AnonymizeWrapper(anonyUdid), cacheInfo.stateVersion, cacheInfo.localStateVersion,
cacheInfo.updateTimestamp);
AnonymizeFree(anonyUdid);
if (LnnUpdateDistributedNodeInfo(&cacheInfo, cacheInfo.deviceInfo.deviceUdid) != SOFTBUS_OK) {
LNN_LOGE(LNN_BUILDER, "fail:Cache info add sync to Ledger fail");
@ -771,12 +772,14 @@ static void PrintSyncNodeInfo(const NodeInfo *cacheInfo)
"BROADCAST_CIPHER_IV=%{public}02x, IRK=%{public}02x, PUB_MAC=%{public}02x, PTK=%{public}02x, "
"DEVICE_VERSION=%{public}s",
cacheInfo->wifiVersion, cacheInfo->bleVersion, AnonymizeWrapper(anonyAccountId), cacheInfo->supportedProtocols,
cacheInfo->feature, cacheInfo->connSubFeature, cacheInfo->updateTimestamp, anonyP2pMac, cacheInfo->pkgVersion,
anonyDeviceName, cacheInfo->authCapacity, cacheInfo->heartbeatCapacity, cacheInfo->deviceInfo.osType,
cacheInfo->deviceInfo.osVersion, cacheInfo->isBleP2p, anonyMacAddr, cacheInfo->deviceInfo.deviceTypeId,
cacheInfo->softBusVersion, anonyUdid, anonyUuid, anonyNetworkId, cacheInfo->stateVersion,
*cacheInfo->cipherInfo.key, *cacheInfo->cipherInfo.iv, *cacheInfo->rpaInfo.peerIrk,
*cacheInfo->rpaInfo.publicAddress, *cacheInfo->remotePtk, anonyDeviceVersion);
cacheInfo->feature, cacheInfo->connSubFeature, cacheInfo->updateTimestamp, AnonymizeWrapper(anonyP2pMac),
cacheInfo->pkgVersion, AnonymizeWrapper(anonyDeviceName), cacheInfo->authCapacity,
cacheInfo->heartbeatCapacity, cacheInfo->deviceInfo.osType, cacheInfo->deviceInfo.osVersion,
cacheInfo->isBleP2p, AnonymizeWrapper(anonyMacAddr), cacheInfo->deviceInfo.deviceTypeId,
cacheInfo->softBusVersion, AnonymizeWrapper(anonyUdid), AnonymizeWrapper(anonyUuid),
AnonymizeWrapper(anonyNetworkId), cacheInfo->stateVersion, *cacheInfo->cipherInfo.key,
*cacheInfo->cipherInfo.iv, *cacheInfo->rpaInfo.peerIrk, *cacheInfo->rpaInfo.publicAddress,
*cacheInfo->remotePtk, AnonymizeWrapper(anonyDeviceVersion));
AnonymizeFree(anonyAccountId);
AnonymizeFree(anonyP2pMac);
AnonymizeFree(anonyMacAddr);
@ -912,7 +915,8 @@ static int32_t LnnSaveAndUpdateDistributedNode(NodeInfo *cacheInfo, NodeInfo *ol
Anonymize(cacheInfo->deviceInfo.deviceUdid, &anonyUdid);
LNN_LOGI(LNN_BUILDER,
"success. udid=%{public}s, stateVersion=%{public}d, localStateVersion=%{public}d, updateTimestamp=%{public}"
"" PRIu64, anonyUdid, cacheInfo->stateVersion, cacheInfo->localStateVersion, cacheInfo->updateTimestamp);
"" PRIu64, AnonymizeWrapper(anonyUdid), cacheInfo->stateVersion,
cacheInfo->localStateVersion, cacheInfo->updateTimestamp);
AnonymizeFree(anonyUdid);
if (LnnUpdateDistributedNodeInfo(cacheInfo, cacheInfo->deviceInfo.deviceUdid) != SOFTBUS_OK) {
LNN_LOGE(LNN_BUILDER, "fail:Cache info sync to Ledger fail");
@ -1173,7 +1177,7 @@ int32_t LnnDeleteDevInfoSyncToDB(const char *udid, int64_t accountId)
}
char *anonyUdid = NULL;
Anonymize(udid, &anonyUdid);
LNN_LOGI(LNN_BUILDER, "delete udid=%{public}s success.", anonyUdid);
LNN_LOGI(LNN_BUILDER, "delete udid=%{public}s success.", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
return SOFTBUS_OK;
}

View File

@ -124,7 +124,7 @@ static void OnReceiveDeviceName(LnnSyncInfoType type, const char *networkId, con
char *anonyDeviceName = NULL;
Anonymize(deviceName, &anonyDeviceName);
LNN_LOGI(LNN_BUILDER, "recv device name changed. deviceName=%{public}s, networkId=%{public}s",
anonyDeviceName, anonyNetworkId);
AnonymizeWrapper(anonyDeviceName), AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
AnonymizeFree(anonyDeviceName);
if (LnnConvertDlId(networkId, CATEGORY_NETWORK_ID, CATEGORY_UDID, udid, UDID_BUF_LEN) != SOFTBUS_OK) {
@ -185,7 +185,7 @@ static void SetDisplayName(char *displayName, const char *nickName, const NodeIn
}
char *anonyDeviceName = NULL;
Anonymize(displayName, &anonyDeviceName);
LNN_LOGI(LNN_BUILDER, "peer deviceName=%{public}s", anonyDeviceName);
LNN_LOGI(LNN_BUILDER, "peer deviceName=%{public}s", AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyDeviceName);
}
@ -195,7 +195,7 @@ static void NickNameMsgProc(const char *networkId, int64_t accountId, const char
LNN_CHECK_AND_RETURN_LOGE(localNodeInfo != NULL, LNN_BUILDER, "local devinfo nullptr");
char *anonyNickName = NULL;
Anonymize(nickName, &anonyNickName);
LNN_LOGI(LNN_BUILDER, "nickName is=%{public}s", anonyNickName);
LNN_LOGI(LNN_BUILDER, "nickName is=%{public}s", AnonymizeWrapper(anonyNickName));
AnonymizeFree(anonyNickName);
char displayName[DEVICE_NAME_BUF_LEN] = {0};
NodeInfo peerNodeInfo;
@ -223,7 +223,8 @@ static void NickNameMsgProc(const char *networkId, int64_t accountId, const char
Anonymize(peerNodeInfo.deviceInfo.deviceName, &anonyDeviceName);
LNN_LOGI(LNN_BUILDER, "peer unifiedDefaultName=%{public}s, nickName=%{public}s, "
"unifiedName=%{public}s, deviceName=%{public}s",
anonyUnifiedDefaultName, anonyNickName, anonyUnifiedName, anonyDeviceName);
AnonymizeWrapper(anonyUnifiedDefaultName), AnonymizeWrapper(anonyNickName),
AnonymizeWrapper(anonyUnifiedName), AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyUnifiedDefaultName);
AnonymizeFree(anonyNickName);
AnonymizeFree(anonyUnifiedName);
@ -422,6 +423,27 @@ static void AccountBootEventHandle(const char *key, const char *value, void *con
}
}
static void DumpLocalExtendDeviceName(const char *deviceName, const char *unifiedName, const char *unifiedDefaultName,
const char *nickName)
{
char *anonyDeviceName = NULL;
Anonymize(deviceName, &anonyDeviceName);
char *anonyUnifiedName = NULL;
Anonymize(unifiedName, &anonyUnifiedName);
char *anonyUnifiedDefaultName = NULL;
Anonymize(unifiedDefaultName, &anonyUnifiedDefaultName);
char *anonyNickName = NULL;
Anonymize(nickName, &anonyNickName);
LNN_LOGI(LNN_BUILDER, "UpdateLocalFromSetting done, deviceName=%{public}s, unifiedName=%{public}s, "
"unifiedDefaultName=%{public}s, nickName=%{public}s",
AnonymizeWrapper(anonyDeviceName), AnonymizeWrapper(anonyUnifiedName),
AnonymizeWrapper(anonyUnifiedDefaultName), AnonymizeWrapper(anonyNickName));
AnonymizeFree(anonyDeviceName);
AnonymizeFree(anonyUnifiedName);
AnonymizeFree(anonyUnifiedDefaultName);
AnonymizeFree(anonyNickName);
}
static void UpdataLocalFromSetting(void *p)
{
(void)p;
@ -464,21 +486,7 @@ static void UpdataLocalFromSetting(void *p)
RegisterNameMonitor();
DiscDeviceInfoChanged(TYPE_LOCAL_DEVICE_NAME);
LnnNotifyLocalNetworkIdChanged();
char *anonyDeviceName = NULL;
Anonymize(deviceName, &anonyDeviceName);
char *anonyUnifiedName = NULL;
Anonymize(unifiedName, &anonyUnifiedName);
char *anonyUnifiedDefaultName = NULL;
Anonymize(unifiedDefaultName, &anonyUnifiedDefaultName);
char *anonyNickName = NULL;
Anonymize(nickName, &anonyNickName);
LNN_LOGI(LNN_BUILDER, "UpdateLocalFromSetting done, deviceName=%{public}s, unifiedName=%{public}s, "
"unifiedDefaultName=%{public}s, nickName=%{public}s",
anonyDeviceName, anonyUnifiedName, anonyUnifiedDefaultName, anonyNickName);
AnonymizeFree(anonyDeviceName);
AnonymizeFree(anonyUnifiedName);
AnonymizeFree(anonyUnifiedDefaultName);
AnonymizeFree(anonyNickName);
DumpLocalExtendDeviceName(deviceName, unifiedName, unifiedDefaultName, nickName);
}
static void RegisterDeviceNameHandle(void)

View File

@ -171,7 +171,8 @@ int32_t SyncElectMessage(const char *networkId)
if (!IsNeedSyncElectMsg(networkId)) {
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGW(LNN_BUILDER, "no ip networking, dont sync elect msg, networkId=%{public}s", anonyNetworkId);
LNN_LOGW(LNN_BUILDER, "no ip networking, dont sync elect msg, networkId=%{public}s",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_OK;
}
@ -378,7 +379,8 @@ bool IsNeedWifiReauth(const char *networkId, const char *newAccountHash, int32_t
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "peer networkId=%{public}s, accountHash:%{public}02x%{public}02x->%{public}02x%{public}02x",
anonyNetworkId, info.accountHash[0], info.accountHash[1], newAccountHash[0], newAccountHash[1]);
AnonymizeWrapper(anonyNetworkId), info.accountHash[0], info.accountHash[1],
newAccountHash[0], newAccountHash[1]);
AnonymizeFree(anonyNetworkId);
uint8_t defaultAccountHash[SHA_256_HASH_LEN] = {0};
const char *defaultUserId = "0";
@ -517,7 +519,8 @@ void OnLnnProcessNotTrustedMsgDelay(void *para)
if (authSeq[type] == info->authSeq[type] && authSeq[type] != 0 && info->authSeq[type] != 0) {
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "networkId=%{public}s, LnnRequestLeaveSpecificType=%{public}d", anonyNetworkId, type);
LNN_LOGI(LNN_BUILDER, "networkId=%{public}s, LnnRequestLeaveSpecificType=%{public}d",
AnonymizeWrapper(anonyNetworkId), type);
AnonymizeFree(anonyNetworkId);
LnnRequestLeaveSpecific(networkId, LnnDiscTypeToConnAddrType((DiscoveryType)type));
continue;
@ -563,7 +566,8 @@ void LnnProcessCompleteNotTrustedMsg(LnnSyncInfoType syncType, const char *netwo
}
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "networkId=%{public}s, LnnRequestLeaveSpecificType=%{public}d", anonyNetworkId, type);
LNN_LOGI(LNN_BUILDER, "networkId=%{public}s, LnnRequestLeaveSpecificType=%{public}d",
AnonymizeWrapper(anonyNetworkId), type);
AnonymizeFree(anonyNetworkId);
LnnRequestLeaveSpecific(networkId, LnnDiscTypeToConnAddrType((DiscoveryType)type));
continue;
@ -604,18 +608,18 @@ const char *SelectUseUdid(const char *peerUdid, const char *lowerUdid)
char *anonyPeerUdid = NULL;
Anonymize(peerUdid, &anonyPeerUdid);
if (LnnGetOnlineStateById(peerUdid, CATEGORY_UDID)) {
LNN_LOGD(LNN_BUILDER, "not trusted device online! peerUdid=%{public}s", anonyPeerUdid);
LNN_LOGD(LNN_BUILDER, "not trusted device online! peerUdid=%{public}s", AnonymizeWrapper(anonyPeerUdid));
AnonymizeFree(anonyPeerUdid);
return peerUdid;
} else if (LnnGetOnlineStateById(lowerUdid, CATEGORY_UDID)) {
char *anonyLowerUdid = NULL;
Anonymize(peerUdid, &anonyLowerUdid);
LNN_LOGD(LNN_BUILDER, "not trusted device online! peerUdid=%{public}s", anonyLowerUdid);
LNN_LOGD(LNN_BUILDER, "not trusted device online! peerUdid=%{public}s", AnonymizeWrapper(anonyLowerUdid));
AnonymizeFree(anonyLowerUdid);
AnonymizeFree(anonyPeerUdid);
return lowerUdid;
} else {
LNN_LOGW(LNN_BUILDER, "not trusted device not online! peerUdid=%{public}s", anonyPeerUdid);
LNN_LOGW(LNN_BUILDER, "not trusted device not online! peerUdid=%{public}s", AnonymizeWrapper(anonyPeerUdid));
AnonymizeFree(anonyPeerUdid);
return NULL;
}
@ -848,7 +852,7 @@ void OnReceiveNodeAddrChangedMsg(LnnSyncInfoType type, const char *networkId, co
}
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "networkId=%{public}s", anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
LnnNodeAddr addr;
@ -1409,7 +1413,7 @@ bool IsExistLnnDfxNodeByUdidHash(const char *udidHash, LnnBleReportExtra *bleExt
}
char *anonyUdidHash = NULL;
Anonymize(udidHash, &anonyUdidHash);
LNN_LOGI(LNN_BUILDER, "device report node is exist, udidHash=%{public}s", anonyUdidHash);
LNN_LOGI(LNN_BUILDER, "device report node is exist, udidHash=%{public}s", AnonymizeWrapper(anonyUdidHash));
AnonymizeFree(anonyUdidHash);
return true;
}
@ -1481,7 +1485,7 @@ void AddNodeToPcRestrictMap(const char *udidHash)
(void)SoftBusMutexUnlock(&g_lnnDfxPcMutex);
char *anonyUdid = NULL;
Anonymize(udidHash, &anonyUdid);
LNN_LOGI(LNN_BUILDER, "add %{public}s to map succ", anonyUdid);
LNN_LOGI(LNN_BUILDER, "add %{public}s to map succ", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
}
@ -1518,7 +1522,7 @@ void DeleteNodeFromPcRestrictMap(const char *udidHash)
(void)SoftBusMutexUnlock(&g_lnnDfxPcMutex);
char *anonyUdid = NULL;
Anonymize(udidHash, &anonyUdid);
LNN_LOGI(LNN_BUILDER, "delete %{public}s from map succ", anonyUdid);
LNN_LOGI(LNN_BUILDER, "delete %{public}s from map succ", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
}
@ -1561,7 +1565,7 @@ int32_t UpdateNodeFromPcRestrictMap(const char *udidHash)
(void)SoftBusMutexUnlock(&g_lnnDfxPcMutex);
char *anonyUdid = NULL;
Anonymize(udidHash, &anonyUdid);
LNN_LOGI(LNN_BUILDER, "update %{public}s succ count=%{public}u", anonyUdid, *tempCount);
LNN_LOGI(LNN_BUILDER, "update %{public}s succ count=%{public}u", AnonymizeWrapper(anonyUdid), *tempCount);
AnonymizeFree(anonyUdid);
return SOFTBUS_OK;
}

View File

@ -414,7 +414,7 @@ void TryElectAsMasterState(const char *networkId, bool isOnline)
if (peerUdid == NULL) {
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "get invalid peerUdid, networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "get invalid peerUdid, networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return;
}
@ -424,7 +424,7 @@ void TryElectAsMasterState(const char *networkId, bool isOnline)
Anonymize(peerUdid, &anonyPeerUdid);
Anonymize(masterUdid, &anonyMasterUdid);
LNN_LOGD(LNN_BUILDER, "offline node is not master node. peerUdid=%{public}s, masterUdid=%{public}s",
anonyPeerUdid, anonyMasterUdid);
AnonymizeWrapper(anonyPeerUdid), AnonymizeWrapper(anonyMasterUdid));
AnonymizeFree(anonyPeerUdid);
AnonymizeFree(anonyMasterUdid);
return;

View File

@ -120,7 +120,8 @@ static void OnReceiveCapaSyncInfoMsg(LnnSyncInfoType type, const char *networkId
}
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "recv capability change=%{public}d, networkId=%{public}s", capability, anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "recv capability change=%{public}d, networkId=%{public}s",
capability, AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
// update ledger
NodeInfo info;
@ -186,7 +187,8 @@ static void DoSendCapability(NodeInfo nodeInfo, NodeBasicInfo netInfo, uint8_t *
char *anonyNetworkId = NULL;
Anonymize(netInfo.networkId, &anonyNetworkId);
LNN_LOGE(LNN_BUILDER,
"sync cap info ret=%{public}d, peerNetworkId=%{public}s, type=%{public}u.", ret, anonyNetworkId, type);
"sync cap info ret=%{public}d, peerNetworkId=%{public}s, type=%{public}u.",
ret, AnonymizeWrapper(anonyNetworkId), type);
AnonymizeFree(anonyNetworkId);
} else if ((type & (1 << (uint32_t)DISCOVERY_TYPE_WIFI)) != 0 && !LnnHasCapability(netCapability, BIT_BLE)) {
LnnSendP2pSyncInfoMsg(netInfo.networkId, netCapability);

View File

@ -217,7 +217,7 @@ static void ProcessSyncP2pInfo(void *para)
LnnSendSyncInfoMsg(LNN_INFO_TYPE_P2P_INFO, info[i].networkId, (uint8_t *)msg, len, NULL) != SOFTBUS_OK) {
char *anonyDeviceName = NULL;
Anonymize(info[i].deviceName, &anonyDeviceName);
LNN_LOGE(LNN_BUILDER, "sync p2p info fail. deviceName=%{public}s", anonyDeviceName);
LNN_LOGE(LNN_BUILDER, "sync p2p info fail. deviceName=%{public}s", AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyDeviceName);
}
}
@ -266,7 +266,8 @@ static void ProcessSyncWifiDirectAddr(void *para)
!= SOFTBUS_OK) {
char *anonyNetworkId = NULL;
Anonymize(info[i].networkId, &anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "sync wifidirect addr fail. anonyNetworkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "sync wifidirect addr fail. anonyNetworkId=%{public}s",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
}
}

View File

@ -397,7 +397,7 @@ static int32_t OnChannelOpened(int32_t channelId, const char *peerUuid, unsigned
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER,
"channelId=%{public}d, networkId=%{public}s, server=%{public}u",
channelId, anonyNetworkId, isServer);
channelId, AnonymizeWrapper(anonyNetworkId), isServer);
AnonymizeFree(anonyNetworkId);
info = FindSyncChannelInfoByNetworkId(networkId);
if (info == NULL) {
@ -461,7 +461,7 @@ static void OnChannelOpenFailed(int32_t channelId, const char *peerUuid)
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER,
"open channel fail. channelId=%{public}d, networkId=%{public}s",
channelId, anonyNetworkId);
channelId, AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
info = FindSyncChannelInfoByNetworkId(networkId);
if (info == NULL || (info->clientChannelId != channelId && info->serverChannelId != channelId)) {
@ -603,7 +603,8 @@ static int32_t CheckPeerAuthSeq(const char *uuid, int64_t peerAuthSeq)
Anonymize(udid, &anonyUdid);
if (peerAuthSeq == 0 || (peerAuthSeq != localAuthSeq[0] && peerAuthSeq != localAuthSeq[1])) {
LNN_LOGE(LNN_BUILDER, "authSeq is invalid, udid:%{public}s, local:%{public}" PRId64 ", %{public}"
PRId64 "peer:%{public}" PRId64 "", anonyUdid, localAuthSeq[0], localAuthSeq[1], peerAuthSeq);
PRId64 "peer:%{public}" PRId64 "", AnonymizeWrapper(anonyUdid),
localAuthSeq[0], localAuthSeq[1], peerAuthSeq);
AnonymizeFree(anonyUdid);
return SOFTBUS_ERR;
}
@ -637,7 +638,8 @@ static void BleOffLineProcess(const AuthTransData *data, AuthHandle authHandle)
CheckPeerAuthSeq(uuid, peerAuthSeq) != SOFTBUS_OK) {
char *anonyUuid = NULL;
Anonymize(uuid, &anonyUuid);
LNN_LOGW(LNN_BUILDER, "device has offline or get authId/authSeq fail, uuid:%{public}s", anonyUuid);
LNN_LOGW(LNN_BUILDER, "device has offline or get authId/authSeq fail, uuid:%{public}s",
AnonymizeWrapper(anonyUuid));
AnonymizeFree(anonyUuid);
return;
}
@ -645,9 +647,11 @@ static void BleOffLineProcess(const AuthTransData *data, AuthHandle authHandle)
Anonymize(networkId, &anonyNetworkId);
(void)LnnConvertDlId(uuid, CATEGORY_UUID, CATEGORY_NETWORK_ID, networkId, NETWORK_ID_BUF_LEN);
if (LnnRequestLeaveSpecific(networkId, CONNECTION_ADDR_BLE) != SOFTBUS_OK) {
LNN_LOGE(LNN_BUILDER, "request leave specific fail, networkId:%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "request leave specific fail, networkId:%{public}s",
AnonymizeWrapper(anonyNetworkId));
} else {
LNN_LOGD(LNN_BUILDER, "offline ble by p2p succ, networkId:%{public}s", anonyNetworkId);
LNN_LOGD(LNN_BUILDER, "offline ble by p2p succ, networkId:%{public}s",
AnonymizeWrapper(anonyNetworkId));
}
AnonymizeFree(anonyNetworkId);
}
@ -661,23 +665,23 @@ static bool CheckWifiOfflineMsgResult(const char *networkId, int32_t authPort, c
Anonymize(networkId, &anonyNetworkId);
if (LnnGetRemoteNumInfo(networkId, NUM_KEY_AUTH_PORT, &port) != 0) {
LNN_LOGE(LNN_BUILDER, "get remote port fail, neteorkId:%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "get remote port fail, neteorkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return false;
}
if (LnnGetNodeKeyInfo(networkId, NODE_KEY_BLE_OFFLINE_CODE, remoteOfflineCode, WIFI_OFFLINE_CODE_LEN) != 0) {
LNN_LOGE(LNN_BUILDER, "get remote offlinecode fail, neteorkId:%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "get remote offlinecode fail, neteorkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return false;
}
if (ConvertBytesToHexString(convertOfflineCode, WIFI_OFFLINE_CODE_LEN * HEXIFY_UNIT_LEN + 1,
(unsigned char *)remoteOfflineCode, WIFI_OFFLINE_CODE_LEN) != SOFTBUS_OK) {
LNN_LOGE(LNN_BUILDER, "coonvert offlinecode fail, neteorkId:%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "coonvert offlinecode fail, neteorkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return false;
}
if (strcmp(convertOfflineCode, offlineCode) != 0 || port != authPort) {
LNN_LOGE(LNN_BUILDER, "check offline msg info fail, neteorkId:%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "check offline msg info fail, neteorkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return false;
}
@ -708,7 +712,8 @@ static void WlanOffLineProcess(const AuthTransData *data, AuthHandle authHandle)
if (AuthGetDeviceUuid(authHandle.authId, uuid, UUID_BUF_LEN) != SOFTBUS_OK) {
char *anonyUuid = NULL;
Anonymize(uuid, &anonyUuid);
LNN_LOGW(LNN_BUILDER, "device has offline or get authId/authSeq fail, uuid:%{public}s", anonyUuid);
LNN_LOGW(LNN_BUILDER, "device has offline or get authId/authSeq fail, uuid:%{public}s",
AnonymizeWrapper(anonyUuid));
AnonymizeFree(anonyUuid);
return;
}
@ -719,9 +724,9 @@ static void WlanOffLineProcess(const AuthTransData *data, AuthHandle authHandle)
if (CheckWifiOfflineMsgResult(networkId, authPort, convertOfflineCode)) {
Anonymize(networkId, &anonyNetworkId);
if (LnnRequestLeaveSpecific(networkId, CONNECTION_ADDR_WLAN) != SOFTBUS_OK) {
LNN_LOGE(LNN_BUILDER, "wifi fast offline failed, networkId:%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "wifi fast offline failed, networkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
} else {
LNN_LOGI(LNN_BUILDER, "wifi fast offline success networkId:%{public}s", anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "wifi fast offline success networkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
}
AnonymizeFree(anonyNetworkId);
}
@ -816,7 +821,7 @@ static void OnWifiDirectSyncMsgRecv(AuthHandle authHandle, const AuthTransData *
}
char *anonyUdid = NULL;
Anonymize(auth->udid, &anonyUdid);
LNN_LOGI(LNN_BUILDER, "udid=%{public}s", anonyUdid);
LNN_LOGI(LNN_BUILDER, "udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
if (LnnGetNetworkIdByUdid(auth->udid, networkId, sizeof(networkId)) != SOFTBUS_OK) {
LNN_LOGE(LNN_BUILDER, "LnnGetNetworkIdByUdid fail");
@ -980,7 +985,7 @@ static int32_t SendSyncInfoByNewChannel(const char *networkId, SyncInfoMsg *msg)
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER,
"open sync info. channelId=%{public}d, networkId=%{public}s",
info->clientChannelId, anonyNetworkId);
info->clientChannelId, AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
SoftBusGetTime(&info->accessTime);
if (SoftBusMutexLock(&g_syncInfoManager.lock) != 0) {
@ -1026,7 +1031,7 @@ static int32_t TrySendSyncInfoMsg(const char *networkId, SyncInfoMsg *msg)
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER,
"send sync info by alread exists channel. channelId=%{public}d, networkId=%{public}s",
info->clientChannelId, anonyNetworkId);
info->clientChannelId, AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
ListTailInsert(&info->syncMsgList, &msg->node);
if (info->isClientOpened) {
@ -1049,7 +1054,8 @@ static int32_t GetWifiDirectAuthByNetworkId(const char *networkId, AuthHandle *a
(void)LnnConvertDlId(networkId, CATEGORY_NETWORK_ID, CATEGORY_UUID, uuid, UUID_BUF_LEN);
AuthDeviceGetLatestIdByUuid(uuid, AUTH_LINK_TYPE_ENHANCED_P2P, authHandle);
if (authHandle->authId != AUTH_INVALID_ID) {
LNN_LOGI(LNN_BUILDER, "find wifidirect authHandle, networkId=%{public}s", anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "find wifidirect authHandle, networkId=%{public}s",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_OK;
}
@ -1065,7 +1071,7 @@ static int32_t TrySendSyncInfoMsgByAuth(const char *networkId, SyncInfoMsg *msg)
.authId = AUTH_INVALID_ID
};
if (GetWifiDirectAuthByNetworkId(networkId, &authHandle) != SOFTBUS_OK) {
LNN_LOGE(LNN_BUILDER, "get authHandle fail, networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "get authHandle fail, networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_ERR;
}
@ -1192,13 +1198,13 @@ static int32_t GetAuthHandleByNetworkId(const char *networkId, AuthHandle *authH
(void)LnnConvertDlId(networkId, CATEGORY_NETWORK_ID, CATEGORY_UUID, uuid, UUID_BUF_LEN);
AuthDeviceGetLatestIdByUuid(uuid, AUTH_LINK_TYPE_P2P, authHandle);
if (authHandle->authId != AUTH_INVALID_ID) {
LNN_LOGI(LNN_BUILDER, "find p2p authHandle, networkId:%{public}s", anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "find p2p authHandle, networkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_OK;
}
AuthDeviceGetLatestIdByUuid(uuid, AUTH_LINK_TYPE_ENHANCED_P2P, authHandle);
if (authHandle->authId != AUTH_INVALID_ID) {
LNN_LOGI(LNN_BUILDER, "find hml authHandle, networkId:%{public}s", anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "find hml authHandle, networkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_OK;
}
@ -1216,7 +1222,7 @@ int32_t LnnSendP2pSyncInfoMsg(const char *networkId, uint32_t netCapability)
Anonymize(networkId, &anonyNetworkId);
AuthHandle authHandle = { .authId = AUTH_INVALID_ID };
if (GetAuthHandleByNetworkId(networkId, &authHandle) != SOFTBUS_OK) {
LNN_LOGE(LNN_BUILDER, "get authHandle fail, networkId:%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "get authHandle fail, networkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_ERR;
}
@ -1233,7 +1239,7 @@ int32_t LnnSendP2pSyncInfoMsg(const char *networkId, uint32_t netCapability)
char *msg = PackBleOfflineMsg((int64_t)netCapability, DISCOVERY_TYPE_BLE,
authVerifyTime[0] > authVerifyTime[1] ? authSeq[0] : authSeq[1]);
if (msg == NULL) {
LNN_LOGE(LNN_BUILDER, "pack p2p networking msg fail, networkId:%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "pack p2p networking msg fail, networkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_ERR;
}
@ -1248,9 +1254,10 @@ int32_t LnnSendP2pSyncInfoMsg(const char *networkId, uint32_t netCapability)
if (AuthPostTransData(authHandle, &dataInfo) == SOFTBUS_OK) {
LNN_LOGI(LNN_BUILDER, "send p2p sync info msg to networkId:%{public}s, netCap:%{public}u, seq:%{public}"
PRId64 ", [%{public}" PRId64 "/%{public}" PRId64 ", %{public}" PRIu64 "/%{public}" PRId64 "]",
anonyNetworkId, netCapability, dataInfo.seq, authVerifyTime[0], authSeq[0], authVerifyTime[1], authSeq[1]);
AnonymizeWrapper(anonyNetworkId), netCapability, dataInfo.seq,
authVerifyTime[0], authSeq[0], authVerifyTime[1], authSeq[1]);
} else {
LNN_LOGE(LNN_BUILDER, "post trans data fail, networkId:%{public}s", anonyNetworkId);
LNN_LOGE(LNN_BUILDER, "post trans data fail, networkId:%{public}s", AnonymizeWrapper(anonyNetworkId));
}
AnonymizeFree(anonyNetworkId);
cJSON_free(msg);
@ -1294,7 +1301,7 @@ int32_t LnnSendWifiOfflineInfoMsg(void)
for (int32_t i = 0; i < num; i++) {
if (AuthPostTransData(authHandle[i], &dataInfo) == SOFTBUS_OK) {
LNN_LOGI(LNN_BUILDER, "send wifi offline msg sucess, authPort:%{public}d, offlineCode:%{public}s,"
"authId:%{public}" PRId64, authPort, anonyOfflineCode, authHandle->authId);
"authId:%{public}" PRId64, authPort, AnonymizeWrapper(anonyOfflineCode), authHandle->authId);
} else {
LNN_LOGE(LNN_BUILDER, "post trans data fail, authId:%{public}" PRId64, authHandle->authId);
}

View File

@ -204,7 +204,7 @@ static void ClearTopoTable(void)
Anonymize(item->udid, &anonyUdid);
Anonymize(info->peerUdid, &anonyPeerUdid);
LNN_LOGI(LNN_BUILDER, "delete topo info, local=%{public}s, peer=%{public}s",
anonyUdid, anonyPeerUdid);
AnonymizeWrapper(anonyUdid), AnonymizeWrapper(anonyPeerUdid));
AnonymizeFree(anonyUdid);
AnonymizeFree(anonyPeerUdid);
ListDelete(&info->node);
@ -347,8 +347,9 @@ static int32_t UpdateLocalTopo(const char *udid, const char *peerUdid, const uin
{
TopoTableItem *topoItem = NULL;
TopoInfo *topoInfo = NULL;
char *anonyUdid = NULL;
char *anonyPeerUdid = NULL;
bool hasRelation = HasRelation(relation, len);
if (FindTopoInfo(udid, peerUdid, &topoItem, &topoInfo) != SOFTBUS_OK) {
if (!hasRelation) {
LNN_LOGE(LNN_BUILDER, "topo info not exist when delete");
@ -358,11 +359,10 @@ static int32_t UpdateLocalTopo(const char *udid, const char *peerUdid, const uin
LNN_LOGE(LNN_BUILDER, "add topo info fail");
return SOFTBUS_MEM_ERR;
}
char *anonyUdid = NULL;
char *anonyPeerUdid = NULL;
Anonymize(udid, &anonyUdid);
Anonymize(peerUdid, &anonyPeerUdid);
LNN_LOGI(LNN_BUILDER, "add topo info: local=%{public}s peer=%{public}s", anonyUdid, anonyPeerUdid);
LNN_LOGI(LNN_BUILDER, "add topo info: local=%{public}s peer=%{public}s",
AnonymizeWrapper(anonyUdid), AnonymizeWrapper(anonyPeerUdid));
AnonymizeFree(anonyUdid);
AnonymizeFree(anonyPeerUdid);
} else {
@ -375,11 +375,10 @@ static int32_t UpdateLocalTopo(const char *udid, const char *peerUdid, const uin
return SOFTBUS_MEM_ERR;
}
if (!hasRelation) {
char *anonyUdid = NULL;
char *anonyPeerUdid = NULL;
Anonymize(topoItem->udid, &anonyUdid);
Anonymize(topoInfo->peerUdid, &anonyPeerUdid);
LNN_LOGI(LNN_BUILDER, "delete topo info: local=%{public}s peer=%{public}s", anonyUdid, anonyPeerUdid);
LNN_LOGI(LNN_BUILDER, "delete topo info: local=%{public}s peer=%{public}s",
AnonymizeWrapper(anonyUdid), AnonymizeWrapper(anonyPeerUdid));
AnonymizeFree(anonyUdid);
AnonymizeFree(anonyPeerUdid);
ListDelete(&topoInfo->node);

View File

@ -93,7 +93,7 @@ static int32_t EnableBtSubnet(LnnPhysicalSubnet *subnet)
}
char *anonyMac = NULL;
Anonymize(macStr, &anonyMac);
LNN_LOGI(LNN_BUILDER, "btmac=%{public}s", anonyMac);
LNN_LOGI(LNN_BUILDER, "btmac=%{public}s", AnonymizeWrapper(anonyMac));
AnonymizeFree(anonyMac);
return LnnSetLocalStrInfo(STRING_KEY_BT_MAC, macStr);
}
@ -283,7 +283,7 @@ static void LeaveSpecificBrNetwork(const char *btMac)
}
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "start leave specific br networkId=%{public}s", anonyNetworkId);
LNN_LOGI(LNN_BUILDER, "start leave specific br networkId=%{public}s", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
int32_t ret = LnnRequestLeaveSpecific(networkId, CONNECTION_ADDR_BR);
if (ret != SOFTBUS_OK) {

View File

@ -154,7 +154,7 @@ static int32_t OpenAuthPort(void)
}
char *anonyIp = NULL;
Anonymize(localIp, &anonyIp);
LNN_LOGI(LNN_BUILDER, "open auth port listening on ip=%{public}s", anonyIp);
LNN_LOGI(LNN_BUILDER, "open auth port listening on ip=%{public}s", AnonymizeWrapper(anonyIp));
AnonymizeFree(anonyIp);
if (authPort == 0) {
return LnnSetLocalNumInfo(NUM_KEY_AUTH_PORT, port);

View File

@ -91,7 +91,7 @@ static bool IsBleDirectlyOnlineFactorChange(NodeInfo *info)
char uuid[UUID_BUF_LEN] = { 0 };
if ((LnnGetLocalStrInfo(STRING_KEY_UUID, uuid, UUID_BUF_LEN) == SOFTBUS_OK) && (strcmp(uuid, info->uuid) != 0)) {
Anonymize(info->uuid, &anonyNewUuid);
LNN_LOGW(LNN_LEDGER, "uuid change, new=%{public}s", anonyNewUuid);
LNN_LOGW(LNN_LEDGER, "uuid change, new=%{public}s", AnonymizeWrapper(anonyNewUuid));
AnonymizeFree(anonyNewUuid);
return true;
}
@ -501,7 +501,7 @@ static int32_t SoftbusDumpPrintAccountId(int fd, NodeBasicInfo *nodeInfo)
}
char *anonyAccountHash = NULL;
Anonymize(accountHashStr, &anonyAccountHash);
SOFTBUS_DPRINTF(fd, "AccountHash->%s\n", anonyAccountHash);
SOFTBUS_DPRINTF(fd, "AccountHash->%s\n", AnonymizeWrapper(anonyAccountHash));
AnonymizeFree(anonyAccountHash);
return SOFTBUS_OK;
}
@ -522,7 +522,7 @@ int32_t SoftbusDumpPrintUdid(int fd, NodeBasicInfo *nodeInfo)
}
char *anonyUdid = NULL;
Anonymize((char *)udid, &anonyUdid);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "Udid", anonyUdid);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "Udid", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
return SOFTBUS_OK;
}
@ -543,7 +543,7 @@ int32_t SoftbusDumpPrintUuid(int fd, NodeBasicInfo *nodeInfo)
}
char *anonyUuid = NULL;
Anonymize((char *)uuid, &anonyUuid);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "Uuid", anonyUuid);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "Uuid", AnonymizeWrapper(anonyUuid));
AnonymizeFree(anonyUuid);
return SOFTBUS_OK;
}
@ -675,7 +675,7 @@ static int32_t SoftbusDumpPrintIrk(int fd, NodeBasicInfo *nodeInfo)
}
char *anonyIrk = NULL;
Anonymize(peerIrkStr, &anonyIrk);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "IRK", anonyIrk);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "IRK", AnonymizeWrapper(anonyIrk));
AnonymizeFree(anonyIrk);
(void)memset_s(irk, LFINDER_IRK_LEN, 0, LFINDER_IRK_LEN);
(void)memset_s(peerIrkStr, LFINDER_IRK_STR_LEN, 0, LFINDER_IRK_STR_LEN);
@ -703,7 +703,7 @@ static int32_t SoftbusDumpPrintBroadcastCipher(int fd, NodeBasicInfo *nodeInfo)
}
char *anonyBroadcastCipher = NULL;
Anonymize((char *)broadcastCipherStr, &anonyBroadcastCipher);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "BroadcastCipher", anonyBroadcastCipher);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "BroadcastCipher", AnonymizeWrapper(anonyBroadcastCipher));
AnonymizeFree(anonyBroadcastCipher);
(void)memset_s(broadcastCipher, SESSION_KEY_LENGTH, 0, SESSION_KEY_LENGTH);
(void)memset_s(broadcastCipherStr, SESSION_KEY_STR_LEN, 0, SESSION_KEY_STR_LEN);
@ -731,7 +731,7 @@ static int32_t SoftbusDumpPrintRemotePtk(int fd, NodeBasicInfo *nodeInfo)
}
char *anonyRemotePtk = NULL;
Anonymize(remotePtkStr, &anonyRemotePtk);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "RemotePtk", anonyRemotePtk);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "RemotePtk", AnonymizeWrapper(anonyRemotePtk));
AnonymizeFree(anonyRemotePtk);
(void)memset_s(remotePtk, PTK_DEFAULT_LEN, 0, PTK_DEFAULT_LEN);
(void)memset_s(remotePtkStr, PTK_STR_LEN, 0, PTK_STR_LEN);
@ -763,7 +763,7 @@ static int32_t SoftbusDumpPrintLocalPtk(int fd, NodeBasicInfo *nodeInfo)
}
char *anonyLocalPtk = NULL;
Anonymize(localPtkStr, &anonyLocalPtk);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "LocalPtk", anonyLocalPtk);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "LocalPtk", AnonymizeWrapper(anonyLocalPtk));
AnonymizeFree(anonyLocalPtk);
(void)memset_s(localPtk, PTK_DEFAULT_LEN, 0, PTK_DEFAULT_LEN);
(void)memset_s(localPtkStr, PTK_STR_LEN, 0, PTK_STR_LEN);
@ -779,7 +779,7 @@ static void SoftbusDumpDeviceInfo(int fd, NodeBasicInfo *nodeInfo)
}
char *anonyNetworkId = NULL;
Anonymize(nodeInfo->networkId, &anonyNetworkId);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "NetworkId", anonyNetworkId);
SOFTBUS_DPRINTF(fd, " %-15s->%s\n", "NetworkId", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
if (SoftbusDumpPrintUdid(fd, nodeInfo) != SOFTBUS_OK) {
LNN_LOGE(LNN_LEDGER, "SoftbusDumpPrintUdid failed");
@ -845,7 +845,7 @@ void SoftBusDumpBusCenterPrintInfo(int fd, NodeBasicInfo *nodeInfo)
}
char *anonyDeviceName = NULL;
Anonymize(nodeInfo->deviceName, &anonyDeviceName);
SOFTBUS_DPRINTF(fd, "DeviceName->%s\n", anonyDeviceName);
SOFTBUS_DPRINTF(fd, "DeviceName->%s\n", AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyDeviceName);
SoftbusDumpPrintAccountId(fd, nodeInfo);
SoftbusDumpDeviceInfo(fd, nodeInfo);

View File

@ -597,7 +597,8 @@ void LnnDumpRemotePtk(const char *oldPtk, const char *newPtk, const char *log)
char *anonyOldPtk = NULL;
Anonymize(ptkStr, &anonyPtk);
Anonymize(oldPtkStr, &anonyOldPtk);
LNN_LOGI(LNN_LEDGER, "log=%{public}s, dump newPtk=%{public}s, oldPtk=%{public}s", log, anonyPtk, anonyOldPtk);
LNN_LOGI(LNN_LEDGER, "log=%{public}s, dump newPtk=%{public}s, oldPtk=%{public}s",
log, AnonymizeWrapper(anonyPtk), AnonymizeWrapper(anonyOldPtk));
AnonymizeFree(anonyPtk);
AnonymizeFree(anonyOldPtk);
(void)memset_s(ptkStr, PTK_STR_LEN, 0, PTK_STR_LEN);
@ -616,7 +617,8 @@ void LnnDumpNodeInfo(const NodeInfo *deviceInfo, const char *log)
Anonymize(deviceInfo->connectInfo.macAddr, &anonyBtMac);
LNN_LOGI(LNN_LEDGER, "log=%{public}s, stateVersion=%{public}d, networkId=%{public}s, udid=%{public}s, "
"deviceName=%{public}s, btMac=%{public}s, networkIdTimestamp=%{public}" PRId64, log, deviceInfo->stateVersion,
anonyNetworkId, anonyUdid, anonyDeviceName, anonyBtMac, deviceInfo->networkIdTimestamp);
AnonymizeWrapper(anonyNetworkId), AnonymizeWrapper(anonyUdid), AnonymizeWrapper(anonyDeviceName),
AnonymizeWrapper(anonyBtMac), deviceInfo->networkIdTimestamp);
AnonymizeFree(anonyNetworkId);
AnonymizeFree(anonyUdid);
AnonymizeFree(anonyDeviceName);

View File

@ -338,7 +338,7 @@ static void InsertTrustedDevInfoRecord(void *param)
}
char *anonyUdid = NULL;
Anonymize(udid, &anonyUdid);
LNN_LOGI(LNN_LEDGER, "insert udid to trusted dev info table. udid=%{public}s", anonyUdid);
LNN_LOGI(LNN_LEDGER, "insert udid to trusted dev info table. udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
if (InsertRecord(ctx, TABLE_TRUSTED_DEV_INFO, (uint8_t *)&record) == SOFTBUS_OK) {
(void)LnnAsyncCallbackHelper(GetLooper(LOOP_TYPE_DEFAULT), CompleteUpdateTrustedDevInfo, NULL);
@ -395,7 +395,7 @@ static void RemoveTrustedDevInfoRecord(void *param)
DbUnlock();
char *anonyUdid = NULL;
Anonymize(udid, &anonyUdid);
LNN_LOGI(LNN_LEDGER, "remove udid from trusted dev info table. udid=%{public}s", anonyUdid);
LNN_LOGI(LNN_LEDGER, "remove udid from trusted dev info table. udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
SoftBusFree(udid);
}
@ -413,7 +413,7 @@ static void DeleteDeviceFromList(TrustedDevInfoRecord *record)
strcmp(item->infoRecord.udid, record->udid) == 0) {
char *anonyUdid = NULL;
Anonymize(record->udid, &anonyUdid);
LNN_LOGI(LNN_LEDGER, "delete device db from list. udid=%{public}s", anonyUdid);
LNN_LOGI(LNN_LEDGER, "delete device db from list. udid=%{public}s", AnonymizeWrapper(anonyUdid));
AnonymizeFree(anonyUdid);
ListDelete(&item->node);
SoftBusFree(item);

View File

@ -33,7 +33,7 @@ extern "C" {
do { \
char *anonyKey = NULL; \
Anonymize(key, &anonyKey); \
LNN_LOGE(LNN_LEDGER, log, anonyKey); \
LNN_LOGE(LNN_LEDGER, log, AnonymizeWrapper(anonyKey)); \
AnonymizeFree(anonyKey); \
} while (0) \

View File

@ -84,7 +84,7 @@ static void UpdateDeviceNameInfo(const char *udid, const char *oldDeviceName)
char *anonyDeviceName = NULL;
Anonymize(basic.deviceName, &anonyDeviceName);
LNN_LOGI(LNN_LEDGER, "report deviceName update, name:%{public}s -> %{public}s.",
anonyOldDeviceName, anonyDeviceName);
AnonymizeWrapper(anonyOldDeviceName), AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyOldDeviceName);
AnonymizeFree(anonyDeviceName);
LnnNotifyBasicInfoChanged(&basic, TYPE_DEVICE_NAME);
@ -477,7 +477,8 @@ int32_t LnnGetRemoteNodeInfoById(const char *id, IdCategory type, NodeInfo *info
(void)SoftBusMutexUnlock(&g_distributedNetLedger.lock);
char *anonyId = NULL;
Anonymize(id, &anonyId);
LNN_LOGI(LNN_LEDGER, "can not find target node, id=%{public}s, type=%{public}d", anonyId, type);
LNN_LOGI(LNN_LEDGER, "can not find target node, id=%{public}s, type=%{public}d",
AnonymizeWrapper(anonyId), type);
AnonymizeFree(anonyId);
return SOFTBUS_NETWORK_GET_NODE_INFO_ERR;
}
@ -994,7 +995,8 @@ static void BleDirectlyOnlineProc(NodeInfo *info)
char *anonyNetworkId = NULL;
Anonymize(deviceInfo.networkId, &anonyDevNetworkId);
Anonymize(info->networkId, &anonyNetworkId);
LNN_LOGI(LNN_LEDGER, "oldNetworkId=%{public}s, newNetworkid=%{public}s", anonyDevNetworkId, anonyNetworkId);
LNN_LOGI(LNN_LEDGER, "oldNetworkId=%{public}s, newNetworkid=%{public}s",
AnonymizeWrapper(anonyDevNetworkId), AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyDevNetworkId);
AnonymizeFree(anonyNetworkId);
GetAndSaveRemoteDeviceInfo(&deviceInfo, info);
@ -1042,7 +1044,7 @@ static void GetNodeInfoDiscovery(NodeInfo *oldInfo, NodeInfo *info, NodeInfoAbil
if (oldInfo != NULL && LnnIsNodeOnline(oldInfo)) {
char *anonyUuid = NULL;
Anonymize(oldInfo->uuid, &anonyUuid);
LNN_LOGI(LNN_LEDGER, "addOnlineNode find online node, uuid=%{public}s", anonyUuid);
LNN_LOGI(LNN_LEDGER, "addOnlineNode find online node, uuid=%{public}s", AnonymizeWrapper(anonyUuid));
AnonymizeFree(anonyUuid);
infoAbility->isOffline = false;
infoAbility->isChanged = IsNetworkIdChanged(info, oldInfo);
@ -1738,7 +1740,7 @@ const NodeInfo *LnnGetOnlineNodeByUdidHash(const char *recvUdidHash)
Anonymize(nodeInfo->deviceInfo.deviceUdid, &anoyUdid);
Anonymize((const char *)shortUdidHash, &anoyUdidHash);
LNN_LOGI(LNN_LEDGER, "node is online. nodeUdid=%{public}s, shortUdidHash=%{public}s",
anoyUdid, anoyUdidHash);
AnonymizeWrapper(anoyUdid), AnonymizeWrapper(anoyUdidHash));
AnonymizeFree(anoyUdid);
AnonymizeFree(anoyUdidHash);
SoftBusFree(info);
@ -1765,7 +1767,7 @@ void LnnRefreshDeviceOnlineStateAndDevIdInfo(const char *pkgName, DeviceInfo *de
char *anoyUdidHash = NULL;
Anonymize(device->devId, &anoyUdidHash);
LNN_LOGI(LNN_LEDGER, "device found. medium=%{public}d, udidhash=%{public}s, onlineStatus=%{public}d",
additions->medium, anoyUdidHash, device->isOnline);
additions->medium, AnonymizeWrapper(anoyUdidHash), device->isOnline);
AnonymizeFree(anoyUdidHash);
}
}
@ -1785,7 +1787,7 @@ int32_t LnnGetOsTypeByNetworkId(const char *networkId, int32_t *osType)
SoftBusMutexUnlock(&g_distributedNetLedger.lock);
char *anonyNetworkId = NULL;
Anonymize(networkId, &anonyNetworkId);
LNN_LOGE(LNN_LEDGER, "get info by networkId=%{public}s failed", anonyNetworkId);
LNN_LOGE(LNN_LEDGER, "get info by networkId=%{public}s failed", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_NOT_FIND;
}

View File

@ -341,20 +341,22 @@ bool LnnSetRemoteScreenStatusInfo(const char *networkId, bool isScreenOn)
Anonymize(networkId, &anonyNetworkId);
NodeInfo *info = LnnGetNodeInfoById(networkId, CATEGORY_NETWORK_ID);
if (info == NULL) {
LNN_LOGE(LNN_LEDGER, "networkId=%{public}s, get node info fail.", anonyNetworkId);
LNN_LOGE(LNN_LEDGER, "networkId=%{public}s, get node info fail.", AnonymizeWrapper(anonyNetworkId));
SoftBusMutexUnlock(&(LnnGetDistributedNetLedger()->lock));
AnonymizeFree(anonyNetworkId);
return false;
}
if (IsNodeInfoScreenStatusSupport(info) != SOFTBUS_OK) {
LNN_LOGE(LNN_LEDGER, "networkId=%{public}s, node screen status is not supported", anonyNetworkId);
LNN_LOGE(LNN_LEDGER, "networkId=%{public}s, node screen status is not supported",
AnonymizeWrapper(anonyNetworkId));
SoftBusMutexUnlock(&(LnnGetDistributedNetLedger()->lock));
AnonymizeFree(anonyNetworkId);
return false;
}
info->isScreenOn = isScreenOn;
LNN_LOGI(LNN_LEDGER, "set %{public}s screen status to %{public}s", anonyNetworkId, isScreenOn ? "on" : "off");
LNN_LOGI(LNN_LEDGER, "set %{public}s screen status to %{public}s",
AnonymizeWrapper(anonyNetworkId), isScreenOn ? "on" : "off");
SoftBusMutexUnlock(&LnnGetDistributedNetLedger()->lock);
AnonymizeFree(anonyNetworkId);
return true;
@ -682,12 +684,12 @@ static int32_t DlGetNodeScreenOnFlag(const char *networkId, bool checkOnline, vo
Anonymize(networkId, &anonyNetworkId);
int32_t ret = IsNodeInfoScreenStatusSupport(info);
if (ret != SOFTBUS_OK) {
LNN_LOGI(LNN_LEDGER, "%{public}s get node screen not support", anonyNetworkId);
LNN_LOGI(LNN_LEDGER, "%{public}s get node screen not support", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return ret;
}
if (checkOnline && !LnnIsNodeOnline(info) && !IsMetaNode(info)) {
LNN_LOGE(LNN_LEDGER, "%{public}s node is offline", anonyNetworkId);
LNN_LOGE(LNN_LEDGER, "%{public}s node is offline", AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return SOFTBUS_NETWORK_NODE_OFFLINE;
}

View File

@ -494,7 +494,7 @@ static int32_t LlGetWlanIp(void *buf, uint32_t len)
}
char *anonyIp = NULL;
Anonymize(ip, &anonyIp);
LNN_LOGD(LNN_LEDGER, "get LocalIp=%{public}s", anonyIp);
LNN_LOGD(LNN_LEDGER, "get LocalIp=%{public}s", AnonymizeWrapper(anonyIp));
AnonymizeFree(anonyIp);
if (strncpy_s((char *)buf, len, ip, strlen(ip)) != EOK) {
LNN_LOGE(LNN_LEDGER, "STR COPY ERROR");
@ -1076,8 +1076,8 @@ static int32_t UpdateLocalDeviceName(const void *name)
Anonymize((char *)name, &anonyName);
char *anonyDeviceName = NULL;
Anonymize(localNodeInfo.deviceInfo.deviceName, &anonyDeviceName);
LNN_LOGI(LNN_LEDGER, "device name=%{public}s->%{public}s, cache=%{public}s", anonyBeforeName, anonyName,
anonyDeviceName);
LNN_LOGI(LNN_LEDGER, "device name=%{public}s->%{public}s, cache=%{public}s",
AnonymizeWrapper(anonyBeforeName), AnonymizeWrapper(anonyName), AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyBeforeName);
AnonymizeFree(anonyName);
AnonymizeFree(anonyDeviceName);
@ -1233,7 +1233,8 @@ static int32_t UpdateLocalNetworkId(const void *id)
Anonymize(g_localNetLedger.localInfo.lastNetworkId, &anonyOldNetworkId);
g_localNetLedger.localInfo.networkIdTimestamp = (int64_t)SoftBusGetSysTimeMs();
LNN_LOGI(LNN_LEDGER, "networkId change %{public}s -> %{public}s, networkIdTimestamp=%{public}" PRId64,
anonyOldNetworkId, anonyNetworkId, g_localNetLedger.localInfo.networkIdTimestamp);
AnonymizeWrapper(anonyOldNetworkId), AnonymizeWrapper(anonyNetworkId),
g_localNetLedger.localInfo.networkIdTimestamp);
UpdateStateVersionAndStore(UPDATE_NETWORKID);
AnonymizeFree(anonyNetworkId);
AnonymizeFree(anonyOldNetworkId);
@ -1349,7 +1350,7 @@ static int32_t UpdateLocalDeviceIp(const void *ip)
LnnSetWiFiIp(&g_localNetLedger.localInfo, (char *)ip);
char *anonyIp = NULL;
Anonymize((char *)ip, &anonyIp);
LNN_LOGI(LNN_LEDGER, "set LocalIp=%{public}s", anonyIp);
LNN_LOGI(LNN_LEDGER, "set LocalIp=%{public}s", AnonymizeWrapper(anonyIp));
AnonymizeFree(anonyIp);
return SOFTBUS_OK;
}

View File

@ -170,8 +170,8 @@ void LnnDCProcessOnlineState(bool isOnline, const NodeBasicInfo *info)
LNN_CHECK_AND_RETURN_LOGW(info != NULL, LNN_STATE, " info is NULL");
char *anonyNetworkId = NULL;
Anonymize(info->networkId, &anonyNetworkId);
LNN_LOGI(LNN_STATE,
"onlineState=%{public}s, networkId=%{public}s", (isOnline ? "online" : "offline"), anonyNetworkId);
LNN_LOGI(LNN_STATE, "onlineState=%{public}s, networkId=%{public}s",
(isOnline ? "online" : "offline"), AnonymizeWrapper(anonyNetworkId));
if (isOnline) {
LNN_LOGD(LNN_LEDGER, "ignore for online");
AnonymizeFree(anonyNetworkId);
@ -180,7 +180,8 @@ void LnnDCProcessOnlineState(bool isOnline, const NodeBasicInfo *info)
NodeInfo nodeInfo = { 0 };
if (LnnGetRemoteNodeInfoById(info->networkId, CATEGORY_NETWORK_ID, &nodeInfo) != SOFTBUS_OK) {
LNN_LOGE(LNN_STATE, "can not get remote nodeinfo. networkId=%{public}s", anonyNetworkId);
LNN_LOGE(LNN_STATE, "can not get remote nodeinfo. networkId=%{public}s",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
return;
}

View File

@ -378,7 +378,8 @@ void LnnNotifyOnlineState(bool isOnline, NodeBasicInfo *info)
char *anonyDeviceName = NULL;
Anonymize(info->deviceName, &anonyDeviceName);
LNN_LOGI(LNN_EVENT, "notify node. deviceName=%{public}s, isOnline=%{public}s, networkId=%{public}s",
anonyDeviceName, (isOnline == true) ? "online" : "offline", anonyNetworkId);
AnonymizeWrapper(anonyDeviceName), (isOnline == true) ? "online" : "offline",
AnonymizeWrapper(anonyNetworkId));
AnonymizeFree(anonyNetworkId);
AnonymizeFree(anonyDeviceName);
SetDefaultQdisc();
@ -428,7 +429,8 @@ void LnnNotifyBasicInfoChanged(NodeBasicInfo *info, NodeBasicInfoType type)
if (type == TYPE_DEVICE_NAME) {
char *anonyDeviceName = NULL;
Anonymize(info->deviceName, &anonyDeviceName);
LNN_LOGI(LNN_EVENT, "notify peer device name changed. deviceName=%{public}s", anonyDeviceName);
LNN_LOGI(LNN_EVENT, "notify peer device name changed. deviceName=%{public}s",
AnonymizeWrapper(anonyDeviceName));
AnonymizeFree(anonyDeviceName);
}
(void)PostNotifyMessage(NOTIFY_NODE_BASIC_INFO_CHANGED, (uint64_t)type, info);
@ -644,7 +646,8 @@ void LnnNotifyBtAclStateChangeEvent(const char *btMac, SoftBusBtAclState state)
}
char *anonyMac = NULL;
Anonymize(btMac, &anonyMac);
LNN_LOGI(LNN_EVENT, "notify bt acl state changed: state=%{public}d, btMac=%{public}s.", state, anonyMac);
LNN_LOGI(LNN_EVENT, "notify bt acl state changed: state=%{public}d, btMac=%{public}s.",
state, AnonymizeWrapper(anonyMac));
AnonymizeFree(anonyMac);
LnnMonitorBtAclStateChangedEvent event = {.basic.event = LNN_EVENT_BT_ACL_STATE_CHANGED, .status = state};
if (strcpy_s(event.btMac, sizeof(event.btMac), btMac) != EOK) {

View File

@ -312,19 +312,19 @@ const char *LnnPrintConnectionAddr(const ConnectionAddr *addr)
case CONNECTION_ADDR_ETH:
Anonymize(addr->info.ip.ip, &anonyIp);
ret = sprintf_s(g_printAddr, sizeof(g_printAddr),
"Ip=%s", anonyIp);
"Ip=%s", AnonymizeWrapper(anonyIp));
AnonymizeFree(anonyIp);
break;
case CONNECTION_ADDR_BR:
Anonymize(addr->info.br.brMac, &anonyMac);
ret = sprintf_s(g_printAddr, sizeof(g_printAddr),
"BrMac=%s", anonyMac);
"BrMac=%s", AnonymizeWrapper(anonyMac));
AnonymizeFree(anonyMac);
break;
case CONNECTION_ADDR_BLE:
Anonymize(addr->info.ble.bleMac, &anonyMac);
ret = sprintf_s(g_printAddr, sizeof(g_printAddr),
"BleMac=%s", anonyMac);
"BleMac=%s", AnonymizeWrapper(anonyMac));
AnonymizeFree(anonyMac);
break;
default:

View File

@ -79,7 +79,7 @@ int32_t LnnGetFullStoragePath(LnnFileId id, char *path, uint32_t len)
}
char *anonyPath = NULL;
Anonymize(path, &anonyPath);
LNN_LOGI(LNN_STATE, "full path id=%{public}d, path=%{public}s", id, anonyPath);
LNN_LOGI(LNN_STATE, "full path id=%{public}d, path=%{public}s", id, AnonymizeWrapper(anonyPath));
AnonymizeFree(anonyPath);
return SOFTBUS_OK;
}

View File

@ -221,7 +221,7 @@ int32_t LnnGenLocalIrk(unsigned char *irk, uint32_t len)
}
char *anonyIrk = NULL;
Anonymize(irkStr, &anonyIrk);
LNN_LOGI(LNN_STATE, "get irk success:irk=%{public}s", anonyIrk);
LNN_LOGI(LNN_STATE, "get irk success:irk=%{public}s", AnonymizeWrapper(anonyIrk));
AnonymizeFree(anonyIrk);
(void)memset_s(locaIrk, LFINDER_IRK_LEN, 0, LFINDER_IRK_LEN);
(void)memset_s(irkStr, LFINDER_IRK_STR_LEN, 0, LFINDER_IRK_STR_LEN);

View File

@ -1215,13 +1215,13 @@ int32_t LnnOnNodeStatusChanged(const char *pkgName, void *info, int32_t type)
}
char *anonyPkgName = NULL;
Anonymize(pkgName, &anonyPkgName);
LNN_LOGI(LNN_STATE, "LnnOnNodeStatusChanged, pkgName=%{public}s, type=%{public}d, screen=%{public}d", anonyPkgName,
type, nodeStatus->reserved[0]);
LNN_LOGI(LNN_STATE, "LnnOnNodeStatusChanged, pkgName=%{public}s, type=%{public}d, screen=%{public}d",
AnonymizeWrapper(anonyPkgName), type, nodeStatus->reserved[0]);
LIST_FOR_EACH_ENTRY(item, &dupList, NodeStateCallbackItem, node) {
if (((strcmp(item->pkgName, pkgName) == 0) || (strlen(pkgName) == 0)) &&
(item->cb.events & EVENT_NODE_STATUS_CHANGED) != 0 && item->cb.onNodeStatusChanged != NULL) {
LNN_LOGI(LNN_STATE, "LnnOnNodeStatusChanged, pkgName=%{public}s, type=%{public}d, screen=%{public}d",
anonyPkgName, type, nodeStatus->reserved[0]);
AnonymizeWrapper(anonyPkgName), type, nodeStatus->reserved[0]);
item->cb.onNodeStatusChanged((NodeStatusType)type, nodeStatus);
}
}