TSG-23454 Add key scan in http request header and response header.
TSG-23455 Change profile_name to content_name in Replace File policy. TSG-23424 Change tsg_policy_id to tsg_policy_uuid in Redirect policy.
This commit is contained in:
@@ -965,7 +965,7 @@ void ma_hijack_profile_table_new_cb(const char *table_name, const char* key, con
|
|||||||
{
|
{
|
||||||
ply_profile->profile_uuid = tfe_strdup(uuid->valuestring);
|
ply_profile->profile_uuid = tfe_strdup(uuid->valuestring);
|
||||||
}
|
}
|
||||||
cJSON *profile_name = cJSON_GetObjectItem(hihijack_files, "profile_name");
|
cJSON *profile_name = cJSON_GetObjectItem(hihijack_files, "content_name");
|
||||||
if(profile_name && profile_name->type==cJSON_String)
|
if(profile_name && profile_name->type==cJSON_String)
|
||||||
{
|
{
|
||||||
ply_profile->profile_name=tfe_strdup(profile_name->valuestring);
|
ply_profile->profile_name=tfe_strdup(profile_name->valuestring);
|
||||||
@@ -2214,10 +2214,10 @@ static int http_regex_replace(const struct tfe_stream * stream, char *message, c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcasestr(message,"{{tsg_policy_id}}") != NULL)
|
if(strcasestr(message,"{{tsg_policy_uuid}}") != NULL)
|
||||||
{
|
{
|
||||||
rule[n_rule].zone = kZoneRequestUri;
|
rule[n_rule].zone = kZoneRequestUri;
|
||||||
rule[n_rule].find = tfe_strdup("{{tsg_policy_id}}");
|
rule[n_rule].find = tfe_strdup("{{tsg_policy_uuid}}");
|
||||||
snprintf(replace_with, TFE_SYMBOL_MAX, "%s", profile_id_str);
|
snprintf(replace_with, TFE_SYMBOL_MAX, "%s", profile_id_str);
|
||||||
rule[n_rule].replace_with = tfe_strdup(replace_with);
|
rule[n_rule].replace_with = tfe_strdup(replace_with);
|
||||||
n_rule++;
|
n_rule++;
|
||||||
@@ -2892,6 +2892,19 @@ enum proxy_action http_scan(const struct tfe_http_session * session, enum tfe_ht
|
|||||||
{
|
{
|
||||||
hit_cnt += n_hit_result;
|
hit_cnt += n_hit_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * str_field_name = http_field_name_to_string(&field_name);
|
||||||
|
if(str_field_name == NULL)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
scan_ret = maat_scan_string(g_proxy_rt->feather, "TSG_OBJ_KEYWORD", attribute_name, str_field_name, strlen(str_field_name),
|
||||||
|
result + hit_cnt, MAX_SCAN_RESULT - hit_cnt, &n_hit_result, ctx->scan_mid);
|
||||||
|
if (scan_ret == MAAT_SCAN_HIT)
|
||||||
|
{
|
||||||
|
hit_cnt += n_hit_result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scan_ret = maat_scan_not_logic(g_proxy_rt->feather, "TSG_OBJ_KEYWORD", attribute_name, result + hit_cnt, MAX_SCAN_RESULT - hit_cnt,
|
scan_ret = maat_scan_not_logic(g_proxy_rt->feather, "TSG_OBJ_KEYWORD", attribute_name, result + hit_cnt, MAX_SCAN_RESULT - hit_cnt,
|
||||||
&n_hit_result, ctx->scan_mid);
|
&n_hit_result, ctx->scan_mid);
|
||||||
|
|||||||
@@ -183,15 +183,15 @@ TEST(PatternReplace, UrlReplace)
|
|||||||
char replace_with[TFE_SYMBOL_MAX]={0};
|
char replace_with[TFE_SYMBOL_MAX]={0};
|
||||||
char *rewrite_uri=NULL;
|
char *rewrite_uri=NULL;
|
||||||
|
|
||||||
const char *rd_url = "http://www.example.com/query?pageid=12345&policy_id={{tsg_policy_id}}&user_id={{tsg_subscriber_id}}&source_ip={{tsg_client_ip}}";
|
const char *rd_url = "http://www.example.com/query?pageid=12345&policy_id={{tsg_policy_uuid}}&user_id={{tsg_subscriber_id}}&source_ip={{tsg_client_ip}}";
|
||||||
|
|
||||||
struct replace_rule rule[3];
|
struct replace_rule rule[3];
|
||||||
memset(rule, 0, sizeof(struct replace_rule));
|
memset(rule, 0, sizeof(struct replace_rule));
|
||||||
|
|
||||||
if(strcasestr(rd_url,"{{tsg_policy_id}}") != NULL)
|
if(strcasestr(rd_url,"{{tsg_policy_uuid}}") != NULL)
|
||||||
{
|
{
|
||||||
rule[n_rule].zone = kZoneRequestUri;
|
rule[n_rule].zone = kZoneRequestUri;
|
||||||
rule[n_rule].find = tfe_strdup("{{tsg_policy_id}}");
|
rule[n_rule].find = tfe_strdup("{{tsg_policy_uuid}}");
|
||||||
snprintf(replace_with, TFE_SYMBOL_MAX, "%d", 23);
|
snprintf(replace_with, TFE_SYMBOL_MAX, "%d", 23);
|
||||||
rule[n_rule].replace_with = tfe_strdup(replace_with);
|
rule[n_rule].replace_with = tfe_strdup(replace_with);
|
||||||
n_rule++;
|
n_rule++;
|
||||||
|
|||||||
Reference in New Issue
Block a user