fix log security problem

Signed-off-by: zhang-hai-feng <zhanghaifeng11@huawei.com>
This commit is contained in:
zhang-hai-feng 2022-10-21 11:16:46 +08:00
parent 5e9f113160
commit 3b325d184f
5 changed files with 49 additions and 46 deletions

View File

@ -186,8 +186,9 @@ int32_t HRilNetwork::GetCsRegStatusResponse(
csRegStatusInfo.lacCode = hrilRegStatusInfo->lacCode;
csRegStatusInfo.cellId = hrilRegStatusInfo->cellId;
csRegStatusInfo.radioTechnology = static_cast<HDI::Ril::V1_0::RilRadioTech>(hrilRegStatusInfo->actType);
TELEPHONY_LOGI("GetCsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, "
"lacCode:%{public}d, cellId:%{public}d, radioTechnology:%{public}d",
TELEPHONY_LOGD(
"GetCsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, "
"lacCode:%{private}d, cellId:%{private}d, radioTechnology:%{public}d",
csRegStatusInfo.notifyType, csRegStatusInfo.regStatus, csRegStatusInfo.lacCode, csRegStatusInfo.cellId,
csRegStatusInfo.radioTechnology);
}
@ -213,12 +214,13 @@ int32_t HRilNetwork::GetPsRegStatusResponse(
psRegStatusInfo.isDcNrRestricted = hrilRegStatusInfo->isDcNrRestricted;
psRegStatusInfo.isNrAvailable = hrilRegStatusInfo->isNrAvailable;
psRegStatusInfo.isEnDcAvailable = hrilRegStatusInfo->isEnDcAvailable;
TELEPHONY_LOGI(
"GetPsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, lacCode:%{public}d, cellId:%{public}d,"
"technology:%{public}d, isDcNrRestricted:%{public}d, isNrAvailable:%{public}d, isEnDcAvailable:%{public}d",
psRegStatusInfo.notifyType, psRegStatusInfo.regStatus, psRegStatusInfo.lacCode,
psRegStatusInfo.cellId, psRegStatusInfo.radioTechnology, psRegStatusInfo.isDcNrRestricted,
psRegStatusInfo.isNrAvailable, psRegStatusInfo.isEnDcAvailable);
TELEPHONY_LOGD(
"GetPsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, lacCode:%{private}d, "
"cellId:%{private}d, technology:%{public}d, isDcNrRestricted:%{private}d, isNrAvailable:%{private}d, "
"isEnDcAvailable:%{private}d",
psRegStatusInfo.notifyType, psRegStatusInfo.regStatus, psRegStatusInfo.lacCode, psRegStatusInfo.cellId,
psRegStatusInfo.radioTechnology, psRegStatusInfo.isDcNrRestricted, psRegStatusInfo.isNrAvailable,
psRegStatusInfo.isEnDcAvailable);
}
return Response(responseInfo, &HDI::Ril::V1_0::IRilCallback::GetPsRegStatusResponse, psRegStatusInfo);
}
@ -374,17 +376,17 @@ int32_t HRilNetwork::GetPhysicalChannelConfigResponse(
phyChnlCfg.uplinkChannelNum = hrilChannelConfigList->channelConfigs[i].uplinkChannelNum;
phyChnlCfg.physicalCellId = hrilChannelConfigList->channelConfigs[i].physicalCellId;
phyChnlCfg.contextIdNum = hrilChannelConfigList->channelConfigs[i].contextIdNum;
TELEPHONY_LOGI(
"GetPhysicalChannelConfigResponse cellConnStatus:%{public}d, "
"cellBandwidthDownlinkKhz:%{public}d, cellBandwidthUplinkKhz:%{public}d, physicalCellId:%{public}d, "
"ratType:%{public}d, freqRange:%{public}d, downlinkChannelNum:%{public}d, "
"uplinkChannelNum:%{public}d, contextIdNum:%{public}d",
TELEPHONY_LOGD(
"GetPhysicalChannelConfigResponse cellConnStatus:%{private}d, "
"cellBandwidthDownlinkKhz:%{private}d, cellBandwidthUplinkKhz:%{private}d, physicalCellId:%{private}d, "
"ratType:%{private}d, freqRange:%{private}d, downlinkChannelNum:%{private}d, "
"uplinkChannelNum:%{private}d, contextIdNum:%{private}d",
phyChnlCfg.cellConnStatus, phyChnlCfg.cellBandwidthDownlinkKhz, phyChnlCfg.cellBandwidthUplinkKhz,
phyChnlCfg.ratType, phyChnlCfg.freqRange, phyChnlCfg.downlinkChannelNum, phyChnlCfg.uplinkChannelNum,
phyChnlCfg.physicalCellId, phyChnlCfg.contextIdNum);
for (int32_t j = 0; j < phyChnlCfg.contextIdNum; j++) {
phyChnlCfg.contextIds.push_back(hrilChannelConfigList->channelConfigs[i].contextIds[j]);
TELEPHONY_LOGI("contextIds:%{public}d---contextId:%{public}d", j, phyChnlCfg.contextIds[j]);
TELEPHONY_LOGD("contextIds:%{public}d---contextId:%{private}d", j, phyChnlCfg.contextIds[j]);
}
phyChnlCfgList.channelConfigInfos.push_back(phyChnlCfg);
}
@ -425,8 +427,8 @@ int32_t HRilNetwork::NetworkCsRegStatusUpdated(
regStatusInfoNotify.lacCode = hrilRegStatusInfo->lacCode;
regStatusInfoNotify.cellId = hrilRegStatusInfo->cellId;
regStatusInfoNotify.radioTechnology = static_cast<HDI::Ril::V1_0::RilRadioTech>(hrilRegStatusInfo->actType);
TELEPHONY_LOGI("NetworkCsRegStatusUpdated notifyType:%{public}d, regStatus:%{public}d, "
"lacCode:%{public}d, cellId:%{public}d, radioTechnology:%{public}d",
TELEPHONY_LOGD("NetworkCsRegStatusUpdated notifyType:%{public}d, regStatus:%{public}d, "
"lacCode:%{private}d, cellId:%{private}d, radioTechnology:%{public}d",
regStatusInfoNotify.notifyType, regStatusInfoNotify.regStatus, regStatusInfoNotify.lacCode,
regStatusInfoNotify.cellId, regStatusInfoNotify.radioTechnology);
return Notify(indType, error, &HDI::Ril::V1_0::IRilCallback::NetworkCsRegStatusUpdated, regStatusInfoNotify);
@ -449,9 +451,10 @@ int32_t HRilNetwork::NetworkPsRegStatusUpdated(
regStatusInfoNotify.isDcNrRestricted = hrilRegStatusInfo->isDcNrRestricted;
regStatusInfoNotify.isNrAvailable = hrilRegStatusInfo->isNrAvailable;
regStatusInfoNotify.isEnDcAvailable = hrilRegStatusInfo->isEnDcAvailable;
TELEPHONY_LOGI(
"GetPsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, lacCode:%{public}d, cellId:%{public}d, "
"radioTechnology:%{public}d, isDcNrRestricted:%{public}d, isNrAvailable:%{public}d, isEnDcAvailable:%{public}d",
TELEPHONY_LOGD(
"GetPsRegStatusResponse notifyType:%{public}d, regStatus:%{public}d, lacCode:%{private}d, cellId:%{private}d, "
"radioTechnology:%{public}d, isDcNrRestricted:%{private}d, isNrAvailable:%{private}d, "
"isEnDcAvailable:%{private}d",
regStatusInfoNotify.notifyType, regStatusInfoNotify.regStatus, regStatusInfoNotify.lacCode,
regStatusInfoNotify.cellId, regStatusInfoNotify.radioTechnology, regStatusInfoNotify.isDcNrRestricted,
regStatusInfoNotify.isNrAvailable, regStatusInfoNotify.isEnDcAvailable);

View File

@ -382,17 +382,17 @@ int32_t HRilSms::GetCBConfigResponse(
broadcastInfo.mids = std::string("");
TELEPHONY_LOGE("result.mids is nullptr");
} else {
TELEPHONY_LOGE("result.mids :%{public}s", cellBroadcastInfo->mids);
TELEPHONY_LOGD("result.mids :%{private}s", cellBroadcastInfo->mids);
broadcastInfo.mids = std::string(cellBroadcastInfo->mids);
}
if (cellBroadcastInfo->dcss == nullptr) {
broadcastInfo.dcss = std::string("");
TELEPHONY_LOGE("result.dcss is nullptr");
} else {
TELEPHONY_LOGE("result.dcss :%{public}s", cellBroadcastInfo->dcss);
TELEPHONY_LOGD("result.dcss :%{private}s", cellBroadcastInfo->dcss);
broadcastInfo.dcss = std::string(cellBroadcastInfo->dcss);
}
TELEPHONY_LOGE("mode:%{public}d, mids:%{public}s, dcss:%{public}s", cellBroadcastInfo->mode,
TELEPHONY_LOGD("mode:%{private}d, mids:%{private}s, dcss:%{private}s", cellBroadcastInfo->mode,
cellBroadcastInfo->mids, cellBroadcastInfo->dcss);
}
return Response(responseInfo, &HDI::Ril::V1_0::IRilCallback::GetCBConfigResponse, broadcastInfo);
@ -659,21 +659,21 @@ HDI::Ril::V1_0::CBConfigReportInfo HRilSms::MakeCBConfigResult(const void *respo
result.data = std::string("");
TELEPHONY_LOGE("result.data is nullptr");
} else {
TELEPHONY_LOGE("result.data :%{public}s", cellBroadcastReportInfo->data);
TELEPHONY_LOGD("result.data :%{private}s", cellBroadcastReportInfo->data);
result.data = std::string(cellBroadcastReportInfo->data);
}
if (cellBroadcastReportInfo->pdu == nullptr) {
result.pdu = std::string("");
TELEPHONY_LOGE("result.pdu is nullptr");
} else {
TELEPHONY_LOGE("result.pdu :%{public}s", cellBroadcastReportInfo->pdu);
TELEPHONY_LOGD("result.pdu :%{private}s", cellBroadcastReportInfo->pdu);
result.pdu = std::string(cellBroadcastReportInfo->pdu);
}
if (cellBroadcastReportInfo->dcs == nullptr) {
result.dcs = std::string("");
TELEPHONY_LOGE("result.dcs is nullptr");
} else {
TELEPHONY_LOGE("result.dcs :%{public}s", cellBroadcastReportInfo->dcs);
TELEPHONY_LOGD("result.dcs :%{private}s", cellBroadcastReportInfo->dcs);
result.dcs = std::string(cellBroadcastReportInfo->dcs);
}
}

View File

@ -1202,12 +1202,11 @@ static void ParseGetGsmCellInfoLine(char *line, CurrentCellInfoVendor *response)
NextInt(&line, &response->ServiceCellParas.gsm.rxlev);
NextInt(&line, &response->ServiceCellParas.gsm.rxQuality);
NextInt(&line, &response->ServiceCellParas.gsm.ta);
TELEPHONY_LOGI(
"ParseGetGsmCellInfoLine band:%{public}d,arfcn:%{public}d,bsic:%{public}d,cellId:%{public}d"
"lac:%{public}d,rxlev:%{public}d,rxQuality:%{public}d,ta:%{public}d",
response->ServiceCellParas.gsm.band, response->ServiceCellParas.gsm.arfcn,
response->ServiceCellParas.gsm.bsic, response->ServiceCellParas.gsm.cellId,
response->ServiceCellParas.gsm.lac, response->ServiceCellParas.gsm.rxlev,
TELEPHONY_LOGD(
"ParseGetGsmCellInfoLine band:%{private}d,arfcn:%{private}d,bsic:%{private}d,cellId:%{private}d"
"lac:%{private}d,rxlev:%{private}d,rxQuality:%{private}d,ta:%{private}d",
response->ServiceCellParas.gsm.band, response->ServiceCellParas.gsm.arfcn, response->ServiceCellParas.gsm.bsic,
response->ServiceCellParas.gsm.cellId, response->ServiceCellParas.gsm.lac, response->ServiceCellParas.gsm.rxlev,
response->ServiceCellParas.gsm.rxQuality, response->ServiceCellParas.gsm.ta);
}
@ -1223,12 +1222,12 @@ static void ParseGetLteCellInfoLine(char *line, CurrentCellInfoVendor *response)
NextInt(&line, &response->ServiceCellParas.lte.rsrp);
NextInt(&line, &response->ServiceCellParas.lte.rsrq);
NextInt(&line, &response->ServiceCellParas.lte.rssi);
TELEPHONY_LOGI(
"ParseGetLteCellInfoLine arfcn:%{public}d,cellId:%{public}d,pci:%{public}d"
"tac:%{public}d,rsrp:%{public}d,rsrq:%{public}d,rssi:%{public}d",
response->ServiceCellParas.lte.arfcn, response->ServiceCellParas.lte.cellId,
response->ServiceCellParas.lte.pci, response->ServiceCellParas.lte.tac, response->ServiceCellParas.lte.rsrp,
response->ServiceCellParas.lte.rsrq, response->ServiceCellParas.lte.rssi);
TELEPHONY_LOGD(
"ParseGetLteCellInfoLine arfcn:%{private}d,cellId:%{private}d,pci:%{private}d"
"tac:%{private}d,rsrp:%{private}d,rsrq:%{private}d,rssi:%{private}d",
response->ServiceCellParas.lte.arfcn, response->ServiceCellParas.lte.cellId, response->ServiceCellParas.lte.pci,
response->ServiceCellParas.lte.tac, response->ServiceCellParas.lte.rsrp, response->ServiceCellParas.lte.rsrq,
response->ServiceCellParas.lte.rssi);
}
static void ParseGetWcdmaCellInfoLine(char *line, CurrentCellInfoVendor *response)
@ -1245,9 +1244,9 @@ static void ParseGetWcdmaCellInfoLine(char *line, CurrentCellInfoVendor *respons
NextInt(&line, &response->ServiceCellParas.wcdma.ecno);
NextInt(&line, &response->ServiceCellParas.wcdma.drx);
NextInt(&line, &response->ServiceCellParas.wcdma.ura);
TELEPHONY_LOGI(
"ParseGetWcdmaCellInfoLine arfcn:%{public}d,psc:%{public}d,cellId:%{public}d,lac:%{public}d"
"rscp:%{public}d,rxlev:%{public}d,ecno:%{public}d,drx:%{public}d,ura:%{public}d",
TELEPHONY_LOGD(
"ParseGetWcdmaCellInfoLine arfcn:%{private}d,psc:%{private}d,cellId:%{private}d,lac:%{private}d"
"rscp:%{private}d,rxlev:%{private}d,ecno:%{private}d,drx:%{private}d,ura:%{private}d",
response->ServiceCellParas.wcdma.arfcn, response->ServiceCellParas.wcdma.psc,
response->ServiceCellParas.wcdma.cellId, response->ServiceCellParas.wcdma.lac,
response->ServiceCellParas.wcdma.rscp, response->ServiceCellParas.wcdma.rxlev,
@ -1269,9 +1268,9 @@ static void ParseGetCdmaCellInfoLine(char *line, CurrentCellInfoVendor *response
NextInt(&line, &response->ServiceCellParas.cdma.channel);
NextInt(&line, &response->ServiceCellParas.cdma.longitude);
NextInt(&line, &response->ServiceCellParas.cdma.latitude);
TELEPHONY_LOGI(
"ParseGetCdmaCellInfoLine systemId:%{public}d,networkId:%{public}d,baseId:%{public}d,zoneId:%{public}d"
"pilotPn:%{public}d,pilotStrength:%{public}d,channel:%{public}d,longitude:%{public}d,latitude:%{public}d",
TELEPHONY_LOGD(
"ParseGetCdmaCellInfoLine systemId:%{private}d,networkId:%{private}d,baseId:%{private}d,zoneId:%{private}d"
"pilotPn:%{private}d,pilotStrength:%{private}d,channel:%{private}d,longitude:%{private}d,latitude:%{private}d",
response->ServiceCellParas.cdma.systemId, response->ServiceCellParas.cdma.networkId,
response->ServiceCellParas.cdma.baseId, response->ServiceCellParas.cdma.zoneId,
response->ServiceCellParas.cdma.pilotPn, response->ServiceCellParas.cdma.pilotStrength,
@ -1293,9 +1292,8 @@ static void ParseGetTdscdmaCellInfoLine(char *line, CurrentCellInfoVendor *respo
NextInt(&line, &response->ServiceCellParas.tdscdma.drx);
NextIntFromHex(&line, &response->ServiceCellParas.tdscdma.rac);
NextInt(&line, &response->ServiceCellParas.tdscdma.cpid);
TELEPHONY_LOGI(
"ParseGetTdscdmaCellInfoLine arfcn:%{public}d,syncId:%{public}d,sc:%{public}d,cellId:%{public}d,"
"lac:%{public}d,rscp:%{public}d,drx:%{public}d,rac:%{public}d,cpid:%{public}d,",
TELEPHONY_LOGD("ParseGetTdscdmaCellInfoLine arfcn:%{private}d,syncId:%{private}d,sc:%{private}d,cellId:%{private}d,"
"lac:%{private}d,rscp:%{private}d,drx:%{private}d,rac:%{private}d,cpid:%{private}d,",
response->ServiceCellParas.tdscdma.arfcn, response->ServiceCellParas.tdscdma.syncId,
response->ServiceCellParas.tdscdma.sc, response->ServiceCellParas.tdscdma.cellId,
response->ServiceCellParas.tdscdma.lac, response->ServiceCellParas.tdscdma.rscp,

View File

@ -57,6 +57,7 @@ __attribute__((always_inline)) inline const char *GetRawFileName(const char *pat
#define TELEPHONY_LOGW(fmt, args...) DECORATOR_HILOG(HILOG_WARN, fmt, ##args)
#define TELEPHONY_LOGI(fmt, args...) DECORATOR_HILOG(HILOG_INFO, fmt, ##args)
#define TELEPHONY_LOGF(fmt, args...) DECORATOR_HILOG(HILOG_FATAL, fmt, ##args)
#define TELEPHONY_LOGD(fmt, args...) DECORATOR_HILOG(HILOG_DEBUG, fmt, ##args)
#ifdef __cplusplus
}

View File

@ -64,6 +64,7 @@ inline constexpr const char *GetRawFileName(const char *path)
#define TELEPHONY_LOGW(fmt, ...) PRINT_TELEPHONY_LOG(Warn, fmt, ##__VA_ARGS__)
#define TELEPHONY_LOGI(fmt, ...) PRINT_TELEPHONY_LOG(Info, fmt, ##__VA_ARGS__)
#define TELEPHONY_LOGF(fmt, ...) PRINT_TELEPHONY_LOG(Fatal, fmt, ##__VA_ARGS__)
#define TELEPHONY_LOGD(fmt, ...) PRINT_TELEPHONY_LOG(Debug, fmt, ##__VA_ARGS__)
} // namespace Telephony
} // namespace OHOS
#endif // OHOS_TELEPHONY_LOG_WRAPPER_H