summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2023-05-11 16:48:59 +0800
committerfengweihao <[email protected]>2023-05-11 16:48:59 +0800
commit412d6f8944c521e3dfbeea0d749ac960018d6724 (patch)
tree43ce5b49e9c2613687dc2e42faeee9de7b67c87d
parentd94c81d7e6768b0aaf00038b12295647ee887a85 (diff)
修复正则匹配由于笔误造成返回的正则数组命名错误v3.0.7-20230512
-rw-r--r--platform/src/verify_policy.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/platform/src/verify_policy.cpp b/platform/src/verify_policy.cpp
index dbf3da6..ff02bf0 100644
--- a/platform/src/verify_policy.cpp
+++ b/platform/src/verify_policy.cpp
@@ -340,9 +340,8 @@ enum verify_type get_verify_type(cJSON* data_json)
static int get_query_result_regex(cJSON *verifylist_array_item, cJSON *data_obj)
{
int cur_id=0, i=0, is_valid[32]={0};
- cJSON *regexstr_obj[32];
+ cJSON *regexstr_obj[32],*attributes=NULL;
cJSON *item = NULL, *subchild = NULL;
- cJSON *attributes=NULL;
attributes = cJSON_GetObjectItem(verifylist_array_item, "verifyRegex");
if(attributes==NULL || attributes->type != cJSON_Array)
@@ -364,7 +363,7 @@ static int get_query_result_regex(cJSON *verifylist_array_item, cJSON *data_obj)
cJSON *verify_regex_obj=NULL;
cJSON *verifyRegex=cJSON_CreateArray();
- cJSON_AddItemToObject(data_obj, "attributes", verifyRegex);
+ cJSON_AddItemToObject(data_obj, "verifyRegex", verifyRegex);
for (i = 0; i < cur_id; i++)
{
verify_regex_obj=cJSON_CreateObject();
@@ -494,6 +493,7 @@ cJSON *get_query_from_request(const char *data, int thread_id)
cJSON_AddItemToObject(policy_obj, "data", data_obj);
int verify_type=get_verify_type(data_json);
+ mesa_runtime_log(RLOG_LV_DEBUG, " [I] verifyType= %d", verify_type);
cJSON *item = NULL, *subitem = NULL;
item = cJSON_GetObjectItem(data_json,"verifyList");
@@ -503,6 +503,7 @@ cJSON *get_query_from_request(const char *data, int thread_id)
{
if(verify_type == VERIFY_TYPE_REGEX)
{
+ mesa_runtime_log(RLOG_LV_DEBUG, " [I] data= %s", data);
hit_cnt = get_query_result_regex(subitem, data_obj);
}