[Bugfix][T106BUG-397]Fix apn_type can be set to repeated values
Only Configure: No
Affected branch: master
Affected module: data
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I063fb840a68068ae8097a4edd2ba3aa7140b6f37
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index 489bf64..1296e7b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -549,6 +549,7 @@
//xmlDocPtr apn_table_xml_pdoc = NULL;
xmlNodePtr node = NULL;
xmlNodePtr modify_node = NULL;
+ xmlNodePtr check_node = NULL;
// apn_table_xml_pdoc = xmlReadFile(data_xml_path ,"UTF-8",XML_PARSE_RECOVER);
if(NULL == apn_table_xml_pdoc)
{
@@ -572,6 +573,23 @@
LYERRLOG("modify_node is null\n");
goto FAILED;
}
+ //check apn_type
+ check_node = modify_node;
+ while (check_node != NULL)
+ {
+ if (xmlGetProp(check_node, "profile_idx") == NULL) //Null Node
+ {
+ check_node = check_node->next;
+ continue;
+ }
+ else if(strcmp((char *)xmlGetProp(check_node, "apn_type"), apn->apn_type) == 0)
+ {
+ LYERRLOG("apntype already exists\n");
+ goto FAILED;
+ }
+ check_node = check_node->next;
+ }
+ //check apn_type end
for (node_num=0; node_num<(int)apn->profile_idx;node_num++)
{
if(modify_node == NULL)
@@ -1218,7 +1236,7 @@
{
return LYNQ_E_NO_INIT;
}
- if (NULL == apn)
+ if (NULL == apn || apn->profile_idx == 0)
{
LYERRLOG("apn set incoming paramters error");
return RESULT_ERROR;
@@ -1315,10 +1333,10 @@
{
return LYNQ_E_NO_INIT;
}
- if (profile_idx < 0 || profile_idx > 24)
+ if (profile_idx <= 0 || profile_idx > QSER_APN_MAX_LIST)
{
LYERRLOG("apn del incoming paramters error");
- return RESULT_OK;
+ return RESULT_ERROR;
}
int ret = 0;
ret = apn_xml_delete(profile_idx);