[Feature][T8TSK-338]The apn password is encrypted or masked in log --telephonyware
Only Configure:No
Affected branch:ALL
Affected module:RIL
Is it affected on both ZXIC and MTK: MTK
Self-test: Yes
Doc Update:No
Change-Id: I642e1bfb5fc8cd625d65d3f4c201a28b7081d1ec
diff --git a/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/data/RpDataController.cpp b/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/data/RpDataController.cpp
index d937316..9054404 100755
--- a/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/data/RpDataController.cpp
+++ b/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/data/RpDataController.cpp
@@ -1058,7 +1058,8 @@
dataProfiles[i].user = strdupReadString(p);
RFX_LOG_D(RFX_LOG_TAG,"%s %d user[%s]", __FUNCTION__, __LINE__, dataProfiles[i].user);
dataProfiles[i].password = strdupReadString(p);
- RFX_LOG_D(RFX_LOG_TAG,"%s %d password[%s]", __FUNCTION__, __LINE__, dataProfiles[i].password);
+ //RFX_LOG_D(RFX_LOG_TAG,"%s %d password[%s]", __FUNCTION__, __LINE__, dataProfiles[i].password);
+ RFX_LOG_D(RFX_LOG_TAG,"%s %d password[(has got)]", __FUNCTION__, __LINE__);
status = p->readInt32(&t);
dataProfiles[i].type = (int) t;
@@ -1135,8 +1136,10 @@
RFX_LOG_D(RFX_LOG_TAG,"user[%s]", dataProfilePtrs[i]->user);
if (dataProfilePtrs[i]->password)
- RFX_LOG_D(RFX_LOG_TAG,"password[%s]", dataProfilePtrs[i]->password);
-
+ //xy.he@20240524 modify for T8TSK-338 start
+ //RFX_LOG_D(RFX_LOG_TAG,"password[%s]", dataProfilePtrs[i]->password);
+ RFX_LOG_D(RFX_LOG_TAG,"password[(has got)]");
+ //xy.he@20240524 modify for T8TSK-338 end
RFX_LOG_D(RFX_LOG_TAG,"type[%d]", dataProfilePtrs[i]->type);
RFX_LOG_D(RFX_LOG_TAG,"dump APN info[%d] end", i);
diff --git a/IC_src/mtk/telephonyware/3.0/libvendor-ril/apn/src/apn_interface.cpp b/IC_src/mtk/telephonyware/3.0/libvendor-ril/apn/src/apn_interface.cpp
index 88e129b..e28c10f 100755
--- a/IC_src/mtk/telephonyware/3.0/libvendor-ril/apn/src/apn_interface.cpp
+++ b/IC_src/mtk/telephonyware/3.0/libvendor-ril/apn/src/apn_interface.cpp
@@ -142,7 +142,16 @@
record->columnIdx[record->count] = col;
record->values[record->count] = strdup(value);
record->count++;
- SLOGD("apn update irecord column (%d:%s)", col, value);
+ //xy.he@20240524 modify for T8TSK-338 start
+ SLOGD("apn update irecord %s",apn_get_prop_name(col));
+ if (strcmp(apn_get_prop_name(col), "password" ) == 0) {
+ SLOGD("apn update irecord column (%d:(has got))", col);
+ }
+ else
+ {
+ SLOGD("apn update irecord column (%d:%s)", col, value);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
return APN_OK;
}
@@ -168,8 +177,17 @@
string dump("");
for (int i = 0; i < record->count; i++) {
if (record->values[i] != NULL) {
- dump.append(apn_get_prop_name(record->columnIdx[i])).append("/").append(
- record->values[i]);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if (strcmp(apn_get_prop_name(record->columnIdx[i]), "password" ) == 0) {
+ dump.append(apn_get_prop_name(record->columnIdx[i])).append("/").append(
+ "(has got)");
+ }
+ else
+ {
+ dump.append(apn_get_prop_name(record->columnIdx[i])).append("/").append(
+ record->values[i]);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
}
if (i != (record->count - 1)) {
dump.append("; ");
diff --git a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.cpp b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.cpp
index 53385cb..212c95b 100755
--- a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.cpp
+++ b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/apn/RpApnController.cpp
@@ -67,6 +67,7 @@
#define APNDB_READY (1)
#define APNDB_NOTREADY (0)
bool gApnDoneCond_flag = APNDB_NOTREADY;
+char prop_name[20] = {0};
using std::string;
@@ -191,6 +192,57 @@
}
}
+//xy.he@20240524 modify for T8TSK-338 start
+void string_to_hex(unsigned char *Buff, unsigned int BuffLen, char *OutputStr)
+{
+ int i = 0;
+ char TempBuff[512*2 + 1] = {0};
+ char strBuff[512*2 + 1] = {0};
+ if(BuffLen > 512)
+ {
+ RLOGD("string_to_hex error!");
+ return;
+ }
+ for(i = 0; i<BuffLen;i++)
+ {
+ sprintf(TempBuff,"%02x",(unsigned char)Buff[i]);
+ strncat(strBuff,TempBuff,BuffLen*2);
+ }
+ strncpy(OutputStr, strBuff, BuffLen*2);
+ return;
+}
+void encode_log(const char input_str[], int n, int column)
+{
+ char c;
+ int i;
+ char str[512*2 + 1] = {0};
+ string_to_hex((unsigned char *)input_str, strlen(input_str), str);
+ for( i=0; i<strlen(str); i++)
+ {
+ c = str[i];
+ if(c>=' ' && c <= 'z')
+ {
+ if(c + n%90 <= 'z')
+ {
+ str[i] = (char)(c + n%90); //encode
+ }
+ else
+ { //After encoding, the space beyond the end reaches ‘z’, and the cycle starts from the beginning.
+ str[i] = (char)(c + n%90 - 90);//encode
+ }
+ }
+ else
+ {
+ str[i]=c;
+ }
+ }
+ RLOGD("[%d] encode:%s", column,str);
+
+}
+
+//xy.he@20240524 modify for T8TSK-338 end
+
+
void RpApnController::InsertApnRecord(const sp<RfxMessage>& message){
char *record;
Parcel *parcel;
@@ -203,7 +255,16 @@
generateApnDB();
parcel = message->getParcel();
record = RpDataUtils::strdupReadString(parcel);
- logD(RFX_LOG_TAG, "[InsertApnRecord] record : %s", record);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if(strstr(record,"password") != NULL)
+ {
+ encode_log(record,6,__LINE__);
+ }
+ else
+ {
+ logD(RFX_LOG_TAG, "[InsertApnRecord] record = %s", record);
+ }
+ //xy.he@20240524 modify for T8TSK-338 start
result = parseRecord(record, apn_record);
if(false == result || 0 == apn_record->count) {
response = RfxMessage::obtainResponse(RIL_E_GENERIC_FAILURE, message);
@@ -349,6 +410,8 @@
}
}
}
+
+
bool RpApnController::parseRecord(const char *record, apn_record_t * apn_record) {
const char *instance;
char *value;
@@ -368,18 +431,35 @@
if (NULL == instance) {
continue;
} else {
+ //xy.he@20240524 modify for T8TSK-338 start
+ strcpy(prop_name,apn_get_prop_name(i));
value = getPropValue(instance);
-
if(checkIfEmptyValue(value))
{
- logD(RFX_LOG_TAG, "[parseRecord]input instance: %s, value null", instance);
+ if(strstr(instance,"password") != NULL)
+ {
+ encode_log(instance,6,__LINE__);
+ }
+ else
+ {
+ logD(RFX_LOG_TAG, "[parseRecord]input instance: %s, value null", instance);
+ }
apn_build_iRecord(apn_record, i, "");
}
else
{
- logD(RFX_LOG_TAG, "[parseRecord]input instance: %s, value=%s", instance, value);
+ if(strstr(instance,"password") != NULL)
+ {
+ encode_log(instance,6,__LINE__);
+ }
+ else
+ {
+ logD(RFX_LOG_TAG, "[parseRecord]input instance: %s, value=%s", instance, value);
+ }
apn_build_iRecord(apn_record, i, value);
}
+ bzero(prop_name,20);
+ //xy.he@20240524 modify for T8TSK-338 end
}
}
if (NULL != value)
@@ -403,7 +483,16 @@
string[i] = value[i];
}
}
- logD(RFX_LOG_TAG, "[checkIfEmptyValue] before transfer value = %s, after transfer string = %s", value, string);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if(strcmp(prop_name,"password") == 0)
+ {
+ logD(RFX_LOG_TAG, "[checkIfEmptyValue] before transfer value = (has got), after transfer string = (has got)");
+ }
+ else
+ {
+ logD(RFX_LOG_TAG, "[checkIfEmptyValue] before transfer value = %s, after transfer string = %s", value, string);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
if(!strncmp(string, "null", 4)) {
free(string);
return true;
@@ -437,8 +526,16 @@
std::size_t found = 0;
int i = 0;
bool result = false;
-
- logD(RFX_LOG_TAG, "[getPropValue]input string: %s", string);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if(strstr(string,"password") == NULL)
+ {
+ logD(RFX_LOG_TAG, "[getPropValue]input string: %s", string);
+ }
+ else
+ {
+ encode_log(string,6,__LINE__);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
while((';' != *string) && ('\0' != *string)) {
if ('=' == *string) {
string++;
@@ -477,7 +574,16 @@
return_value = (char *)calloc(1, target.length() + 1);
strncpy(return_value, target.c_str(), target.length());
}
- logD(RFX_LOG_TAG, "[getPropValue] return_value : %s", return_value);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if(strcmp(prop_name,"password"))
+ {
+ logD(RFX_LOG_TAG, "[getPropValue] return_value : (has got)", return_value);
+ }
+ else
+ {
+ logD(RFX_LOG_TAG, "[getPropValue] return_value : %s", return_value);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
return return_value;
}
@@ -492,7 +598,16 @@
generateApnDB();
parcel = message->getParcel();
record = RpDataUtils::strdupReadString(parcel);
- logD(RFX_LOG_TAG, "[DeleteApnRecord] record = %s", record);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if(strstr(record,"password") != NULL)
+ {
+ encode_log(record,6,__LINE__);
+ }
+ else
+ {
+ logD(RFX_LOG_TAG, "[DeleteApnRecord] record = %s", record);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
result = parseRecord(record, apn_record);
if(false == result || 0 == apn_record->count) {
response = RfxMessage::obtainResponse(RIL_E_GENERIC_FAILURE, message);
@@ -549,6 +664,8 @@
}
}
}
+
+
RpDataUtils::freeMemory(record);
apn_free_record(apn_record);
apn_free_record(apn_record_id);
@@ -561,11 +678,21 @@
bool result;
sp<RfxMessage> response;
apn_list_t * apn_list = NULL;
+ char * tmp_record = NULL;
generateApnDB();
parcel = message->getParcel();
record = RpDataUtils::strdupReadString(parcel);
- logD(RFX_LOG_TAG, "[QueryApnRecord] record = %s", record);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if(strstr(record,"password") != NULL)
+ {
+ encode_log(record,6,__LINE__);
+ }
+ else
+ {
+ logD(RFX_LOG_TAG, "[QueryApnRecord] record = %s", record);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
result = parseRecord(record, apn_record);
if(false == result || 0 == apn_record->count) {
response = RfxMessage::obtainResponse(RIL_E_GENERIC_FAILURE, message);
@@ -597,6 +724,8 @@
responseToRilj(response);
}
}
+
+
apn_free_list(apn_list);
apn_free_record(apn_record);
}
@@ -635,7 +764,16 @@
generateApnDB();
parcel = message->getParcel();
record = RpDataUtils::strdupReadString(parcel);
- logD(RFX_LOG_TAG, "[UpdateApnRecord] record = %s", record);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if(strstr(record,"password") != NULL)
+ {
+ encode_log(record,6,__LINE__);
+ }
+ else
+ {
+ logD(RFX_LOG_TAG, "[UpdateApnRecord] record = %s", record);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
result = parseRecord(record, apn_record);
if(false == result || apn_record->count <= 1) {
response = RfxMessage::obtainResponse(RIL_E_GENERIC_FAILURE, message);
@@ -940,7 +1078,16 @@
int ret = 0;
for(int i = 0; i < apn->count; i++)
{
- logD(RFX_LOG_TAG," %s : %s \n",apn_get_prop_name(apn->columnIdx[i]),apn->values[i]);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if(strcmp(apn_get_prop_name(apn->columnIdx[i]),"password") == 0)
+ {
+ logD(RFX_LOG_TAG," %s : (has got) \n",apn_get_prop_name(apn->columnIdx[i]));
+ }
+ else
+ {
+ logD(RFX_LOG_TAG," %s : %s \n",apn_get_prop_name(apn->columnIdx[i]),apn->values[i]);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
switch(apn->columnIdx[i])
{
case APN_PROP_iTYPE:
@@ -1226,13 +1373,23 @@
for(int i = 0; i < dpsSize; i++)
{
logD(RFX_LOG_TAG,"dps[%d]\n",i);
+ //xy.he@20240524 modify for T8TSK-338 start
+ /**
logD(RFX_LOG_TAG,"dps[%d]: profileId:%d, apn:%s, protocol:%s, authType:%d,"
"user=%s, password=%s, type=%d,maxConnsTime=%d, maxConns=%d,"
"waitTime=%d,enabled=%d ",
i,dps[i].profileId,dps[i].apn,dps[i].protocol,dps[i].authType,
dps[i].user,dps[i].password,dps[i].type,dps[i].maxConnsTime,dps[i].maxConns,
dps[i].waitTime,dps[i].enabled);
+ **/
+ logD(RFX_LOG_TAG,"dps[%d]: profileId:%d, apn:%s, protocol:%s, authType:%d,"
+ "user=%s, password=(has got), type=%d,maxConnsTime=%d, maxConns=%d,"
+ "waitTime=%d,enabled=%d ",
+ i,dps[i].profileId,dps[i].apn,dps[i].protocol,dps[i].authType,
+ dps[i].user,dps[i].type,dps[i].maxConnsTime,dps[i].maxConns,
+ dps[i].waitTime,dps[i].enabled);
+ //xy.he@20240524 modify for T8TSK-338 end
newParcel->writeInt32(dps[i].profileId);
char16_t *pString16;
size_t len16;
@@ -1310,7 +1467,16 @@
int ret = 0;
for(int i = 0; i < record->count; i++)
{
- logD(RFX_LOG_TAG," %s : %s \n",apn_get_prop_name(record->columnIdx[i]),record->values[i]);
+ //xy.he@20240524 modify for T8TSK-338 start
+ if(strcmp(apn_get_prop_name(record->columnIdx[i]),"password") == 0)
+ {
+ logD(RFX_LOG_TAG," %s : (has got) \n",apn_get_prop_name(record->columnIdx[i]));
+ }
+ else
+ {
+ logD(RFX_LOG_TAG," %s : %s \n",apn_get_prop_name(record->columnIdx[i]),record->values[i]);
+ }
+ //xy.he@20240524 modify for T8TSK-338 end
switch(record->columnIdx[i])
{
case APN_PROP_iCARRIER:
diff --git a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/data/DataConnection.cpp b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/data/DataConnection.cpp
index 1eaacf3..0bd3f88 100644
--- a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/data/DataConnection.cpp
+++ b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/data/DataConnection.cpp
@@ -58,8 +58,10 @@
void DataConnection::setupDataCall(string apnType, const sp<RfxMessage>& setupDataRequest, int radioTech, int profileId, string apn,
string user, string password, int authType, string protocol, int interface_id) {
RFX_LOG_D(RFX_LOG_TAG, "DataConnection(%d)::setupDataCall with original request %s", mCId, RpDataUtils::requestOrUrcToString(setupDataRequest->getId()));
- RFX_LOG_D(RFX_LOG_TAG, "DataConnection(%d)::setupDataCall, apnType: %s, radioTech: %d, profileId: %d, apn: %s, user: %s, password: %s, authType: %d, protocol: %s, id: %d",
- mCId, apnType.c_str(), radioTech, profileId, apn.c_str(), user.c_str(), password.c_str(), authType, protocol.c_str(), interface_id);
+ //xy.he@20240524 modify for T8TSK-338 start
+ RFX_LOG_D(RFX_LOG_TAG, "DataConnection(%d)::setupDataCall, apnType: %s, radioTech: %d, profileId: %d, apn: %s, user: %s, password: (has got), authType: %d, protocol: %s, id: %d",
+ mCId, apnType.c_str(), radioTech, profileId, apn.c_str(), user.c_str(), authType, protocol.c_str(), interface_id);
+ //xy.he@20240524 modify for T8TSK-338 end
Parcel* parcel = setupDataRequest->getParcel();
// make sure the position for writing data right.
parcel->setDataPosition(sizeof(int32_t)*2);
diff --git a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/sdk/Rfx_data_service.c b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/sdk/Rfx_data_service.c
index 85a1802..3ccbc40 100755
--- a/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/sdk/Rfx_data_service.c
+++ b/IC_src/mtk/telephonyware/3.0/libvendor-ril/mtk-rilproxy/telephony/sdk/Rfx_data_service.c
@@ -236,7 +236,9 @@
g_mutex_lock(&g_mutex);
g_variant_get (parameters, "(is)", &cmd, &record);
- RLOGD( "modifyApnDB, cmd : %d, record : %s", cmd, record);
+ //xy.he@20240524 modify for T8TSK-338 start
+ RLOGD( "modifyApnDB, cmd : %d, record : (has got)", cmd);
+ //xy.he@20240524 modify for T8TSK-338 end
if(sToken == G_MAXINT32) sToken = 0;
g_atomic_int_inc(&sToken);
RequestInfo *requestInfo = (RequestInfo *)g_try_malloc0(sizeof(RequestInfo));