summaryrefslogtreecommitdiff
path: root/platform/src/verify_policy.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2023-11-23 11:17:11 +0800
committerfengweihao <[email protected]>2023-11-23 11:17:11 +0800
commitfe9e8286f9d36a699e8a078da0ce1c13663566a6 (patch)
treec06433ed3546d9d2a28fbe77b606ee5e2ccdc0a1 /platform/src/verify_policy.cpp
parent5684fac24452c5665c39a8cdc197eca70f14a131 (diff)
TSG-17778 优化App ID、FQDN Category ID和Tunnel ID的处理逻辑,多次扫描支持非配置
Diffstat (limited to 'platform/src/verify_policy.cpp')
-rw-r--r--platform/src/verify_policy.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/platform/src/verify_policy.cpp b/platform/src/verify_policy.cpp
index 20eceb3..f175c59 100644
--- a/platform/src/verify_policy.cpp
+++ b/platform/src/verify_policy.cpp
@@ -376,6 +376,33 @@ static int get_query_result_regex(cJSON *verifylist_array_item, cJSON *data_obj)
return 1;
}
+static void get_count_form_attributeName(void *ctx, cJSON *subchild)
+{
+ cJSON *item = NULL;
+
+ item = cJSON_GetObjectItem(subchild, "attributeName");
+ if(item && item->type==cJSON_String)
+ {
+ if(0 == strcasecmp(item->valuestring, "tunnel_endpointa"))
+ {
+ verify_policy_tunnle_add(ctx);
+ }
+ if(0 == strcasecmp(item->valuestring, "tunnel_endpointb"))
+ {
+ verify_policy_tunnle_add(ctx);
+ }
+ if(0 == strcasecmp(item->valuestring, "req_hdr"))
+ {
+ http_req_hdr_num(ctx);
+ }
+ if(0 == strcasecmp(item->valuestring, "res_hdr"))
+ {
+ http_res_hdr_num(ctx);
+ }
+ }
+ return;
+}
+
int get_query_result_policy(cJSON *subitem, cJSON *data_obj, int thread_id)
{
int i = 0;
@@ -415,19 +442,7 @@ int get_query_result_policy(cJSON *subitem, cJSON *data_obj, int thread_id)
for (subchild = attributes->child; subchild != NULL; subchild = subchild->next)
{
- item = cJSON_GetObjectItem(subchild, "attributeName");
- if(item && item->type==cJSON_String)
- {
- if(0 == strcasecmp(item->valuestring, "tunnel_endpointa"))
- {
- verify_policy_tunnle_add(ctx);
- }
-
- if(0 == strcasecmp(item->valuestring, "tunnel_endpointb"))
- {
- verify_policy_tunnle_add(ctx);
- }
- }
+ get_count_form_attributeName(ctx, subchild);
}
for (subchild = attributes->child; subchild != NULL; subchild = subchild->next)