diff options
| author | root <[email protected]> | 2024-10-08 11:10:03 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2024-10-08 11:10:03 +0000 |
| commit | 35667246d3c23976e1200ee369683ea89ffbbaba (patch) | |
| tree | c00a1869c2d8695475b595d0696ea3e9cebd92ef | |
| parent | 3bbbd53f393927b2e1de784a70deee9d8694b195 (diff) | |
use attribute_name instead of attribute_id to map condition_id
| -rw-r--r-- | include/maat.h | 6 | ||||
| -rw-r--r-- | src/inc_internal/maat_expr.h | 4 | ||||
| -rw-r--r-- | src/inc_internal/maat_flag.h | 2 | ||||
| -rw-r--r-- | src/inc_internal/maat_interval.h | 2 | ||||
| -rw-r--r-- | src/inc_internal/maat_ip.h | 2 | ||||
| -rw-r--r-- | src/inc_internal/maat_rule.h | 4 | ||||
| -rw-r--r-- | src/inc_internal/maat_table.h | 3 | ||||
| -rw-r--r-- | src/maat_api.c | 86 | ||||
| -rw-r--r-- | src/maat_expr.c | 8 | ||||
| -rw-r--r-- | src/maat_flag.c | 4 | ||||
| -rw-r--r-- | src/maat_interval.c | 4 | ||||
| -rw-r--r-- | src/maat_ip.c | 4 | ||||
| -rw-r--r-- | src/maat_rule.c | 120 | ||||
| -rw-r--r-- | src/maat_table.c | 118 | ||||
| -rw-r--r-- | test/json_update/corrupted.json | 4 | ||||
| -rw-r--r-- | test/json_update/new.json | 4 | ||||
| -rw-r--r-- | test/json_update/old.json | 2 | ||||
| -rw-r--r-- | test/maat_framework_gtest.cpp | 389 | ||||
| -rw-r--r-- | test/maat_json.json | 620 | ||||
| -rw-r--r-- | test/table_info.json | 2 | ||||
| -rw-r--r-- | test/test_utils.cpp | 39 |
21 files changed, 737 insertions, 690 deletions
diff --git a/include/maat.h b/include/maat.h index 5da5c8c..c6bba19 100644 --- a/include/maat.h +++ b/include/maat.h @@ -25,12 +25,14 @@ extern "C" #include <netinet/in.h> #include <uuid/uuid.h> +#define MAX_ATTR_NAME_LEN 128 + /* maat instance handle */ struct maat; struct maat_hit_path { int Nth_scan; - char *attribute_name; // 0 is not a attribute. + char attribute_name[MAX_ATTR_NAME_LEN]; // 0 is not a attribute. int negate_option; // 1 means negate condition(condition) int condition_index; // 0 ~ 7 uuid_t item_uuid; @@ -42,7 +44,7 @@ struct maat_hit_path { struct maat_hit_object { uuid_t item_uuid; uuid_t object_uuid; - char *attribute_name; + char attribute_name[MAX_ATTR_NAME_LEN]; }; enum maat_scan_status { diff --git a/src/inc_internal/maat_expr.h b/src/inc_internal/maat_expr.h index 716a76b..a5dfc77 100644 --- a/src/inc_internal/maat_expr.h +++ b/src/inc_internal/maat_expr.h @@ -50,12 +50,12 @@ long long expr_runtime_get_version(void *expr_runtime); * @retval the num of hit object_id */ int expr_runtime_scan(struct expr_runtime *expr_rt, int thread_id, const char *data, - size_t data_len, int attribute_id, struct maat_state *state); + size_t data_len, const char *attribute_name, struct maat_state *state); struct expr_runtime_stream *expr_runtime_stream_open(struct expr_runtime *expr_rt, int thread_id); int expr_runtime_stream_scan(struct expr_runtime_stream *expr_rt_stream, const char *data, - size_t data_len, int attribute_id, struct maat_state *state); + size_t data_len, const char *attribute_name, struct maat_state *state); void expr_runtime_stream_close(struct expr_runtime_stream *expr_rt_stream); diff --git a/src/inc_internal/maat_flag.h b/src/inc_internal/maat_flag.h index cac9461..c89d64b 100644 --- a/src/inc_internal/maat_flag.h +++ b/src/inc_internal/maat_flag.h @@ -48,7 +48,7 @@ long long flag_runtime_rule_count(void *flag_runtime); * @retval the num of hit object_id */ int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id, long long flag, - int attribute_id, struct maat_state *state); + const char *attribute_name, struct maat_state *state); void flag_runtime_perf_stat(struct flag_runtime *flag_rt, struct timespec *start, struct timespec *end, int thread_id); diff --git a/src/inc_internal/maat_interval.h b/src/inc_internal/maat_interval.h index 82940b8..a795917 100644 --- a/src/inc_internal/maat_interval.h +++ b/src/inc_internal/maat_interval.h @@ -49,7 +49,7 @@ long long interval_runtime_rule_count(void *interval_runtime); * @retval the num of hit object_id */ int interval_runtime_scan(struct interval_runtime *interval_rt, int thread_id, - long long integer, int attribute_id, struct maat_state *state); + long long integer, const char *attribute_name, struct maat_state *state); void interval_runtime_perf_stat(struct interval_runtime *interval_rt, struct timespec *start, struct timespec *end, diff --git a/src/inc_internal/maat_ip.h b/src/inc_internal/maat_ip.h index 5e8a95f..12b337c 100644 --- a/src/inc_internal/maat_ip.h +++ b/src/inc_internal/maat_ip.h @@ -42,7 +42,7 @@ long long ip_runtime_ipv6_rule_count(void *ip_runtime); /* ip runtime scan API */ int ip_runtime_scan(struct ip_runtime *ip_rt, int thread_id, int ip_type, - uint8_t *ip_addr, int port, int attribute_id, struct maat_state *state); + uint8_t *ip_addr, int port, const char *attribute_name, struct maat_state *state); void ip_runtime_perf_stat(struct ip_runtime *ip_rt, struct timespec *start, struct timespec *end, int thread_id); diff --git a/src/inc_internal/maat_rule.h b/src/inc_internal/maat_rule.h index f1bbb07..11e15d8 100644 --- a/src/inc_internal/maat_rule.h +++ b/src/inc_internal/maat_rule.h @@ -69,14 +69,14 @@ void rule_compile_state_free(struct rule_compile_state *rule_compile_state, struct maat *maat_instance, int thread_id); int rule_compile_state_update(struct rule_compile_state *rule_compile_state, struct maat *maat_inst, - int attribute_id, int custom_rule_tbl_id, int Nth_scan, + const char *attribute_name, int custom_rule_tbl_id, int Nth_scan, struct maat_item *hit_items, size_t n_hit_item); void rule_compile_state_clear_last_hit_object(struct rule_compile_state *rule_state); void rule_compile_state_not_logic_update(struct rule_compile_state *rule_compile_state, struct rule_runtime *rule_rt, - struct maat *maat_inst, int attribute_id, + struct maat *maat_inst, const char *attribute_name, int Nth_scan); size_t rule_compile_state_get_internal_hit_paths(struct rule_compile_state *rule_compile_state, diff --git a/src/inc_internal/maat_table.h b/src/inc_internal/maat_table.h index 2b0d65a..bb360b2 100644 --- a/src/inc_internal/maat_table.h +++ b/src/inc_internal/maat_table.h @@ -56,8 +56,6 @@ size_t table_manager_table_size(struct table_manager *tbl_mgr); size_t table_manager_table_num(struct table_manager *tbl_mgr); int table_manager_get_table_id(struct table_manager *tbl_mgr, const char *table_name); -int table_manager_get_attribute_id(struct table_manager *tbl_mgr, const char *attribute_name); -int table_manager_attribute_register(struct table_manager *tbl_mgr, const char *attribute_name, struct log_handle *logger); /** * @brief get table_name's all conjunction parents' table_id @@ -77,7 +75,6 @@ int table_manager_get_conj_parent_table_ids(struct table_manager *tbl_mgr, const int maat_get_table_id(struct maat *maat_inst, const char *table_name); const char *table_manager_get_table_name(struct table_manager *tbl_mgr, int table_id); -const char *table_manager_get_attribute_name(struct table_manager *tbl_mgr, int attr_id); const char *table_manager_get_table_schema_tag(struct table_manager *tbl_mgr, int table_id); diff --git a/src/maat_api.c b/src/maat_api.c index 25451d5..3db07af 100644 --- a/src/maat_api.c +++ b/src/maat_api.c @@ -55,8 +55,8 @@ struct maat_stream { long long expr_rt_version; struct log_handle *logger; int thread_id; - int attribute_id; int table_id; + char attribute_name[MAX_ATTR_NAME_LEN]; }; struct maat_options* maat_options_new(void) @@ -1024,7 +1024,7 @@ int maat_bool_plugin_table_get_ex_data(struct maat *maat_inst, const char *table static int flag_scan(struct table_manager *tbl_mgr, int thread_id, long long flag, - int table_id, int attribute_id, struct maat_state *state) + int table_id, const char *attribute_name, struct maat_state *state) { enum table_type table_type = table_manager_get_table_type(tbl_mgr, table_id); @@ -1041,7 +1041,7 @@ flag_scan(struct table_manager *tbl_mgr, int thread_id, long long flag, flag_runtime_scan_times_inc((struct flag_runtime *)flag_rt, thread_id); int object_hit_cnt = flag_runtime_scan((struct flag_runtime *)flag_rt, - thread_id, flag, attribute_id, state); + thread_id, flag, attribute_name, state); if (object_hit_cnt <= 0) { return object_hit_cnt; } @@ -1053,7 +1053,7 @@ flag_scan(struct table_manager *tbl_mgr, int thread_id, long long flag, static int interval_scan(struct table_manager *tbl_mgr, int thread_id, long long integer, - int table_id, int attribute_id, struct maat_state *state) + int table_id, const char *attribute_name, struct maat_state *state) { enum table_type table_type = @@ -1071,7 +1071,7 @@ interval_scan(struct table_manager *tbl_mgr, int thread_id, long long integer, interval_runtime_scan_times_inc((struct interval_runtime *)interval_rt, thread_id); int object_hit_cnt = interval_runtime_scan((struct interval_runtime *)interval_rt, - thread_id, integer, attribute_id, state); + thread_id, integer, attribute_name, state); if (object_hit_cnt <= 0) { return object_hit_cnt; } @@ -1083,7 +1083,7 @@ interval_scan(struct table_manager *tbl_mgr, int thread_id, long long integer, static int ipv4_scan(struct table_manager *tbl_mgr, int thread_id, uint32_t ip_addr, - int port, int table_id, int attribute_id, struct maat_state *state) + int port, int table_id, const char *attribute_name, struct maat_state *state) { enum table_type table_type = @@ -1100,7 +1100,7 @@ ipv4_scan(struct table_manager *tbl_mgr, int thread_id, uint32_t ip_addr, ip_runtime_scan_times_inc(ip_rt, thread_id); int object_hit_cnt = ip_runtime_scan((struct ip_runtime *)ip_rt, thread_id, IPv4, - (uint8_t *)&ip_addr, port, attribute_id, state); + (uint8_t *)&ip_addr, port, attribute_name, state); if (object_hit_cnt <= 0) { return object_hit_cnt; } @@ -1112,7 +1112,7 @@ ipv4_scan(struct table_manager *tbl_mgr, int thread_id, uint32_t ip_addr, static int ipv6_scan(struct table_manager *tbl_mgr, int thread_id, uint8_t *ip_addr, - int port, int table_id, int attribute_id, struct maat_state *state) + int port, int table_id, const char *attribute_name, struct maat_state *state) { enum table_type table_type = @@ -1129,7 +1129,7 @@ ipv6_scan(struct table_manager *tbl_mgr, int thread_id, uint8_t *ip_addr, ip_runtime_scan_times_inc(ip_rt, thread_id); int object_hit_cnt = ip_runtime_scan((struct ip_runtime *)ip_rt, thread_id, IPv6, - ip_addr, port, attribute_id, state); + ip_addr, port, attribute_name, state); if (object_hit_cnt <= 0) { return object_hit_cnt; } @@ -1142,7 +1142,7 @@ ipv6_scan(struct table_manager *tbl_mgr, int thread_id, uint8_t *ip_addr, static int string_scan(struct table_manager *tbl_mgr, int thread_id, const char *data, size_t data_len, int table_id, - int attribute_id, struct maat_state *state) + const char *attribute_name, struct maat_state *state) { enum table_type table_type = table_manager_get_table_type(tbl_mgr, table_id); @@ -1161,7 +1161,7 @@ string_scan(struct table_manager *tbl_mgr, int thread_id, int object_hit_cnt = expr_runtime_scan((struct expr_runtime *)expr_rt, thread_id, data, data_len, - attribute_id, state); + attribute_name, state); if (object_hit_cnt <= 0) { return object_hit_cnt; } @@ -1213,11 +1213,6 @@ int maat_scan_flag(struct maat *maat_inst, const char *table_name, const char *a maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; } - int attribute_id = table_manager_get_attribute_id(maat_inst->tbl_mgr, attribute_name); - if (attribute_id < 0) { - maat_inst->stat->scan_err_cnt++; - return MAAT_SCAN_ERR; - } struct maat_runtime *maat_rt = maat_inst->maat_rt; if (NULL == maat_rt) { @@ -1233,7 +1228,7 @@ int maat_scan_flag(struct maat *maat_inst, const char *table_name, const char *a alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1); int hit_object_cnt = flag_scan(maat_inst->tbl_mgr, state->thread_id, flag, - table_id, attribute_id, state); + table_id, attribute_name, state); if (hit_object_cnt < 0) { maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; @@ -1294,11 +1289,6 @@ int maat_scan_integer(struct maat *maat_inst, const char *table_name, const char maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; } - int attribute_id = table_manager_get_attribute_id(maat_inst->tbl_mgr, attribute_name); - if (attribute_id < 0) { - maat_inst->stat->scan_err_cnt++; - return MAAT_SCAN_ERR; - } struct maat_runtime *maat_rt = maat_inst->maat_rt; if (NULL == maat_rt) { @@ -1314,7 +1304,7 @@ int maat_scan_integer(struct maat *maat_inst, const char *table_name, const char alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1); int hit_object_cnt = interval_scan(maat_inst->tbl_mgr, state->thread_id, integer, - table_id, attribute_id, state); + table_id, attribute_name, state); if (hit_object_cnt < 0) { maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; @@ -1375,11 +1365,6 @@ int maat_scan_ipv4_port(struct maat *maat_inst, const char *table_name, const ch maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; } - int attribute_id = table_manager_get_attribute_id(maat_inst->tbl_mgr, attribute_name); - if (attribute_id < 0) { - maat_inst->stat->scan_err_cnt++; - return MAAT_SCAN_ERR; - } struct maat_runtime *maat_rt = maat_inst->maat_rt; if (NULL == maat_rt) { @@ -1395,7 +1380,7 @@ int maat_scan_ipv4_port(struct maat *maat_inst, const char *table_name, const ch alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1); int hit_object_cnt = ipv4_scan(maat_inst->tbl_mgr, state->thread_id, ip_addr, port, - table_id, attribute_id, state); + table_id, attribute_name, state); if (hit_object_cnt < 0) { maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; @@ -1456,11 +1441,6 @@ int maat_scan_ipv6_port(struct maat *maat_inst, const char *table_name, const ch maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; } - int attribute_id = table_manager_get_attribute_id(maat_inst->tbl_mgr, attribute_name); - if (attribute_id < 0) { - maat_inst->stat->scan_err_cnt++; - return MAAT_SCAN_ERR; - } struct maat_runtime *maat_rt = maat_inst->maat_rt; if (NULL == maat_rt) { @@ -1476,7 +1456,7 @@ int maat_scan_ipv6_port(struct maat *maat_inst, const char *table_name, const ch alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1); int hit_object_cnt = ipv6_scan(maat_inst->tbl_mgr, state->thread_id, ip_addr, port, - table_id, attribute_id, state); + table_id, attribute_name, state); if (hit_object_cnt < 0) { maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; @@ -1555,11 +1535,6 @@ int maat_scan_string(struct maat *maat_inst, const char *table_name, const char maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; } - int attribute_id = table_manager_get_attribute_id(maat_inst->tbl_mgr, attribute_name); - if (attribute_id < 0) { - maat_inst->stat->scan_err_cnt++; - return MAAT_SCAN_ERR; - } struct maat_runtime *maat_rt = maat_inst->maat_rt; if (NULL == maat_rt) { @@ -1575,7 +1550,7 @@ int maat_scan_string(struct maat *maat_inst, const char *table_name, const char alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1); int hit_object_cnt = string_scan(maat_inst->tbl_mgr, state->thread_id, data, - data_len, table_id, attribute_id, state); + data_len, table_id, attribute_name, state); if (hit_object_cnt < 0) { maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; @@ -1615,7 +1590,7 @@ int maat_scan_string(struct maat *maat_inst, const char *table_name, const char } } -static void maat_state_add_hit_object(struct maat_state *state, int attribute_id, +static void maat_state_add_hit_object(struct maat_state *state, const char *attribute_name, struct maat_hit_object *objects, size_t n_object) { struct maat *maat_inst = state->maat_inst; @@ -1642,13 +1617,13 @@ static void maat_state_add_hit_object(struct maat_state *state, int attribute_id uuid_copy(hit_items[i].object_uuid, objects[i].object_uuid); } - rule_compile_state_update(state->rule_compile_state, maat_inst, attribute_id, + rule_compile_state_update(state->rule_compile_state, maat_inst, attribute_name, state->rule_table_id, state->Nth_scan, hit_items, n_hit_item); } static void -maat_state_activate_hit_not_object(struct maat_state *state, int attribute_id) +maat_state_activate_hit_not_object(struct maat_state *state, const char *attribute_name) { if (NULL == state) { return; @@ -1673,7 +1648,7 @@ maat_state_activate_hit_not_object(struct maat_state *state, int attribute_id) } rule_compile_state_not_logic_update(state->rule_compile_state, rule_rt, maat_inst, - attribute_id, state->Nth_scan); + attribute_name, state->Nth_scan); } int maat_scan_object(struct maat *maat_inst, const char *table_name, const char *attribute_name, @@ -1694,11 +1669,6 @@ int maat_scan_object(struct maat *maat_inst, const char *table_name, const char maat_inst->stat->scan_err_cnt++; return MAAT_SCAN_ERR; } - int attribute_id = table_manager_get_attribute_id(maat_inst->tbl_mgr, attribute_name); - if (attribute_id < 0) { - maat_inst->stat->scan_err_cnt++; - return MAAT_SCAN_ERR; - } struct maat_runtime *maat_rt = maat_inst->maat_rt; if (NULL == maat_rt) { @@ -1708,7 +1678,7 @@ int maat_scan_object(struct maat *maat_inst, const char *table_name, const char maat_runtime_ref_inc(maat_rt, state->thread_id); alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1); - maat_state_add_hit_object(state, attribute_id, objects, n_object); + maat_state_add_hit_object(state, attribute_name, objects, n_object); size_t hit_rule_cnt = object_to_rule(maat_inst, results, n_result, state); *n_hit_result = hit_rule_cnt; @@ -1735,11 +1705,6 @@ int maat_scan_not_logic(struct maat *maat_inst, const char *table_name, const ch return 0; } - int attribute_id = table_manager_get_attribute_id(maat_inst->tbl_mgr, attribute_name); - if (attribute_id < 0) { - return -1; - } - struct maat_runtime *maat_rt = maat_inst->maat_rt; if (NULL == maat_rt) { return MAAT_SCAN_OK; @@ -1748,7 +1713,7 @@ int maat_scan_not_logic(struct maat *maat_inst, const char *table_name, const ch maat_runtime_ref_inc(maat_rt, state->thread_id); alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1); - maat_state_activate_hit_not_object(state, attribute_id); + maat_state_activate_hit_not_object(state, attribute_name); size_t hit_rule_cnt = object_to_rule(maat_inst, results, n_result, state); *n_hit_result = hit_rule_cnt; @@ -1773,7 +1738,7 @@ struct maat_stream *maat_stream_new(struct maat *maat_inst, const char *table_na stream->last_full_version = maat_inst->last_full_version; stream->thread_id = state->thread_id; stream->table_id = table_manager_get_table_id(maat_inst->tbl_mgr, table_name); - stream->attribute_id = table_manager_get_attribute_id(maat_inst->tbl_mgr, attribute_name); + snprintf(stream->attribute_name, sizeof(stream->attribute_name), "%s", attribute_name); stream->logger = maat_inst->logger; enum table_type table_type = TABLE_TYPE_INVALID; @@ -1781,9 +1746,6 @@ struct maat_stream *maat_stream_new(struct maat *maat_inst, const char *table_na if (stream->table_id < 0) { goto error; } - if (stream->attribute_id < 0) { - goto error; - } table_type = table_manager_get_table_type(maat_inst->tbl_mgr, stream->table_id); @@ -1835,7 +1797,7 @@ static int expr_stream_scan(struct maat_stream *stream, const char *data, data_len); int object_hit_cnt = expr_runtime_stream_scan(stream->expr_rt_stream, data, - data_len, stream->attribute_id, state); + data_len, stream->attribute_name, state); if (object_hit_cnt <= 0) { return object_hit_cnt; } diff --git a/src/maat_expr.c b/src/maat_expr.c index 39b7b09..202befc 100644 --- a/src/maat_expr.c +++ b/src/maat_expr.c @@ -812,7 +812,7 @@ long long expr_runtime_get_version(void *expr_runtime) int expr_runtime_scan(struct expr_runtime *expr_rt, int thread_id, const char *data, size_t data_len, - int attribute_id, struct maat_state *state) + const char *attribute_name, struct maat_state *state) { //clear rule_state->last_hit_object if (state != NULL && state->rule_compile_state != NULL) { @@ -876,7 +876,7 @@ next: state->thread_id, 1); } - return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_id, + return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_name, state->rule_table_id, state->Nth_scan, hit_maat_items, real_hit_item_num); } @@ -902,7 +902,7 @@ expr_runtime_stream_open(struct expr_runtime *expr_rt, int thread_id) int expr_runtime_stream_scan(struct expr_runtime_stream *expr_rt_stream, const char *data, size_t data_len, - int attribute_id, struct maat_state *state) + const char *attribute_name, struct maat_state *state) { struct expr_runtime *expr_rt = expr_rt_stream->ref_expr_rt; @@ -969,7 +969,7 @@ next: state->thread_id, 1); } - return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_id, + return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_name, state->rule_table_id, state->Nth_scan, hit_maat_items, real_hit_item_cnt); } diff --git a/src/maat_flag.c b/src/maat_flag.c index e81b6ea..42a24e5 100644 --- a/src/maat_flag.c +++ b/src/maat_flag.c @@ -396,7 +396,7 @@ long long flag_runtime_rule_count(void *flag_runtime) } int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id, - long long flag, int attribute_id, struct maat_state *state) + long long flag, const char *attribute_name, struct maat_state *state) { //clear rule_state->last_hit_object if (state != NULL && state->rule_compile_state != NULL) { @@ -453,7 +453,7 @@ next: state->thread_id, 1); } - return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_id, + return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_name, state->rule_table_id, state->Nth_scan, hit_maat_items, real_hit_item_cnt); } diff --git a/src/maat_interval.c b/src/maat_interval.c index bf7c2a6..e37acb2 100644 --- a/src/maat_interval.c +++ b/src/maat_interval.c @@ -405,7 +405,7 @@ long long interval_runtime_rule_count(void *interval_runtime) } int interval_runtime_scan(struct interval_runtime *interval_rt, int thread_id, - long long integer, int attribute_id, struct maat_state *state) + long long integer, const char *attribute_name, struct maat_state *state) { //clear rule_state->last_hit_object if (state != NULL && state->rule_compile_state != NULL) { @@ -462,7 +462,7 @@ next: state->thread_id, 1); } - return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_id, + return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_name, state->rule_table_id, state->Nth_scan, hit_maat_items, real_hit_item_cnt); } diff --git a/src/maat_ip.c b/src/maat_ip.c index 1597e34..c23a462 100644 --- a/src/maat_ip.c +++ b/src/maat_ip.c @@ -465,7 +465,7 @@ long long ip_runtime_ipv6_rule_count(void *ip_runtime) } int ip_runtime_scan(struct ip_runtime *ip_rt, int thread_id, int ip_type, - uint8_t *ip_addr, int port, int attribute_id, struct maat_state *state) + uint8_t *ip_addr, int port, const char *attribute_name, struct maat_state *state) { //clear rule_state->last_hit_object if (state != NULL && state->rule_compile_state != NULL) { @@ -543,7 +543,7 @@ next: state->thread_id, 1); } - return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_id, + return rule_compile_state_update(state->rule_compile_state, state->maat_inst, attribute_name, state->rule_table_id, state->Nth_scan, hit_maat_items, real_hit_item_cnt); } diff --git a/src/maat_rule.c b/src/maat_rule.c index e95e510..fae3561 100644 --- a/src/maat_rule.c +++ b/src/maat_rule.c @@ -50,7 +50,7 @@ struct rule_item { struct condition_query_key { uuid_t object_uuid; - int attribute_id; + char attribute_name[MAX_ATTR_NAME_LEN]; int negate_option; }; @@ -61,7 +61,7 @@ struct condition_id_kv { }; struct table_condition { - int attribute_id; + char attribute_name[MAX_ATTR_NAME_LEN]; int actual_condition_num; UT_array *condition_ids; UT_array *object_ids; @@ -69,7 +69,7 @@ struct table_condition { }; struct table_object { - int attribute_id; + char attribute_name[MAX_ATTR_NAME_LEN]; UT_array *object_uuids; UT_hash_handle hh; }; @@ -101,7 +101,7 @@ struct rule_condition { long long condition_id; uuid_t object_uuids[MAX_OBJECT_CNT]; int object_cnt; - int attribute_id; + char attribute_name[MAX_ATTR_NAME_LEN]; char negate_option; // 1 byte char in_use; // 1 byte char pad[6]; // for 8 bytes alignment @@ -126,8 +126,8 @@ struct internal_hit_path { uuid_t item_uuid; uuid_t object_uuid; int Nth_scan; - int attribute_id; int negate_option; // 1 means negate condition + char attribute_name[MAX_ATTR_NAME_LEN]; }; struct rule2table_id { @@ -190,11 +190,11 @@ static void maat_rule_free(struct maat_rule *rule) } static int validate_table_not_condition(struct rule_runtime *rule_rt, - struct table_manager *tbl_mgr, int attribute_id, + struct table_manager *tbl_mgr, const char *attribute_name, enum maat_operation op, struct log_handle *logger) { struct table_condition *not_condition = NULL; - HASH_FIND_INT(rule_rt->tbl_not_condition_hash, &attribute_id, not_condition); + HASH_FIND_STR(rule_rt->tbl_not_condition_hash, attribute_name, not_condition); if (MAAT_OP_DEL == op) { //delete @@ -207,15 +207,14 @@ static int validate_table_not_condition(struct rule_runtime *rule_rt, //add if (NULL == not_condition) { not_condition = ALLOC(struct table_condition, 1); - not_condition->attribute_id = attribute_id; + snprintf(not_condition->attribute_name, sizeof(not_condition->attribute_name), "%s", attribute_name); not_condition->actual_condition_num++; - HASH_ADD_INT(rule_rt->tbl_not_condition_hash, attribute_id, not_condition); + HASH_ADD_STR(rule_rt->tbl_not_condition_hash, attribute_name, not_condition); } else { if (not_condition->actual_condition_num >= MAX_NOT_CONDITION_NUM) { - const char *attr_name = table_manager_get_attribute_name(tbl_mgr, attribute_id); log_fatal(logger, MODULE_RULE, "[%s:%d]attribute:<%s> negate condition num exceed maximum:%d", - __FUNCTION__, __LINE__, attr_name, MAX_NOT_CONDITION_NUM); + __FUNCTION__, __LINE__, attribute_name, MAX_NOT_CONDITION_NUM); return -1; } not_condition->actual_condition_num++; @@ -280,16 +279,13 @@ static struct maat_rule *maat_rule_new(struct rule_runtime *rule_rt, struct rule goto error; } - condition->attribute_id = table_manager_get_attribute_id(schema->ref_tbl_mgr, tmp_obj->valuestring); - if (condition->attribute_id < 0) { - condition->attribute_id = table_manager_attribute_register(schema->ref_tbl_mgr, tmp_obj->valuestring, logger); - if (condition->attribute_id < 0) { - log_fatal(logger, MODULE_RULE, - "[%s:%d] table: <%s> attribute_name:%s register failed", - __FUNCTION__, __LINE__, table_name, tmp_obj->valuestring); - goto error; - } + if (strlen(tmp_obj->valuestring) >= sizeof(condition->attribute_name)) { + log_fatal(logger, MODULE_RULE, + "[%s:%d] table: <%s> attribute_name:%s length exceed maximum:%d", + __FUNCTION__, __LINE__, table_name, tmp_obj->valuestring, sizeof(condition->attribute_name)); + goto error; } + snprintf(condition->attribute_name, sizeof(condition->attribute_name), "%s", tmp_obj->valuestring); tmp_obj = cJSON_GetObjectItem(condition_obj, "negate_option"); if (tmp_obj) { @@ -306,7 +302,7 @@ static struct maat_rule *maat_rule_new(struct rule_runtime *rule_rt, struct rule } if (condition->negate_option == CONDITION_NEGATE_OPTION_SET) { - int ret = validate_table_not_condition(rule_rt, schema->ref_tbl_mgr, condition->attribute_id, MAAT_OP_ADD, logger); + int ret = validate_table_not_condition(rule_rt, schema->ref_tbl_mgr, condition->attribute_name, MAAT_OP_ADD, logger); if (ret < 0) { log_fatal(logger, MODULE_RULE, "[%s:%d] table: <%s> validate negate_option failed, line: %s", @@ -683,7 +679,9 @@ build_condition_id_kv_hash(struct rule_runtime *rule_rt, int negate_option) struct condition_query_key key; struct condition_id_kv *condition_id_kv = NULL; - key.attribute_id = condition->attribute_id; + memset(&key, 0, sizeof(key)); + + memcpy(key.attribute_name, condition->attribute_name, sizeof(key.attribute_name)); key.negate_option = condition->negate_option; uuid_copy(key.object_uuid, condition->object_uuids[k]); @@ -977,7 +975,7 @@ void rule_compile_state_free(struct rule_compile_state *rule_compile_state, static void rule_compile_state_add_internal_hit_path(struct rule_compile_state *rule_compile_state, uuid_t item_uuid, uuid_t object_uuid, - int attribute_id, int negate_option, int Nth_scan) + const char *attribute_name, int negate_option, int Nth_scan) { if (NULL == rule_compile_state) { return; @@ -987,7 +985,7 @@ rule_compile_state_add_internal_hit_path(struct rule_compile_state *rule_compile uuid_copy(new_path.item_uuid, item_uuid); new_path.Nth_scan = Nth_scan; uuid_copy(new_path.object_uuid, object_uuid); - new_path.attribute_id = attribute_id; + snprintf(new_path.attribute_name, sizeof(new_path.attribute_name), "%s", attribute_name); new_path.negate_option = negate_option; utarray_push_back(rule_compile_state->internal_hit_paths, &new_path); @@ -1003,7 +1001,7 @@ static int maat_rule_has_condition_query_key(struct maat_rule *rule, } - if (condition->attribute_id != key->attribute_id) { + if (strncmp(condition->attribute_name, key->attribute_name, sizeof(key->attribute_name)) != 0) { continue; } @@ -1024,7 +1022,7 @@ static int maat_rule_has_condition_query_key(struct maat_rule *rule, static size_t maat_rule_get_hit_condition_index(struct maat_rule *rule, - int attribute_id, uuid_t hit_object_uuid, + const char *attribute_name, uuid_t hit_object_uuid, int *condition_idx_array, size_t array_size) { size_t hit_condition_cnt = 0; @@ -1037,7 +1035,7 @@ maat_rule_get_hit_condition_index(struct maat_rule *rule, } - if (tmp_condition->attribute_id != attribute_id) { + if (strncmp(tmp_condition->attribute_name, attribute_name, sizeof(tmp_condition->attribute_name)) != 0) { continue; } @@ -1068,7 +1066,7 @@ maat_rule_is_hit_path_existed(const struct maat_hit_path *hit_paths, static void populate_hit_path_with_rule(struct maat_hit_path *hit_path_array, size_t array_idx, size_t n_hit_path, - size_t *n_new_hit_path, int attribute_id, + size_t *n_new_hit_path, const char *attribute_name, struct maat_rule *rule) { size_t i = 0; @@ -1086,7 +1084,7 @@ static void populate_hit_path_with_rule(struct maat_hit_path *hit_path_array, uuid_copy(hit_path_array[idx].rule_uuid, rule->rule_uuid); // find out which condition in rule hit n_condition_index = - maat_rule_get_hit_condition_index(rule, attribute_id, + maat_rule_get_hit_condition_index(rule, attribute_name, hit_path_array[idx].top_object_uuid, condition_index_array, MAX_ITEMS_PER_BOOL_EXPR); @@ -1107,7 +1105,7 @@ static void populate_hit_path_with_rule(struct maat_hit_path *hit_path_array, hit_path_array[n_hit_path + new_hit_path_cnt] = tmp_path; new_hit_path_cnt++; n_condition_index = - maat_rule_get_hit_condition_index(rule, attribute_id, tmp_path.top_object_uuid, + maat_rule_get_hit_condition_index(rule, attribute_name, tmp_path.top_object_uuid, condition_index_array, MAX_ITEMS_PER_BOOL_EXPR); hit_path_array[n_hit_path + new_hit_path_cnt - 1].condition_index = condition_index_array[0]; if (n_condition_index > 1) { @@ -1160,14 +1158,12 @@ size_t rule_runtime_get_hit_paths(struct rule_runtime *rule_rt, int thread_id, } else { uuid_copy(key.object_uuid, hit_path_array[j].top_object_uuid); } - int attribute_id = table_manager_get_attribute_id(rule_rt->ref_maat_rt->ref_tbl_mgr, - hit_path_array[j].attribute_name); - - key.attribute_id = attribute_id; + + memcpy(key.attribute_name, hit_path_array[j].attribute_name, sizeof(key.attribute_name)); key.negate_option = hit_path_array[j].negate_option; if (maat_rule_has_condition_query_key(rule, &key)) { populate_hit_path_with_rule(hit_path_array, j, n_hit_path, - &n_new_hit_path, attribute_id, rule); + &n_new_hit_path, key.attribute_name, rule); } } } @@ -1178,7 +1174,7 @@ size_t rule_runtime_get_hit_paths(struct rule_runtime *rule_rt, int thread_id, static void rule_compile_state_add_direct_hit_objects(struct rule_compile_state *rule_compile_state, struct maat_item *hit_items, - size_t n_hit_items, char *attribute_name) + size_t n_hit_items, const char *attribute_name) { if (NULL == rule_compile_state || NULL == hit_items) { return; @@ -1188,7 +1184,7 @@ rule_compile_state_add_direct_hit_objects(struct rule_compile_state *rule_compil for (size_t i = 0; i < n_hit_items; i++) { uuid_copy(hit_object.item_uuid, hit_items[i].item_uuid); uuid_copy(hit_object.object_uuid, hit_items[i].object_uuid); - hit_object.attribute_name = attribute_name; + snprintf(hit_object.attribute_name, sizeof(hit_object.attribute_name), "%s", attribute_name); utarray_push_back(rule_compile_state->direct_hit_objects, &hit_object); } } @@ -1196,7 +1192,7 @@ rule_compile_state_add_direct_hit_objects(struct rule_compile_state *rule_compil static void rule_compile_state_add_indirect_hit_objects(struct rule_compile_state *rule_compile_state, uuid_t *object_uuids, - size_t n_object_uuids, char *attribute_name) + size_t n_object_uuids, const char *attribute_name) { if (NULL == rule_compile_state || NULL == object_uuids) { return; @@ -1206,7 +1202,7 @@ rule_compile_state_add_indirect_hit_objects(struct rule_compile_state *rule_comp for (size_t i = 0; i < n_object_uuids; i++) { uuid_clear(hit_object.item_uuid); uuid_copy(hit_object.object_uuid, object_uuids[i]); - hit_object.attribute_name = attribute_name; + snprintf(hit_object.attribute_name, sizeof(hit_object.attribute_name), "%s", attribute_name); utarray_push_back(rule_compile_state->indirect_hit_objects, &hit_object); } } @@ -1290,7 +1286,7 @@ rule_compile_state_add_hit_not_conditions(struct rule_compile_state *rule_compil static void rule_compile_state_update_hit_conditions(struct rule_compile_state *rule_compile_state, struct rule_runtime *rule_rt, - uuid_t object_uuid, int attribute_id) + uuid_t object_uuid, const char *attribute_name) { if (NULL == rule_compile_state || NULL == rule_rt) { return; @@ -1299,8 +1295,9 @@ rule_compile_state_update_hit_conditions(struct rule_compile_state *rule_compile struct condition_query_key key; struct condition_id_kv *condition_id_kv = NULL; + memset(&key, 0, sizeof(key)); key.negate_option = 0; - key.attribute_id = attribute_id; + snprintf(key.attribute_name, sizeof(key.attribute_name), "%s", attribute_name); uuid_copy(key.object_uuid, object_uuid); HASH_FIND(hh, rule_rt->condition_id_kv_hash, &key, sizeof(key), condition_id_kv); @@ -1319,7 +1316,7 @@ static void rule_compile_state_cache_hit_not_objects(struct rule_compile_state *rule_compile_state, struct rule_runtime *rule_rt, uuid_t *hit_object_uuids, - size_t n_hit_object_uuid, int attribute_id) + size_t n_hit_object_uuid, const char *attribute_name) { if (NULL == rule_compile_state || NULL == rule_rt) { return; @@ -1330,7 +1327,7 @@ rule_compile_state_cache_hit_not_objects(struct rule_compile_state *rule_compile } struct table_object *tbl_object = NULL; - HASH_FIND(hh, rule_compile_state->hit_not_tbl_objects, &attribute_id, sizeof(int), tbl_object); + HASH_FIND_STR(rule_compile_state->hit_not_tbl_objects, attribute_name, tbl_object); if (tbl_object != NULL) { for (size_t i = 0; i < n_hit_object_uuid; i++) { uuid_t *object_uuid = (uuid_t *)utarray_find(tbl_object->object_uuids, @@ -1346,7 +1343,7 @@ rule_compile_state_cache_hit_not_objects(struct rule_compile_state *rule_compile struct condition_id_kv *condition_id_kv = NULL, *tmp_condition_id_kv = NULL; HASH_ITER(hh, rule_rt->not_condition_id_kv_hash, condition_id_kv, tmp_condition_id_kv) { - if (condition_id_kv->key.attribute_id != attribute_id) { + if (strncmp(condition_id_kv->key.attribute_name, attribute_name, strlen(attribute_name)) != 0) { continue; } @@ -1359,9 +1356,9 @@ rule_compile_state_cache_hit_not_objects(struct rule_compile_state *rule_compile if (NULL == tbl_object) { tbl_object = ALLOC(struct table_object, 1); - tbl_object->attribute_id = attribute_id; + snprintf(tbl_object->attribute_name, sizeof(tbl_object->attribute_name), "%s", attribute_name); utarray_new(tbl_object->object_uuids, &ut_rule_object_uuid_icd); - HASH_ADD_INT(rule_compile_state->hit_not_tbl_objects, attribute_id, tbl_object); + HASH_ADD_STR(rule_compile_state->hit_not_tbl_objects, attribute_name, tbl_object); } if (!utarray_find(tbl_object->object_uuids, &(condition_id_kv->key.object_uuid), @@ -1460,7 +1457,7 @@ static void rule_runtime_del_rule(struct rule_runtime *rule_rt, for (int i = 0; i < rule->condition_num; i++) { struct rule_condition *condition = rule->conditions + i; if (condition->in_use && condition->negate_option == CONDITION_NEGATE_OPTION_SET) { - validate_table_not_condition(rule_rt, schema->ref_tbl_mgr, condition->attribute_id, MAAT_OP_DEL, logger); + validate_table_not_condition(rule_rt, schema->ref_tbl_mgr, condition->attribute_name, MAAT_OP_DEL, logger); } } @@ -1678,14 +1675,13 @@ int rule_runtime_match(struct rule_runtime *rule_rt, uuid_t *rule_uuids, } int rule_compile_state_update(struct rule_compile_state *rule_compile_state, struct maat *maat_inst, - int attribute_id, int custom_rule_tbl_id, int Nth_scan, + const char *attribute_name, int custom_rule_tbl_id, int Nth_scan, struct maat_item *hit_items, size_t n_hit_item) { size_t i = 0, j = 0; size_t hit_cnt = n_hit_item; uuid_t hit_object_uuids[MAX_HIT_OBJECT_NUM]; struct maat_hit_object hit_object; - char *attribute_name = (char*)table_manager_get_attribute_name(maat_inst->tbl_mgr, attribute_id); utarray_clear(rule_compile_state->this_scan_hit_conditions); rule_compile_state->this_scan_not_logic = 0; @@ -1696,7 +1692,7 @@ int rule_compile_state_update(struct rule_compile_state *rule_compile_state, str uuid_copy(hit_object.item_uuid, hit_items[i].item_uuid); uuid_copy(hit_object.object_uuid, hit_items[i].object_uuid); - hit_object.attribute_name = attribute_name; + snprintf(hit_object.attribute_name, sizeof(hit_object.attribute_name), "%s", attribute_name); utarray_push_back(rule_compile_state->last_hit_objects, &hit_object); } @@ -1710,14 +1706,14 @@ int rule_compile_state_update(struct rule_compile_state *rule_compile_state, str for (i = 0; i < super_object_cnt; i++) { uuid_clear(hit_object.item_uuid); uuid_copy(hit_object.object_uuid, super_object_uuids[i]); - hit_object.attribute_name = attribute_name; + snprintf(hit_object.attribute_name, sizeof(hit_object.attribute_name), "%s", attribute_name); utarray_push_back(rule_compile_state->last_hit_objects, &hit_object); } if (1 == maat_inst->opts.hit_path_on && hit_cnt > 0) { for (i = 0; i < hit_cnt; i++) { rule_compile_state_add_internal_hit_path(rule_compile_state, hit_items[i].item_uuid, - hit_items[i].object_uuid, attribute_id, 0, Nth_scan); + hit_items[i].object_uuid, attribute_name, 0, Nth_scan); } } @@ -1745,11 +1741,11 @@ int rule_compile_state_update(struct rule_compile_state *rule_compile_state, str for (i = 0; i < hit_cnt; i++) { rule_compile_state_update_hit_conditions(rule_compile_state, rule_rt, - hit_object_uuids[i], attribute_id); + hit_object_uuids[i], attribute_name); } rule_compile_state_cache_hit_not_objects(rule_compile_state, rule_rt, hit_object_uuids, - hit_cnt, attribute_id); + hit_cnt, attribute_name); return hit_cnt; } @@ -1764,7 +1760,7 @@ void rule_compile_state_clear_last_hit_object(struct rule_compile_state *rule_co void rule_compile_state_not_logic_update(struct rule_compile_state *rule_compile_state, struct rule_runtime *rule_rt, - struct maat *maat_inst, int attribute_id, + struct maat *maat_inst, const char *attribute_name, int Nth_scan) { if (NULL == rule_compile_state || NULL == maat_inst) { @@ -1776,7 +1772,7 @@ void rule_compile_state_not_logic_update(struct rule_compile_state *rule_compile utarray_clear(rule_compile_state->this_scan_hit_not_conditions); struct table_object *tbl_object = NULL; - HASH_FIND(hh, rule_compile_state->hit_not_tbl_objects, &attribute_id, sizeof(int), tbl_object); + HASH_FIND_STR(rule_compile_state->hit_not_tbl_objects, attribute_name, tbl_object); if (NULL == tbl_object) { return; } @@ -1785,7 +1781,7 @@ void rule_compile_state_not_logic_update(struct rule_compile_state *rule_compile for (size_t i = 0; i < utarray_len(tbl_object->object_uuids); i++) { uuid_t *object_uuid = utarray_eltptr(tbl_object->object_uuids, i); struct condition_query_key key; - key.attribute_id = attribute_id; + snprintf(key.attribute_name, sizeof(key.attribute_name), "%s", attribute_name); key.negate_option = 1; uuid_copy(key.object_uuid, *object_uuid); @@ -1799,7 +1795,7 @@ void rule_compile_state_not_logic_update(struct rule_compile_state *rule_compile uuid_t null_uuid; uuid_clear(null_uuid); rule_compile_state_add_internal_hit_path(rule_compile_state, null_uuid, *object_uuid, - attribute_id, 1, Nth_scan); + attribute_name, 1, Nth_scan); } } } @@ -1815,7 +1811,7 @@ size_t rule_compile_state_get_indirect_hit_objects(struct rule_compile_state *ru (struct maat_hit_object *)utarray_eltptr(rule_compile_state->indirect_hit_objects, i); uuid_copy(object_array[i].item_uuid, hit_object->item_uuid); uuid_copy(object_array[i].object_uuid, hit_object->object_uuid); - object_array[i].attribute_name = hit_object->attribute_name; + memcpy(object_array[i].attribute_name, hit_object->attribute_name, sizeof(object_array[i].attribute_name)); } utarray_clear(rule_compile_state->indirect_hit_objects); @@ -1859,7 +1855,7 @@ size_t rule_compile_state_get_direct_hit_objects(struct rule_compile_state *rule object = (struct maat_hit_object *)utarray_eltptr(direct_hit_object, i); uuid_copy(object_array[i].item_uuid, object->item_uuid); uuid_copy(object_array[i].object_uuid, object->object_uuid); - object_array[i].attribute_name = object->attribute_name; + memcpy(object_array[i].attribute_name, object->attribute_name, sizeof(object_array[i].attribute_name)); } utarray_clear(rule_compile_state->direct_hit_objects); @@ -1919,8 +1915,8 @@ size_t rule_compile_state_get_internal_hit_paths(struct rule_compile_state *rule uuid_copy(tmp_path.item_uuid, internal_path->item_uuid); uuid_copy(tmp_path.sub_object_uuid, internal_path->object_uuid); uuid_copy(tmp_path.top_object_uuid, *p); - tmp_path.attribute_name = (char*)table_manager_get_attribute_name(rule_rt->ref_maat_rt->ref_tbl_mgr, - internal_path->attribute_id); + + memcpy(tmp_path.attribute_name, internal_path->attribute_name, sizeof(tmp_path.attribute_name)); tmp_path.negate_option = internal_path->negate_option; tmp_path.condition_index = -1; uuid_clear(tmp_path.rule_uuid); diff --git a/src/maat_table.c b/src/maat_table.c index 7506829..79e152c 100644 --- a/src/maat_table.c +++ b/src/maat_table.c @@ -52,8 +52,6 @@ struct table_manager { struct maat_table *tbl[MAX_TABLE_NUM]; size_t n_table; - UT_array *attr_array; - struct rule_tag *accept_tags; size_t n_accept_tag; @@ -62,8 +60,6 @@ struct table_manager { int o2o_table_id; struct maat_kv_store *tbl_name2id_map; struct maat_kv_store *conj_tbl_name2id_map; - struct maat_kv_store *attr_name2id_map; - struct maat_kv_store *sequence_map; struct maat_garbage_bin *ref_garbage_bin; struct log_handle *logger; @@ -594,31 +590,6 @@ static int register_single_tbl_name2id(struct maat_kv_store *tbl_name2id_map, return 0; } -static int register_single_attribute_name2id(struct maat_kv_store *attr_name2id_map, - const char *attr_name, int attr_id, - struct log_handle *logger) -{ - if (strlen(attr_name) >= NAME_MAX) { - log_fatal(logger, MODULE_TABLE, - "[%s:%d] attribute:<%s> name length exceed maxium:%d", - __FUNCTION__, __LINE__, attr_name, NAME_MAX); - return -1; - } - - long long tmp_attr_id = -1; - int ret = maat_kv_read(attr_name2id_map, attr_name, &tmp_attr_id, 1); - if (ret > 0 && tmp_attr_id != attr_id) { - log_fatal(logger, MODULE_TABLE, - "[%s:%d] attribute:<%s>(attr_id:%lld) has already been registered" - ", can't register again", - __FUNCTION__, __LINE__, attr_name, tmp_attr_id); - return -1; - } - - maat_kv_register(attr_name2id_map, attr_name, attr_id); - return 0; -} - static int register_conjunction_tbl_name2id(struct maat_kv_store *conj_tbl_name2id_map, cJSON *root, struct log_handle *logger) { @@ -744,45 +715,6 @@ int maat_default_rule_table_id(cJSON *json, struct log_handle *logger) return item->valueint; } -static long long maat_table_get_sequence(struct maat_kv_store *sequence_map, - const char *sequence_name) -{ - long long sequence = 1; - int map_ret = maat_kv_read(sequence_map, sequence_name, &sequence, 1); - if (map_ret < 0) { - maat_kv_register(sequence_map, sequence_name, sequence); - } else { - sequence++; - int ret = maat_kv_write(sequence_map, sequence_name, sequence); - if (ret < 0) { - return -1; - } - } - - return sequence; -} - -int table_manager_attribute_register(struct table_manager *tbl_mgr, const char *attribute_name, struct log_handle *logger) -{ - int attr_id = maat_table_get_sequence(tbl_mgr->sequence_map, "attribute_id"); - - if (attr_id < 0) { - log_fatal(logger, MODULE_TABLE, - "[%s:%d] attribute %s register get id failed", __FUNCTION__, __LINE__, attribute_name); - return -1; - } - - if (register_single_attribute_name2id(tbl_mgr->attr_name2id_map, attribute_name, attr_id, logger) < 0) { - log_fatal(logger, MODULE_TABLE, - "[%s:%d] attribute %s register failed", __FUNCTION__, __LINE__, attribute_name); - return -1; - } - - utarray_insert(tbl_mgr->attr_array, &attribute_name, attr_id); - - return attr_id; -} - struct table_manager * table_manager_create(const char *table_info_path, const char *accept_tags, enum maat_expr_engine engine_type, struct maat_garbage_bin *garbage_bin, @@ -828,11 +760,8 @@ table_manager_create(const char *table_info_path, const char *accept_tags, tbl_mgr->logger = logger; tbl_mgr->tbl_name2id_map = maat_kv_store_new(); tbl_mgr->conj_tbl_name2id_map = maat_kv_store_new(); - tbl_mgr->attr_name2id_map = maat_kv_store_new(); - tbl_mgr->sequence_map = maat_kv_store_new(); tbl_mgr->engine_type = engine_type; tbl_mgr->ref_garbage_bin = garbage_bin; - utarray_new(tbl_mgr->attr_array, &ut_str_icd); ret = register_tbl_name2id(tbl_mgr->tbl_name2id_map, root, table_info_path, logger); if (ret < 0) { @@ -1025,21 +954,6 @@ void table_manager_destroy(struct table_manager *tbl_mgr) tbl_mgr->conj_tbl_name2id_map = NULL; } - if (tbl_mgr->attr_name2id_map != NULL) { - maat_kv_store_free(tbl_mgr->attr_name2id_map); - tbl_mgr->attr_name2id_map = NULL; - } - - if (tbl_mgr->sequence_map != NULL) { - maat_kv_store_free(tbl_mgr->sequence_map); - tbl_mgr->sequence_map = NULL; - } - - if (tbl_mgr->attr_array != NULL) { - utarray_free(tbl_mgr->attr_array); - tbl_mgr->attr_array = NULL; - } - FREE(tbl_mgr); } @@ -1072,21 +986,6 @@ int table_manager_get_table_id(struct table_manager *tbl_mgr, const char *table_ return (int)table_id; } -int table_manager_get_attribute_id(struct table_manager *tbl_mgr, const char *attr_name) -{ - if (NULL == tbl_mgr || NULL == attr_name) { - return -1; - } - - long long attr_id = -1; - int ret = maat_kv_read(tbl_mgr->attr_name2id_map, attr_name, &attr_id, 1); - if (ret < 0) { - return -1; - } - - return (int)attr_id; -} - int table_manager_get_conj_parent_table_ids(struct table_manager *tbl_mgr, const char *table_name, long long *table_ids_array, size_t n_table_ids_array) { @@ -1121,23 +1020,6 @@ const char *table_manager_get_table_name(struct table_manager *tbl_mgr, int tabl return tbl_mgr->tbl[table_id]->table_name; } -const char *table_manager_get_attribute_name(struct table_manager *tbl_mgr, int attr_id) -{ - if (NULL == tbl_mgr || attr_id < 0) { - return NULL; - } - - if (NULL == tbl_mgr->attr_array) { - return NULL; - } - - if (attr_id >= utarray_len(tbl_mgr->attr_array)) { - return NULL; - } - - return *(char **)utarray_eltptr(tbl_mgr->attr_array, attr_id); -} - const char *table_manager_get_table_schema_tag(struct table_manager *tbl_mgr, int table_id) { if (NULL == tbl_mgr || table_id < 0) { diff --git a/test/json_update/corrupted.json b/test/json_update/corrupted.json index 1359a01..81c9e9f 100644 --- a/test/json_update/corrupted.json +++ b/test/json_update/corrupted.json @@ -3,7 +3,7 @@ "object_table": "OBJECT", "rules": [ { - "rule_id": "9c5ee166-3af6-fb23-f8f8-8c7062ed3717", + "uuid": "9c5ee166-3af6-fb23-f8f8-8c7062ed3717", "service": 1, "action": 1, "do_blacklist": 1, @@ -21,7 +21,7 @@ "table_name": "HTTP_URL", "table_type": "expr", "table_content": { - "keywords": "hello&world", + "expression": "hello&world", "expr_type": "none" } } diff --git a/test/json_update/new.json b/test/json_update/new.json index 6a2b523..268f24d 100644 --- a/test/json_update/new.json +++ b/test/json_update/new.json @@ -3,7 +3,7 @@ "object2object_table": "OBJECT2OBJECT", "rules": [ { - "rule_id": "9b0d44a1-1e9e-7988-6ab2-c619d5906818", + "uuid": "9b0d44a1-1e9e-7988-6ab2-c619d5906818", "service": 1, "action": 1, "do_blacklist": 1, @@ -20,7 +20,7 @@ "table_name": "HTTP_URL", "table_type": "expr", "table_content": { - "keywords": "MESA&Maat", + "expression": "MESA&Maat", "expr_type": "and" } } diff --git a/test/json_update/old.json b/test/json_update/old.json index 7927caa..d26485d 100644 --- a/test/json_update/old.json +++ b/test/json_update/old.json @@ -20,7 +20,7 @@ "table_name": "HTTP_URL", "table_type": "expr", "table_content": { - "keywords": "hello&world", + "expression": "hello&world", "expr_type": "and" } } diff --git a/test/maat_framework_gtest.cpp b/test/maat_framework_gtest.cpp index 7884d13..bcc7696 100644 --- a/test/maat_framework_gtest.cpp +++ b/test/maat_framework_gtest.cpp @@ -25,7 +25,7 @@ const char *g_json_filename = "maat_json.json"; size_t g_thread_num = 4; - +#if 0 //TODO int test_add_expr_command(struct maat *maat_inst, const char *expr_table, long long rule_id, int timeout, const char *keywords) @@ -57,6 +57,7 @@ int del_command(struct maat *maat_inst, int rule_id) return rule_table_set_line(maat_inst, "RULE_DEFAULT", MAAT_OP_DEL, rule_id, "null", 1, 0); } +#endif const char *watched_json = "./json_update/maat.json"; const char *old_json = "./json_update/old.json"; @@ -432,7 +433,8 @@ TEST_F(FlagScan, hitRepeatedRule) { ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 194); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000194"); ret = maat_scan_not_logic(maat_inst, flag_table_name, flag_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -549,7 +551,9 @@ TEST_F(HsStringScan, Full) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 125); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000125"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -574,7 +578,9 @@ TEST_F(HsStringScan, Regex) { ret = maat_scan_string(maat_inst, table_name, attribute_name, scan_data, strlen(scan_data), results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); - EXPECT_EQ(results[0], 148); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000148"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -599,7 +605,9 @@ TEST_F(HsStringScan, RegexUnicode) { ret = maat_scan_string(maat_inst, table_name, attribute_name, scan_data, strlen(scan_data), results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); - EXPECT_EQ(results[0], 229); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000229"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -624,7 +632,9 @@ TEST_F(HsStringScan, BackslashR_N_Escape) { ret = maat_scan_string(maat_inst, table_name, attribute_name, payload, strlen(payload), results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); - EXPECT_EQ(results[0], 225); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000225"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -715,7 +725,9 @@ TEST_F(HsStringScan, BackslashCtrlCharactor) ret = maat_scan_string(maat_inst, table_name, attribute_name, payload, strlen(payload), results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); - EXPECT_EQ(results[0], 235); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000235"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -742,7 +754,9 @@ TEST_F(HsStringScan, Expr8) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 182); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000182"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -786,8 +800,11 @@ TEST_F(HsStringScan, HexBinCaseSensitive) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 206); - EXPECT_EQ(results[1], 191); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000206"); + uuid_unparse(results[1], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000191"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -824,7 +841,9 @@ TEST_F(HsStringScan, HexbinCombineString) results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 236); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000236"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -867,7 +886,9 @@ TEST_F(HsStringScan, BugReport20190325) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 150); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000150"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -905,8 +926,11 @@ TEST_F(HsStringScan, PrefixAndSuffix) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 151); - EXPECT_EQ(results[1], 152); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000151"); + uuid_unparse(results[1], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000152"); ret = maat_scan_not_logic(maat_inst, mail_addr_table_name, mail_addr_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -918,7 +942,8 @@ TEST_F(HsStringScan, PrefixAndSuffix) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 151); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000151"); ret = maat_scan_not_logic(maat_inst, mail_addr_table_name, mail_addr_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -936,7 +961,8 @@ TEST_F(HsStringScan, PrefixAndSuffix) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 152); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000152"); ret = maat_scan_not_logic(maat_inst, mail_addr_table_name, mail_addr_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -962,7 +988,9 @@ TEST_F(HsStringScan, MaatUnescape) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 132); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000132"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1012,7 +1040,9 @@ TEST_F(HsStringScan, OffsetChunk64) { } } EXPECT_EQ(pass_flag, 1); - EXPECT_EQ(results[0], 136); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000136"); maat_stream_free(sp); fclose(fp); maat_state_free(state); @@ -1059,7 +1089,9 @@ TEST_F(HsStringScan, OffsetChunk1460) { } } EXPECT_EQ(pass_flag, 1); - EXPECT_EQ(results[0], 136); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000136"); maat_stream_free(sp); fclose(fp); maat_state_free(state); @@ -1103,7 +1135,9 @@ TEST_F(HsStringScan, StreamScanUTF8) { } EXPECT_EQ(pass_flag, 1); - EXPECT_EQ(results[0], 157); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000157"); maat_stream_free(sp); fclose(fp); @@ -1142,7 +1176,9 @@ TEST_F(HsStringScan, StreamInput) { maat_stream_free(sp); EXPECT_EQ(ret, MAAT_SCAN_HIT); - EXPECT_EQ(results[0], 125); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000125"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1337,7 +1373,9 @@ TEST_F(RsStringScan, Full) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 125); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000125"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1363,7 +1401,9 @@ TEST_F(RsStringScan, Regex) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 148); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000148"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1388,7 +1428,9 @@ TEST_F(RsStringScan, RegexUnicode) { ret = maat_scan_string(maat_inst, table_name, attribute_name, scan_data, strlen(scan_data), results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); - EXPECT_EQ(results[0], 229); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000229"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1413,7 +1455,9 @@ TEST_F(RsStringScan, BackslashR_N_Escape) { ret = maat_scan_string(maat_inst, table_name, attribute_name, payload, strlen(payload), results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); - EXPECT_EQ(results[0], 225); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000225"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1504,7 +1548,9 @@ TEST_F(RsStringScan, BackslashCtrlCharactor) ret = maat_scan_string(maat_inst, table_name, attribute_name, payload, strlen(payload), results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); - EXPECT_EQ(results[0], 235); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000235"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1530,7 +1576,9 @@ TEST_F(RsStringScan, Expr8) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 182); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000182"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1567,8 +1615,12 @@ TEST_F(RsStringScan, HexBinCaseSensitive) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 206); - EXPECT_EQ(results[1], 191); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000206"); + + uuid_unparse(results[1], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000191"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1606,7 +1658,9 @@ TEST_F(RsStringScan, HexbinCombineString) results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 236); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000236"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1649,7 +1703,9 @@ TEST_F(RsStringScan, BugReport20190325) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 150); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000150"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1687,8 +1743,12 @@ TEST_F(RsStringScan, PrefixAndSuffix) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 151); - EXPECT_EQ(results[1], 152); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000151"); + + uuid_unparse(results[1], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000152"); ret = maat_scan_not_logic(maat_inst, mail_addr_table_name, mail_addr_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1700,7 +1760,8 @@ TEST_F(RsStringScan, PrefixAndSuffix) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 151); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000151"); ret = maat_scan_not_logic(maat_inst, mail_addr_table_name, mail_addr_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1718,7 +1779,8 @@ TEST_F(RsStringScan, PrefixAndSuffix) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 152); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000152"); ret = maat_scan_not_logic(maat_inst, mail_addr_table_name, mail_addr_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1744,7 +1806,9 @@ TEST_F(RsStringScan, MaatUnescape) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 132); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000132"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -1793,7 +1857,9 @@ TEST_F(RsStringScan, OffsetChunk64) { } } EXPECT_EQ(pass_flag, 1); - EXPECT_EQ(results[0], 136); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000136"); maat_stream_free(sp); fclose(fp); @@ -1841,7 +1907,9 @@ TEST_F(RsStringScan, OffsetChunk1460) { } EXPECT_EQ(pass_flag, 1); - EXPECT_EQ(results[0], 136); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000136"); maat_stream_free(sp); fclose(fp); @@ -1888,7 +1956,9 @@ TEST_F(RsStringScan, StreamScanUTF8) { } EXPECT_EQ(pass_flag, 1); - EXPECT_EQ(results[0], 157); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000157"); maat_stream_free(sp); fclose(fp); @@ -1926,7 +1996,9 @@ TEST_F(RsStringScan, StreamInput) { EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 125); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000125"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -2386,7 +2458,9 @@ TEST_F(IPScan, MatchSingleIPv4) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 169); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000169"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -2416,7 +2490,9 @@ TEST_F(IPScan, IPv6Unspecified) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 210); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000210"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -2473,7 +2549,9 @@ TEST_F(IPScan, MatchSingleIPv6) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 210); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000210"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -2503,8 +2581,12 @@ TEST_F(IPScan, MatchIPv4Range) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 208); - EXPECT_EQ(results[1], 154); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000208"); + + uuid_unparse(results[1], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000154"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -2538,7 +2620,9 @@ TEST_F(IPScan, MatchIPv4Port) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 232); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000232"); maat_state_free(state); state = NULL; @@ -2563,8 +2647,12 @@ TEST_F(IPScan, MatchIPv6Range) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 210); - EXPECT_EQ(results[1], 155); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000210"); + + uuid_unparse(results[1], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000155"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -2594,8 +2682,12 @@ TEST_F(IPScan, MatchIPv6Port) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 230); - EXPECT_EQ(results[1], 210); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000230"); + + uuid_unparse(results[1], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000210"); maat_state_reset(state); //If the port is not present, should not match rules with port range. In this case, only rule 210 "::/0" should match. @@ -2603,7 +2695,8 @@ TEST_F(IPScan, MatchIPv6Port) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 210); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000210"); maat_state_free(state); state = NULL; @@ -2823,7 +2916,9 @@ TEST_F(IntervalScan, SingleInteger) { ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 218); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000218"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -2894,7 +2989,9 @@ TEST_F(ObjectScan, PhysicalTable) { ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 226); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000226"); maat_state_free(state); state = NULL; @@ -2917,7 +3014,9 @@ TEST_F(ObjectScan, Attribute) { ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 233); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000233"); maat_state_free(state); state = NULL; @@ -2944,7 +3043,9 @@ TEST_F(ObjectScan, SetScanRuleTable) { ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 227); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000227"); maat_state_free(state); state = NULL; @@ -3019,7 +3120,9 @@ TEST_F(NOTLogic, OneRegion) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 143); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000143"); maat_state_reset(state); @@ -3088,7 +3191,9 @@ TEST_F(NOTLogic, ScanNotAtLast) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 144); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000144"); maat_state_free(state); state = NULL; @@ -3125,7 +3230,9 @@ TEST_F(NOTLogic, ScanIrrelavantAtLast) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 144); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000144"); maat_state_free(state); state = NULL; @@ -3162,7 +3269,9 @@ TEST_F(NOTLogic, ScanHitAtLastEmptyExpr) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 186); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000186"); ret = maat_scan_not_logic(maat_inst, hit_table_name, hit_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -3211,7 +3320,9 @@ TEST_F(NOTLogic, ScanHitAtLastEmptyInteger) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 187); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000187"); ret = maat_scan_not_logic(maat_inst, hit_table_name, hit_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -3265,7 +3376,9 @@ TEST_F(NOTLogic, ScanNotIP) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 145); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000145"); maat_state_reset(state); @@ -3374,7 +3487,9 @@ TEST_F(NOTLogic, NotUrlAndNotIp) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 146); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000146"); maat_state_free(state); state = NULL; @@ -3421,7 +3536,9 @@ TEST_F(NOTLogic, NotPhysicalTable) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 224); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000224"); maat_state_free(state); state = NULL; @@ -3516,7 +3633,9 @@ TEST_F(NOTLogic, EightNotCondition) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 147); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000147"); maat_state_free(state); state = NULL; @@ -3564,7 +3683,9 @@ TEST_F(NOTLogic, NotConditionAndExcludeObject1) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 216); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000216"); maat_state_free(state); state = NULL; @@ -3620,7 +3741,9 @@ TEST_F(NOTLogic, NotConditionAndExcludeObject2) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 217); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000217"); maat_state_free(state); state = NULL; @@ -3658,7 +3781,9 @@ TEST_F(NOTLogic, SingleNotCondition) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 222); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000222"); maat_state_free(state); state = NULL; @@ -3732,7 +3857,9 @@ TEST_F(NOTLogic, MultiNotConditions) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 223); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000223"); maat_state_free(state); state = NULL; @@ -3818,7 +3945,9 @@ TEST_F(NOTLogic, MultiObjectsInOneNotCondition) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 177); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000177"); maat_state_free(state); state = NULL; @@ -3873,7 +4002,9 @@ TEST_F(NOTLogic, MultiLiteralsInOneNotCondition) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 181); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000181"); maat_state_reset(state); @@ -3930,7 +4061,8 @@ TEST_F(NOTLogic, MultiLiteralsInOneNotCondition) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 181); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000181"); maat_state_free(state); state = NULL; @@ -4037,7 +4169,9 @@ TEST_F(NOTLogic, SameAttributeInMultiCondition) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 185); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000185"); maat_state_reset(state); @@ -4134,7 +4268,9 @@ TEST_F(ExcludeLogic, ScanExcludeAtFirst) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 199); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000199"); ret = maat_scan_not_logic(maat_inst, hit_table_name, hit_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -4173,7 +4309,9 @@ TEST_F(ExcludeLogic, ScanExcludeAtLast) { EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 200); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000200"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -4201,7 +4339,9 @@ TEST_F(ExcludeLogic, ScanIrrelavantAtLast) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 200); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000200"); ret = maat_scan_not_logic(maat_inst, hit_table_name, hit_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -4237,7 +4377,10 @@ TEST_F(ExcludeLogic, ScanAttribute) { ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 202); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000202"); + maat_state_reset(state); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, @@ -4249,7 +4392,8 @@ TEST_F(ExcludeLogic, ScanAttribute) { ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 202); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000202"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -4331,7 +4475,9 @@ TEST_F(ExcludeLogic, ScanWithMultiCondition) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 203); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000203"); ret = maat_scan_not_logic(maat_inst, expr_table_name, expr_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -4400,7 +4546,9 @@ TEST_F(ExcludeLogic, ExcludeInDifferentLevel) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 204); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000204"); ret = maat_scan_not_logic(maat_inst, expr_table_name, expr_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -5464,13 +5612,12 @@ TEST_F(RuleTable, RuleRuleUpdate) { struct maat *maat_inst = RuleTable::_shared_maat_inst; const char *rule_table_name = "RULE_DEFAULT"; - long long rule_id = maat_cmd_incrby(maat_inst, "TEST_SEQ", 1); - int ret = rule_table_set_line(maat_inst, rule_table_name, - MAAT_OP_ADD, rule_id, "null", 1, 0); + uuid_t rule_uuid; + uuid_generate(rule_uuid); + int ret = rule_table_set_line(maat_inst, rule_table_name, MAAT_OP_ADD, rule_uuid, "null", NULL, 0, 0); EXPECT_EQ(ret, 1); - ret = rule_table_set_line(maat_inst, rule_table_name, - MAAT_OP_DEL, rule_id, "null", 1, 0); + ret = rule_table_set_line(maat_inst, rule_table_name, MAAT_OP_DEL, rule_uuid, "null", NULL, 0, 0); EXPECT_EQ(ret, 1); } @@ -5489,8 +5636,12 @@ TEST_F(RuleTable, Conjunction1) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 197); - EXPECT_EQ(results[1], 141); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000197"); + + uuid_unparse(results[1], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000141"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -5519,8 +5670,12 @@ TEST_F(RuleTable, Conjunction2) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 197); - EXPECT_EQ(results[1], 141); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000197"); + + uuid_unparse(results[1], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000141"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -5703,7 +5858,9 @@ TEST_F(Policy, RuleEXData) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 198); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000198"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -5750,7 +5907,9 @@ TEST_F(Policy, SubObject) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); - EXPECT_EQ(results[0], 153); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000153"); ret = maat_scan_not_logic(maat_inst, ip_table_name, ip_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -5979,8 +6138,12 @@ TEST_F(TableInfo, Conjunction) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 2); - EXPECT_EQ(results[0], 134); - EXPECT_EQ(results[1], 133); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000134"); + + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000133"); ret = maat_scan_not_logic(maat_inst, conj_table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -6159,7 +6322,9 @@ TEST_F(ObjectHierarchy, AttributeOfOnePhysical) results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 160); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000160"); ret = maat_scan_not_logic(maat_inst, keywords_table_name, keywords_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -6209,7 +6374,9 @@ TEST_F(ObjectHierarchy, OneObjectInTwoAttribute) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 163); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000163"); ret = maat_scan_not_logic(maat_inst, table_name, res_attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -6248,7 +6415,9 @@ TEST_F(ObjectHierarchy, MultiObjectsInOneCondition) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 178); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000178"); ret = maat_scan_not_logic(maat_inst, table_name, dst_asn_sttribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -6271,7 +6440,8 @@ TEST_F(ObjectHierarchy, MultiObjectsInOneCondition) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 178); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000178"); ret = maat_scan_not_logic(maat_inst, table_name, dst_asn_sttribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -6294,7 +6464,8 @@ TEST_F(ObjectHierarchy, MultiObjectsInOneCondition) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 178); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000178"); ret = maat_scan_not_logic(maat_inst, table_name, dst_asn_sttribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -6335,7 +6506,9 @@ TEST_F(ObjectHierarchy, MultiLiteralsInOneCondition) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 180); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000180"); maat_state_reset(state); @@ -6350,7 +6523,8 @@ TEST_F(ObjectHierarchy, MultiLiteralsInOneCondition) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 180); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000180"); maat_state_reset(state); @@ -6369,7 +6543,8 @@ TEST_F(ObjectHierarchy, MultiLiteralsInOneCondition) { &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 180); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000180"); maat_state_free(state); state = NULL; @@ -10430,7 +10605,9 @@ TEST_F(MaatRollback, FullConfigRollback) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 125); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000125"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -10461,7 +10638,8 @@ TEST_F(MaatRollback, FullConfigRollback) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 125); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000125"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -10488,7 +10666,9 @@ TEST_F(MaatRollback, FullConfigRollbackWhenScanUnfinished) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 125); + char uuid_str[UUID_STR_LEN] = {0}; + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000125"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); @@ -10519,7 +10699,8 @@ TEST_F(MaatRollback, FullConfigRollbackWhenScanUnfinished) { results, ARRAY_SIZE, &n_hit_result, state); EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(n_hit_result, 1); - EXPECT_EQ(results[0], 125); + uuid_unparse(results[0], uuid_str); + EXPECT_STREQ(uuid_str, "00000000-0000-0000-0000-000000000125"); ret = maat_scan_not_logic(maat_inst, table_name, attribute_name, results, ARRAY_SIZE, &n_hit_result, state); diff --git a/test/maat_json.json b/test/maat_json.json index 887dd9c..1e8adba 100644 --- a/test/maat_json.json +++ b/test/maat_json.json @@ -4,7 +4,7 @@ "objects": [ { "object_name": "ASN1234", - "object_id": "00000000-0000-0000-0000-000000000001", + "uuid": "00000000-0000-0000-0000-000000000001", "items": [ { "table_name": "AS_NUMBER", @@ -18,7 +18,7 @@ }, { "object_name": "ASN2345", - "object_id": "00000000-0000-0000-0000-000000000002", + "uuid": "00000000-0000-0000-0000-000000000002", "items": [ { "table_name": "AS_NUMBER", @@ -32,7 +32,7 @@ }, { "object_name": "ASN6789", - "object_id": "00000000-0000-0000-0000-000000000003", + "uuid": "00000000-0000-0000-0000-000000000003", "items": [ { "table_name": "AS_NUMBER", @@ -46,7 +46,7 @@ }, { "object_name": "ASN9001", - "object_id": "00000000-0000-0000-0000-000000000004", + "uuid": "00000000-0000-0000-0000-000000000004", "items": [ { "table_name": "AS_NUMBER", @@ -60,7 +60,7 @@ }, { "object_name": "ASN9002", - "object_id": "00000000-0000-0000-0000-000000000005", + "uuid": "00000000-0000-0000-0000-000000000005", "items": [ { "table_name": "AS_NUMBER", @@ -74,7 +74,7 @@ }, { "object_name": "ASN9003", - "object_id": "00000000-0000-0000-0000-000000000006", + "uuid": "00000000-0000-0000-0000-000000000006", "items": [ { "table_name": "AS_NUMBER", @@ -88,7 +88,7 @@ }, { "object_name": "IPv4-composition-source-only", - "object_id": "00000000-0000-0000-0000-000000000007", + "uuid": "00000000-0000-0000-0000-000000000007", "items": [ { "table_type": "ip", @@ -101,7 +101,7 @@ }, { "object_name": "FQDN_OBJ1", - "object_id": "00000000-0000-0000-0000-000000000008", + "uuid": "00000000-0000-0000-0000-000000000008", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -115,7 +115,7 @@ }, { "object_name": "FQDN_CAT1", - "object_id": "00000000-0000-0000-0000-000000000009", + "uuid": "00000000-0000-0000-0000-000000000009", "items": [ { "table_name": "INTERGER_PLUS", @@ -129,7 +129,7 @@ }, { "object_name": "IPv4-composition-NOT-client-ip", - "object_id": "00000000-0000-0000-0000-000000000010", + "uuid": "00000000-0000-0000-0000-000000000010", "items": [ { "table_type": "ip", @@ -142,7 +142,7 @@ }, { "object_name": "IPv4-composition-NOT-server-ip", - "object_id": "00000000-0000-0000-0000-000000000011", + "uuid": "00000000-0000-0000-0000-000000000011", "items": [ { "table_type": "ip", @@ -155,7 +155,7 @@ }, { "object_name": "financial-department-ip", - "object_id": "00000000-0000-0000-0000-000000000012", + "uuid": "00000000-0000-0000-0000-000000000012", "items": [ { "table_name": "IP_CONFIG", @@ -168,7 +168,7 @@ }, { "object_name": "security-department-ip", - "object_id": "00000000-0000-0000-0000-000000000013", + "uuid": "00000000-0000-0000-0000-000000000013", "items": [ { "table_name": "IP_PLUS_CONFIG", @@ -181,7 +181,7 @@ }, { "object_name": "develop-department-ip", - "object_id": "00000000-0000-0000-0000-000000000014", + "uuid": "00000000-0000-0000-0000-000000000014", "items": [ { "table_name": "IP_PLUS_CONFIG", @@ -194,7 +194,7 @@ }, { "object_name": "Country-Sparta-IP", - "object_id": "00000000-0000-0000-0000-000000000015", + "uuid": "00000000-0000-0000-0000-000000000015", "items": [ { "table_name": "GeoLocation", @@ -208,7 +208,7 @@ }, { "object_name": "123_IP_object", - "object_id": "00000000-0000-0000-0000-000000000100", + "uuid": "00000000-0000-0000-0000-000000000100", "items": [ { "table_name": "IP_CONFIG", @@ -228,7 +228,7 @@ }, { "object_name": "126_interval_object", - "object_id": "00000000-0000-0000-0000-000000000106", + "uuid": "00000000-0000-0000-0000-000000000106", "items": [ { "table_name": "CONTENT_SIZE", @@ -241,7 +241,7 @@ }, { "object_name": "TakeMeHome", - "object_id": "00000000-0000-0000-0000-000000000111", + "uuid": "00000000-0000-0000-0000-000000000111", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -255,7 +255,7 @@ }, { "object_name": "152_mail_addr", - "object_id": "00000000-0000-0000-0000-000000000141", + "uuid": "00000000-0000-0000-0000-000000000141", "items": [ { "table_type": "expr", @@ -277,7 +277,7 @@ }, { "object_name": "153_expr_object", - "object_id": "00000000-0000-0000-0000-000000000143", + "uuid": "00000000-0000-0000-0000-000000000143", "items": [ { "table_type": "expr", @@ -291,7 +291,7 @@ }, { "object_name": "vt_grp_http_sig1", - "object_id": "00000000-0000-0000-0000-000000000152", + "uuid": "00000000-0000-0000-0000-000000000152", "items": [ { "table_name": "HTTP_SIGNATURE", @@ -306,7 +306,7 @@ }, { "object_name": "vt_grp_http_sig2", - "object_id": "00000000-0000-0000-0000-000000000153", + "uuid": "00000000-0000-0000-0000-000000000153", "items": [ { "table_name": "HTTP_SIGNATURE", @@ -330,7 +330,7 @@ }, { "object_name": "167_url_object", - "object_id": "00000000-0000-0000-0000-000000000158", + "uuid": "00000000-0000-0000-0000-000000000158", "items": [ { "table_name": "HTTP_URL", @@ -344,7 +344,7 @@ }, { "object_name": "ExcludeLogicObject199_1", - "object_id": "00000000-0000-0000-0000-000000000189", + "uuid": "00000000-0000-0000-0000-000000000189", "is_exclude": 0, "items": [ { @@ -359,7 +359,7 @@ }, { "object_name": "ExcludeLogicObject199_2", - "object_id": "00000000-0000-0000-0000-000000000190", + "uuid": "00000000-0000-0000-0000-000000000190", "is_exclude": 1, "items": [ { @@ -374,7 +374,7 @@ }, { "object_name": "ExcludeLogicObject200_1", - "object_id": "00000000-0000-0000-0000-000000000192", + "uuid": "00000000-0000-0000-0000-000000000192", "is_exclude": 0, "items": [ { @@ -389,7 +389,7 @@ }, { "object_name": "ExcludeLogicObject200_2", - "object_id": "00000000-0000-0000-0000-000000000193", + "uuid": "00000000-0000-0000-0000-000000000193", "is_exclude": 1, "items": [ { @@ -404,7 +404,7 @@ }, { "object_name": "ExcludeLogicObject202_1", - "object_id": "00000000-0000-0000-0000-000000000195", + "uuid": "00000000-0000-0000-0000-000000000195", "is_exclude": 0, "items": [ { @@ -418,7 +418,7 @@ }, { "object_name": "ExcludeLogicObject202_2", - "object_id": "00000000-0000-0000-0000-000000000196", + "uuid": "00000000-0000-0000-0000-000000000196", "is_exclude": 1, "items": [ { @@ -432,7 +432,7 @@ }, { "object_name": "ExcludeLogicObject202_3", - "object_id": "00000000-0000-0000-0000-000000000197", + "uuid": "00000000-0000-0000-0000-000000000197", "is_exclude": 1, "items": [ { @@ -446,7 +446,7 @@ }, { "object_name": "ExcludeLogicObject203_3_1", - "object_id": "00000000-0000-0000-0000-000000000201", + "uuid": "00000000-0000-0000-0000-000000000201", "is_exclude": 0, "items": [ { @@ -461,7 +461,7 @@ }, { "object_name": "ExcludeLogicObject203_3_2", - "object_id": "00000000-0000-0000-0000-000000000202", + "uuid": "00000000-0000-0000-0000-000000000202", "is_exclude": 1, "items": [ { @@ -476,7 +476,7 @@ }, { "object_name": "ExcludeLogicObject204_3_1_1", - "object_id": "00000000-0000-0000-0000-000000000207", + "uuid": "00000000-0000-0000-0000-000000000207", "is_exclude": 0, "items": [ { @@ -491,7 +491,7 @@ }, { "object_name": "ExcludeLogicObject204_3_1_2", - "object_id": "00000000-0000-0000-0000-000000000208", + "uuid": "00000000-0000-0000-0000-000000000208", "is_exclude": 1, "items": [ { @@ -506,7 +506,7 @@ }, { "object_name": "ExcludeLogicObject204_3_2", - "object_id": "00000000-0000-0000-0000-000000000209", + "uuid": "00000000-0000-0000-0000-000000000209", "is_exclude": 1, "items": [ { @@ -521,7 +521,7 @@ }, { "object_name": "ExcludeLogicObject217_1_1", - "object_id": "00000000-0000-0000-0000-000000000223", + "uuid": "00000000-0000-0000-0000-000000000223", "is_exclude": 0, "items": [ { @@ -536,7 +536,7 @@ }, { "object_name": "ExcludeLogicObject217_1_2", - "object_id": "00000000-0000-0000-0000-000000000224", + "uuid": "00000000-0000-0000-0000-000000000224", "is_exclude": 1, "items": [ { @@ -552,93 +552,93 @@ ], "object_groups": [ { - "object_id": "00000000-0000-0000-0000-000000000500", - "include_object_ids": [ + "uuid": "00000000-0000-0000-0000-000000000500", + "include_object_uuids": [ "00000000-0000-0000-0000-000000000106" ] }, { - "object_id": "00000000-0000-0000-0000-000000000501", - "include_object_ids": [ + "uuid": "00000000-0000-0000-0000-000000000501", + "include_object_uuids": [ "00000000-0000-0000-0000-000000000141" ] }, { - "object_id": "00000000-0000-0000-0000-000000000502", - "include_object_ids": [ + "uuid": "00000000-0000-0000-0000-000000000502", + "include_object_uuids": [ "00000000-0000-0000-0000-000000000100" ] }, { - "object_id": "00000000-0000-0000-0000-000000000503", - "include_object_ids": [ + "uuid": "00000000-0000-0000-0000-000000000503", + "include_object_uuids": [ "00000000-0000-0000-0000-000000000189" ], - "exclude_object_ids": [ + "exclude_object_uuids": [ "00000000-0000-0000-0000-000000000190" ] }, { - "object_id": "00000000-0000-0000-0000-000000000504", - "include_object_ids": [ + "uuid": "00000000-0000-0000-0000-000000000504", + "include_object_uuids": [ "00000000-0000-0000-0000-000000000192" ], - "exclude_object_ids": [ + "exclude_object_uuids": [ "00000000-0000-0000-0000-000000000193" ] }, { - "object_id": "00000000-0000-0000-0000-000000000505", - "include_object_ids": [ + "uuid": "00000000-0000-0000-0000-000000000505", + "include_object_uuids": [ "00000000-0000-0000-0000-000000000195" ], - "exclude_object_ids": [ + "exclude_object_uuids": [ "00000000-0000-0000-0000-000000000196", "00000000-0000-0000-0000-000000000197" ] }, { - "object_id": "00000000-0000-0000-0000-000000000506", - "include_object_ids": [ + "uuid": "00000000-0000-0000-0000-000000000506", + "include_object_uuids": [ "00000000-0000-0000-0000-000000000201" ], - "exclude_object_ids": [ + "exclude_object_uuids": [ "00000000-0000-0000-0000-000000000202" ] }, { - "object_id": "00000000-0000-0000-0000-000000000507", + "uuid": "00000000-0000-0000-0000-000000000507", "object_name": "ExcludeLogicObject204_3_1", - "include_object_ids": [ + "include_object_uuids": [ "00000000-0000-0000-0000-000000000207" ], - "exclude_object_ids": [ + "exclude_object_uuids": [ "00000000-0000-0000-0000-000000000208" ] }, { - "object_id": "00000000-0000-0000-0000-000000000508", + "uuid": "00000000-0000-0000-0000-000000000508", "object_name": "ExcludeLogicObject204_3", - "include_object_ids": [ + "include_object_uuids": [ "00000000-0000-0000-0000-000000000507" ], - "exclude_object_ids": [ + "exclude_object_uuids": [ "00000000-0000-0000-0000-000000000209" ] }, { - "object_id": "00000000-0000-0000-0000-000000000509", - "include_object_ids": [ + "uuid": "00000000-0000-0000-0000-000000000509", + "include_object_uuids": [ "00000000-0000-0000-0000-000000000223" ], - "exclude_object_ids": [ + "exclude_object_uuids": [ "00000000-0000-0000-0000-000000000224" ] } ], "rules": [ { - "rule_id": "00000000-0000-0000-0000-000000000123", + "uuid": "00000000-0000-0000-0000-000000000123", "service": 1, "action": 1, "do_blacklist": 1, @@ -648,7 +648,7 @@ "conditions": [ { "attribute": "IP_CONFIG", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000100" ] }, @@ -657,7 +657,7 @@ "objects": [ { "object_name": "123_url_object", - "object_id": "00000000-0000-0000-0000-000000000101", + "uuid": "00000000-0000-0000-0000-000000000101", "items": [ { "table_name": "HTTP_URL", @@ -674,7 +674,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000124", + "uuid": "00000000-0000-0000-0000-000000000124", "service": 1, "action": 1, "do_blacklist": 1, @@ -684,7 +684,7 @@ "conditions": [ { "attribute": "IP_CONFIG", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000100" ] }, @@ -693,7 +693,7 @@ "objects": [ { "object_name": "124_interval_object", - "object_id": "00000000-0000-0000-0000-000000000102", + "uuid": "00000000-0000-0000-0000-000000000102", "items": [ { "table_name": "CONTENT_SIZE", @@ -709,7 +709,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000125", + "uuid": "00000000-0000-0000-0000-000000000125", "service": 1, "action": 1, "do_blacklist": 1, @@ -722,7 +722,7 @@ "objects": [ { "object_name": "125_url_object", - "object_id": "00000000-0000-0000-0000-000000000103", + "uuid": "00000000-0000-0000-0000-000000000103", "items": [ { "table_name": "HTTP_URL", @@ -739,7 +739,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000126", + "uuid": "00000000-0000-0000-0000-000000000126", "service": 1, "action": 1, "do_blacklist": 1, @@ -752,7 +752,7 @@ "objects": [ { "object_name": "126_url_object", - "object_id": "00000000-0000-0000-0000-000000000105", + "uuid": "00000000-0000-0000-0000-000000000105", "items": [ { "table_name": "HTTP_URL", @@ -768,14 +768,14 @@ }, { "attribute": "CONTENT_SIZE", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000106" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000128", + "uuid": "00000000-0000-0000-0000-000000000128", "service": 1, "action": 1, "do_blacklist": 1, @@ -788,7 +788,7 @@ "objects": [ { "object_name": "128_expr_object", - "object_id": "00000000-0000-0000-0000-000000000107", + "uuid": "00000000-0000-0000-0000-000000000107", "items": [ { "table_name": "HTTP_SIGNATURE", @@ -806,7 +806,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000129", + "uuid": "00000000-0000-0000-0000-000000000129", "service": 1, "action": 1, "do_blacklist": 1, @@ -819,7 +819,7 @@ "objects": [ { "object_name": "129_url_object", - "object_id": "00000000-0000-0000-0000-000000000108", + "uuid": "00000000-0000-0000-0000-000000000108", "items": [ { "table_name": "HTTP_URL", @@ -836,7 +836,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000130", + "uuid": "00000000-0000-0000-0000-000000000130", "service": 1, "action": 1, "do_blacklist": 1, @@ -849,7 +849,7 @@ "objects": [ { "object_name": "130_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000109", + "uuid": "00000000-0000-0000-0000-000000000109", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -866,7 +866,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000131", + "uuid": "00000000-0000-0000-0000-000000000131", "service": 1, "action": 1, "do_blacklist": 1, @@ -879,7 +879,7 @@ "objects": [ { "object_name": "131_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000110", + "uuid": "00000000-0000-0000-0000-000000000110", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -896,7 +896,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000132", + "uuid": "00000000-0000-0000-0000-000000000132", "service": 1, "action": 1, "do_blacklist": 1, @@ -906,14 +906,14 @@ "conditions": [ { "attribute": "KEYWORDS_TABLE", - "object_ids":[ + "object_uuids":[ "00000000-0000-0000-0000-000000000111" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000133", + "uuid": "00000000-0000-0000-0000-000000000133", "service": 1, "action": 1, "do_blacklist": 1, @@ -926,7 +926,7 @@ "objects": [ { "object_name": "133_host_object", - "object_id": "00000000-0000-0000-0000-000000000112", + "uuid": "00000000-0000-0000-0000-000000000112", "items": [ { "table_name": "HTTP_HOST", @@ -943,7 +943,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000134", + "uuid": "00000000-0000-0000-0000-000000000134", "service": 1, "action": 1, "do_blacklist": 1, @@ -956,7 +956,7 @@ "objects": [ { "object_name": "134_url_object", - "object_id": "00000000-0000-0000-0000-000000000113", + "uuid": "00000000-0000-0000-0000-000000000113", "items": [ { "table_name": "HTTP_URL", @@ -973,7 +973,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000136", + "uuid": "00000000-0000-0000-0000-000000000136", "service": 1, "action": 1, "do_blacklist": 1, @@ -986,7 +986,7 @@ "objects": [ { "object_name": "136_expr_object", - "object_id": "00000000-0000-0000-0000-000000000114", + "uuid": "00000000-0000-0000-0000-000000000114", "items": [ { "table_name": "IMAGE_FP", @@ -1003,7 +1003,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000137", + "uuid": "00000000-0000-0000-0000-000000000137", "service": 1, "action": 1, "do_blacklist": 1, @@ -1016,7 +1016,7 @@ "objects": [ { "object_name": "137_expr_object", - "object_id": "00000000-0000-0000-0000-000000000115", + "uuid": "00000000-0000-0000-0000-000000000115", "items": [ { "table_name": "IMAGE_FP", @@ -1033,7 +1033,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000138", + "uuid": "00000000-0000-0000-0000-000000000138", "service": 1, "action": 1, "do_blacklist": 1, @@ -1048,7 +1048,7 @@ "objects": [ { "object_name": "138_url_object", - "object_id": "00000000-0000-0000-0000-000000000116", + "uuid": "00000000-0000-0000-0000-000000000116", "items": [ { "table_name": "HTTP_URL", @@ -1065,7 +1065,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000139", + "uuid": "00000000-0000-0000-0000-000000000139", "service": 1, "action": 1, "do_blacklist": 1, @@ -1080,7 +1080,7 @@ "objects": [ { "object_name": "139_url_object", - "object_id": "00000000-0000-0000-0000-000000000117", + "uuid": "00000000-0000-0000-0000-000000000117", "items": [ { "table_name": "HTTP_URL", @@ -1097,7 +1097,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000140", + "uuid": "00000000-0000-0000-0000-000000000140", "service": 1, "action": 1, "do_blacklist": 1, @@ -1110,7 +1110,7 @@ "objects": [ { "object_name": "140_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000118", + "uuid": "00000000-0000-0000-0000-000000000118", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1127,7 +1127,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000141", + "uuid": "00000000-0000-0000-0000-000000000141", "service": 1, "action": 1, "do_blacklist": 1, @@ -1142,7 +1142,7 @@ "objects": [ { "object_name": "141_url_object", - "object_id": "00000000-0000-0000-0000-000000000119", + "uuid": "00000000-0000-0000-0000-000000000119", "items": [ { "table_name": "HTTP_URL", @@ -1159,7 +1159,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000142", + "uuid": "00000000-0000-0000-0000-000000000142", "service": 1, "action": 1, "do_blacklist": 1, @@ -1172,7 +1172,7 @@ "objects": [ { "object_name": "142_url_object", - "object_id": "00000000-0000-0000-0000-000000000120", + "uuid": "00000000-0000-0000-0000-000000000120", "items": [ { "table_name": "HTTP_URL", @@ -1189,7 +1189,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000143", + "uuid": "00000000-0000-0000-0000-000000000143", "service": 1, "action": 1, "do_blacklist": 1, @@ -1203,7 +1203,7 @@ "objects": [ { "object_name": "143_url_object1", - "object_id": "00000000-0000-0000-0000-000000000121", + "uuid": "00000000-0000-0000-0000-000000000121", "items": [ { "table_name": "HTTP_URL", @@ -1223,7 +1223,7 @@ "objects": [ { "object_name": "143_url_object2", - "object_id": "00000000-0000-0000-0000-000000000122", + "uuid": "00000000-0000-0000-0000-000000000122", "items": [ { "table_name": "HTTP_URL", @@ -1240,7 +1240,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000144", + "uuid": "00000000-0000-0000-0000-000000000144", "service": 1, "action": 1, "do_blacklist": 1, @@ -1254,7 +1254,7 @@ "objects": [ { "object_name": "144_url_object", - "object_id": "00000000-0000-0000-0000-000000000123", + "uuid": "00000000-0000-0000-0000-000000000123", "items": [ { "table_name": "HTTP_URL", @@ -1274,7 +1274,7 @@ "objects": [ { "object_name": "144_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000124", + "uuid": "00000000-0000-0000-0000-000000000124", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1291,7 +1291,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000145", + "uuid": "00000000-0000-0000-0000-000000000145", "service": 1, "action": 1, "do_blacklist": 1, @@ -1305,7 +1305,7 @@ "objects": [ { "object_name": "145_url_object", - "object_id": "00000000-0000-0000-0000-000000000125", + "uuid": "00000000-0000-0000-0000-000000000125", "items": [ { "table_name": "HTTP_URL", @@ -1322,14 +1322,14 @@ { "attribute": "ATTRIBUTE_IP_CONFIG", "negate_option": 1, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000100" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000146", + "uuid": "00000000-0000-0000-0000-000000000146", "service": 1, "action": 1, "do_blacklist": 1, @@ -1344,7 +1344,7 @@ "objects": [ { "object_name": "146_url_object", - "object_id": "00000000-0000-0000-0000-000000000126", + "uuid": "00000000-0000-0000-0000-000000000126", "items": [ { "table_name": "HTTP_URL", @@ -1365,7 +1365,7 @@ "objects": [ { "object_name": "146_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000127", + "uuid": "00000000-0000-0000-0000-000000000127", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1383,14 +1383,14 @@ "attribute": "ATTRIBUTE_IP_CONFIG", "negate_option": 1, "condition_index": 2, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000100" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000147", + "uuid": "00000000-0000-0000-0000-000000000147", "service": 1, "action": 1, "do_blacklist": 1, @@ -1405,7 +1405,7 @@ "objects": [ { "object_name": "147_keywords_object1", - "object_id": "00000000-0000-0000-0000-000000000128", + "uuid": "00000000-0000-0000-0000-000000000128", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1426,7 +1426,7 @@ "objects": [ { "object_name": "147_keywords_object2", - "object_id": "00000000-0000-0000-0000-000000000129", + "uuid": "00000000-0000-0000-0000-000000000129", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1447,7 +1447,7 @@ "objects": [ { "object_name": "147_keywords_object3", - "object_id": "00000000-0000-0000-0000-000000000130", + "uuid": "00000000-0000-0000-0000-000000000130", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1468,7 +1468,7 @@ "objects": [ { "object_name": "147_keywords_object4", - "object_id": "00000000-0000-0000-0000-000000000131", + "uuid": "00000000-0000-0000-0000-000000000131", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1489,7 +1489,7 @@ "objects": [ { "object_name": "147_keywords_object5", - "object_id": "00000000-0000-0000-0000-000000000132", + "uuid": "00000000-0000-0000-0000-000000000132", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1510,7 +1510,7 @@ "objects": [ { "object_name": "147_keywords_object6", - "object_id": "00000000-0000-0000-0000-000000000133", + "uuid": "00000000-0000-0000-0000-000000000133", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1531,7 +1531,7 @@ "objects": [ { "object_name": "147_keywords_object7", - "object_id": "00000000-0000-0000-0000-000000000134", + "uuid": "00000000-0000-0000-0000-000000000134", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1552,7 +1552,7 @@ "objects": [ { "object_name": "147_keywords_object8", - "object_id": "00000000-0000-0000-0000-000000000135", + "uuid": "00000000-0000-0000-0000-000000000135", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1569,7 +1569,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000148", + "uuid": "00000000-0000-0000-0000-000000000148", "service": 1, "action": 1, "do_blacklist": 1, @@ -1582,7 +1582,7 @@ "objects": [ { "object_name": "148_url_object", - "object_id": "00000000-0000-0000-0000-000000000136", + "uuid": "00000000-0000-0000-0000-000000000136", "items": [ { "table_name": "HTTP_URL", @@ -1599,7 +1599,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000150", + "uuid": "00000000-0000-0000-0000-000000000150", "service": 0, "action": 0, "do_blacklist": 0, @@ -1612,7 +1612,7 @@ "objects": [ { "object_name": "billgates_regist1", - "object_id": "00000000-0000-0000-0000-000000000138", + "uuid": "00000000-0000-0000-0000-000000000138", "items": [ { "table_type": "expr", @@ -1631,7 +1631,7 @@ "objects": [ { "object_name": "billgates_regist2", - "object_id": "00000000-0000-0000-0000-000000000139", + "uuid": "00000000-0000-0000-0000-000000000139", "items": [ { "table_type": "expr", @@ -1648,7 +1648,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000151", + "uuid": "00000000-0000-0000-0000-000000000151", "service": 0, "action": 0, "do_blacklist": 0, @@ -1661,7 +1661,7 @@ "objects": [ { "object_name": "151_expr_object", - "object_id": "00000000-0000-0000-0000-000000000140", + "uuid": "00000000-0000-0000-0000-000000000140", "items": [ { "table_type": "expr", @@ -1678,7 +1678,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000152", + "uuid": "00000000-0000-0000-0000-000000000152", "service": 0, "action": 0, "do_blacklist": 0, @@ -1688,20 +1688,20 @@ "conditions": [ { "attribute": "MAIL_ADDR", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000141" ] }, { "attribute": "CONTENT_SIZE", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000500" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000153", + "uuid": "00000000-0000-0000-0000-000000000153", "service": 0, "action": 0, "do_blacklist": 0, @@ -1712,21 +1712,21 @@ { "attribute": "MAIL_ADDR", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000143", "00000000-0000-0000-0000-000000000501" ] }, { "attribute": "IP_CONFIG", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000502" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000154", + "uuid": "00000000-0000-0000-0000-000000000154", "service": 0, "action": 0, "do_blacklist": 0, @@ -1740,7 +1740,7 @@ "objects": [ { "object_name": "154_IP_object", - "object_id": "00000000-0000-0000-0000-000000000145", + "uuid": "00000000-0000-0000-0000-000000000145", "items": [ { "table_type": "ip", @@ -1756,7 +1756,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000155", + "uuid": "00000000-0000-0000-0000-000000000155", "service": 0, "action": 0, "do_blacklist": 0, @@ -1770,7 +1770,7 @@ "objects": [ { "object_name": "155_IP_object", - "object_id": "00000000-0000-0000-0000-000000000146", + "uuid": "00000000-0000-0000-0000-000000000146", "items": [ { "table_type": "ip", @@ -1786,7 +1786,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000157", + "uuid": "00000000-0000-0000-0000-000000000157", "service": 0, "action": 0, "do_blacklist": 0, @@ -1799,7 +1799,7 @@ "objects": [ { "object_name": "157_expr_object", - "object_id": "00000000-0000-0000-0000-000000000148", + "uuid": "00000000-0000-0000-0000-000000000148", "items": [ { "table_type": "expr", @@ -1816,7 +1816,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000158", + "uuid": "00000000-0000-0000-0000-000000000158", "service": 0, "action": 0, "do_blacklist": 0, @@ -1829,7 +1829,7 @@ "objects": [ { "object_name": "158_IP_object", - "object_id": "00000000-0000-0000-0000-000000000149", + "uuid": "00000000-0000-0000-0000-000000000149", "items": [ { "table_type": "ip", @@ -1845,7 +1845,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000159", + "uuid": "00000000-0000-0000-0000-000000000159", "service": 0, "action": 0, "do_blacklist": 0, @@ -1858,7 +1858,7 @@ "objects": [ { "object_name": "159_IP_object", - "object_id": "00000000-0000-0000-0000-000000000150", + "uuid": "00000000-0000-0000-0000-000000000150", "items": [ { "table_type": "ip", @@ -1874,7 +1874,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000160", + "uuid": "00000000-0000-0000-0000-000000000160", "service": 0, "action": 0, "do_blacklist": 0, @@ -1885,7 +1885,7 @@ { "attribute": "HTTP_RESPONSE_KEYWORDS", "negate_option": 0, - "object_ids":[ + "object_uuids":[ "00000000-0000-0000-0000-000000000111" ] }, @@ -1895,7 +1895,7 @@ "objects": [ { "object_name": "160_url_object", - "object_id": "00000000-0000-0000-0000-000000000151", + "uuid": "00000000-0000-0000-0000-000000000151", "items": [ { "table_name": "HTTP_URL", @@ -1912,7 +1912,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000163", + "uuid": "00000000-0000-0000-0000-000000000163", "service": 0, "action": 0, "do_blacklist": 0, @@ -1923,21 +1923,21 @@ { "attribute": "HTTP_REQUEST_HEADER", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000153" ] }, { "attribute": "HTTP_RESPONSE_HEADER", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000153" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000164", + "uuid": "00000000-0000-0000-0000-000000000164", "service": 1, "action": 1, "do_blacklist": 1, @@ -1950,7 +1950,7 @@ "objects": [ { "object_name": "164_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000154", + "uuid": "00000000-0000-0000-0000-000000000154", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -1967,7 +1967,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000165", + "uuid": "00000000-0000-0000-0000-000000000165", "service": 1, "action": 1, "do_blacklist": 1, @@ -1981,7 +1981,7 @@ "objects": [ { "object_name": "165_url_object", - "object_id": "00000000-0000-0000-0000-000000000155", + "uuid": "00000000-0000-0000-0000-000000000155", "items": [ { "table_name": "HTTP_URL", @@ -2001,7 +2001,7 @@ "objects": [ { "object_name": "165_IP_object", - "object_id": "00000000-0000-0000-0000-000000000156", + "uuid": "00000000-0000-0000-0000-000000000156", "items": [ { "table_type": "ip", @@ -2017,7 +2017,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000166", + "uuid": "00000000-0000-0000-0000-000000000166", "service": 1, "action": 1, "do_blacklist": 1, @@ -2031,7 +2031,7 @@ "objects": [ { "object_name": "166_url_object", - "object_id": "00000000-0000-0000-0000-000000000157", + "uuid": "00000000-0000-0000-0000-000000000157", "items": [ { "table_name": "HTTP_URL", @@ -2048,7 +2048,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000167", + "uuid": "00000000-0000-0000-0000-000000000167", "service": 1, "action": 1, "do_blacklist": 1, @@ -2060,13 +2060,13 @@ { "attribute": "HTTP_URL", "condition_index": 1, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000158" ] }, { "attribute": "HTTP_URL", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000158" ], "condition_index": 3 @@ -2074,7 +2074,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000168", + "uuid": "00000000-0000-0000-0000-000000000168", "service": 1, "action": 1, "do_blacklist": 1, @@ -2085,14 +2085,14 @@ "conditions": [ { "attribute": "HTTP_URL", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000158" ], "condition_index": 2 }, { "attribute": "HTTP_URL", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000158" ], "condition_index": 6 @@ -2100,7 +2100,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000169", + "uuid": "00000000-0000-0000-0000-000000000169", "service": 0, "action": 0, "do_blacklist": 0, @@ -2115,7 +2115,7 @@ "objects": [ { "object_name": "169_IP_object", - "object_id": "00000000-0000-0000-0000-000000000160", + "uuid": "00000000-0000-0000-0000-000000000160", "items": [ { "table_type": "ip", @@ -2131,7 +2131,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000170", + "uuid": "00000000-0000-0000-0000-000000000170", "service": 0, "action": 0, "do_blacklist": 0, @@ -2145,7 +2145,7 @@ "objects": [ { "object_name": "ipv4_attribute.source", - "object_id": "00000000-0000-0000-0000-000000000161", + "uuid": "00000000-0000-0000-0000-000000000161", "items": [ { "table_type": "ip", @@ -2161,7 +2161,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000171", + "uuid": "00000000-0000-0000-0000-000000000171", "service": 0, "action": 0, "do_blacklist": 0, @@ -2175,7 +2175,7 @@ "objects": [ { "object_name": "ipv4_attribute.destination", - "object_id": "00000000-0000-0000-0000-000000000162", + "uuid": "00000000-0000-0000-0000-000000000162", "items": [ { "table_type": "ip", @@ -2191,7 +2191,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000177", + "uuid": "00000000-0000-0000-0000-000000000177", "service": 1, "action": 1, "do_blacklist": 1, @@ -2202,7 +2202,7 @@ { "attribute": "ASN_NOT_LOGIC", "negate_option": 1, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000003", "00000000-0000-0000-0000-000000000004" @@ -2212,7 +2212,7 @@ { "attribute": "DESTINATION_IP_ASN", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000002" ], "condition_index": 1 @@ -2220,7 +2220,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000178", + "uuid": "00000000-0000-0000-0000-000000000178", "service": 1, "action": 1, "do_blacklist": 1, @@ -2230,7 +2230,7 @@ "conditions": [ { "attribute": "SOURCE_IP_ASN", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000003", "00000000-0000-0000-0000-000000000004" @@ -2241,7 +2241,7 @@ { "attribute": "DESTINATION_IP_ASN", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000002" ], "condition_index": 1 @@ -2249,7 +2249,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000180", + "uuid": "00000000-0000-0000-0000-000000000180", "service": 1, "action": 1, "do_blacklist": 1, @@ -2260,7 +2260,7 @@ { "attribute": "SOURCE_IP_ASN", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000003", "00000000-0000-0000-0000-000000000004" @@ -2270,7 +2270,7 @@ { "attribute": "SOURCE_IP_GEO", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000015" ], "condition_index": 0 @@ -2278,7 +2278,7 @@ { "attribute": "IP_CONFIG", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000012" ], "condition_index": 1 @@ -2286,7 +2286,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000181", + "uuid": "00000000-0000-0000-0000-000000000181", "service": 1, "action": 1, "do_blacklist": 1, @@ -2297,7 +2297,7 @@ { "attribute": "SOURCE_IP_ASN", "negate_option": 1, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000003", "00000000-0000-0000-0000-000000000004" @@ -2307,7 +2307,7 @@ { "attribute": "IP_PLUS_CONFIG", "negate_option": 1, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000014" ], "condition_index": 0 @@ -2315,7 +2315,7 @@ { "attribute": "SOURCE_IP_GEO", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000015" ], "condition_index": 1 @@ -2323,7 +2323,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000182", + "uuid": "00000000-0000-0000-0000-000000000182", "service": 1, "action": 1, "do_blacklist": 1, @@ -2336,7 +2336,7 @@ "objects": [ { "object_name": "182_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000167", + "uuid": "00000000-0000-0000-0000-000000000167", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -2353,7 +2353,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000184", + "uuid": "00000000-0000-0000-0000-000000000184", "user_region": "APP_ID=6006740;Liumengyan-Bugreport-20210515", "description": "Hulu", "is_valid": "yes", @@ -2367,7 +2367,7 @@ "objects": [ { "object_name": "184_IP_object", - "object_id": "00000000-0000-0000-0000-000000000169", + "uuid": "00000000-0000-0000-0000-000000000169", "items": [ { "table_name": "IP_CONFIG", @@ -2383,7 +2383,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000185", + "uuid": "00000000-0000-0000-0000-000000000185", "service": 1, "action": 1, "do_blacklist": 1, @@ -2394,7 +2394,7 @@ { "attribute": "DESTINATION_IP_ASN", "negate_option": 1, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000003", "00000000-0000-0000-0000-000000000004" @@ -2404,7 +2404,7 @@ { "attribute": "SOURCE_IP_GEO", "negate_option": 1, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000015" ], "condition_index": 0 @@ -2412,7 +2412,7 @@ { "attribute": "DESTINATION_IP_ASN", "negate_option": 1, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000005" ], "condition_index": 1 @@ -2420,7 +2420,7 @@ { "attribute": "DESTINATION_IP_ASN", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000006" ], "condition_index": 2 @@ -2428,7 +2428,7 @@ { "attribute": "IP_PLUS_CONFIG", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000013" ], "condition_index": 3 @@ -2436,7 +2436,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000186", + "uuid": "00000000-0000-0000-0000-000000000186", "service": 1, "action": 1, "do_blacklist": 1, @@ -2450,7 +2450,7 @@ "objects": [ { "object_name": "186_expr_object", - "object_id": "00000000-0000-0000-0000-000000000170", + "uuid": "00000000-0000-0000-0000-000000000170", "items": [ { "table_name": "HTTP_URL", @@ -2470,7 +2470,7 @@ "objects": [ { "object_name": "186_IP_object", - "object_id": "00000000-0000-0000-0000-000000000171", + "uuid": "00000000-0000-0000-0000-000000000171", "items": [ { "table_type": "ip", @@ -2486,7 +2486,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000187", + "uuid": "00000000-0000-0000-0000-000000000187", "service": 1, "action": 1, "do_blacklist": 1, @@ -2500,7 +2500,7 @@ "objects": [ { "object_name": "187_url_object", - "object_id": "00000000-0000-0000-0000-000000000172", + "uuid": "00000000-0000-0000-0000-000000000172", "items": [ { "table_name": "HTTP_URL", @@ -2520,7 +2520,7 @@ "objects": [ { "object_name": "187_IP_object", - "object_id": "00000000-0000-0000-0000-000000000173", + "uuid": "00000000-0000-0000-0000-000000000173", "items": [ { "table_type": "ip", @@ -2536,7 +2536,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000188", + "uuid": "00000000-0000-0000-0000-000000000188", "service": 1, "action": 1, "do_blacklist": 1, @@ -2550,7 +2550,7 @@ "objects": [ { "object_name": "188_url_object", - "object_id": "00000000-0000-0000-0000-000000000174", + "uuid": "00000000-0000-0000-0000-000000000174", "items": [ { "table_name": "HTTP_URL", @@ -2570,7 +2570,7 @@ "objects": [ { "object_name": "188_IP_object", - "object_id": "00000000-0000-0000-0000-000000000175", + "uuid": "00000000-0000-0000-0000-000000000175", "items": [ { "table_type": "ip", @@ -2586,7 +2586,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000189", + "uuid": "00000000-0000-0000-0000-000000000189", "is_valid": "yes", "do_log": 0, "action": 0, @@ -2599,7 +2599,7 @@ "objects": [ { "object_name": "189_app_object", - "object_id": "00000000-0000-0000-0000-000000000176", + "uuid": "00000000-0000-0000-0000-000000000176", "items": [ { "table_name": "APP_PAYLOAD", @@ -2617,7 +2617,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000191", + "uuid": "00000000-0000-0000-0000-000000000191", "service": 0, "action": 0, "do_blacklist": 0, @@ -2630,7 +2630,7 @@ "objects": [ { "object_name": "191_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000178", + "uuid": "00000000-0000-0000-0000-000000000178", "items": [ { "table_type": "expr", @@ -2647,7 +2647,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000192", + "uuid": "00000000-0000-0000-0000-000000000192", "service": 0, "action": 0, "do_blacklist": 0, @@ -2660,7 +2660,7 @@ "objects": [ { "object_name": "192_flag_object", - "object_id": "00000000-0000-0000-0000-000000000179", + "uuid": "00000000-0000-0000-0000-000000000179", "items": [ { "table_type": "flag", @@ -2677,7 +2677,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000193", + "uuid": "00000000-0000-0000-0000-000000000193", "service": 0, "action": 0, "do_blacklist": 0, @@ -2690,7 +2690,7 @@ "objects": [ { "object_name": "193_flag_object", - "object_id": "00000000-0000-0000-0000-000000000180", + "uuid": "00000000-0000-0000-0000-000000000180", "items": [ { "table_type": "flag", @@ -2709,7 +2709,7 @@ "objects": [ { "object_name": "193_url_object", - "object_id": "00000000-0000-0000-0000-000000000181", + "uuid": "00000000-0000-0000-0000-000000000181", "items": [ { "table_name": "HTTP_URL", @@ -2726,7 +2726,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000194", + "uuid": "00000000-0000-0000-0000-000000000194", "service": 0, "action": 0, "do_blacklist": 0, @@ -2739,7 +2739,7 @@ "objects": [ { "object_name": "194_flag_object", - "object_id": "00000000-0000-0000-0000-000000000182", + "uuid": "00000000-0000-0000-0000-000000000182", "items": [ { "table_type": "flag", @@ -2756,7 +2756,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000197", + "uuid": "00000000-0000-0000-0000-000000000197", "service": 1, "action": 1, "do_blacklist": 1, @@ -2769,7 +2769,7 @@ "objects": [ { "object_name": "197_url_object", - "object_id": "00000000-0000-0000-0000-000000000186", + "uuid": "00000000-0000-0000-0000-000000000186", "items": [ { "table_name": "HTTP_URL", @@ -2786,7 +2786,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000198", + "uuid": "00000000-0000-0000-0000-000000000198", "service": 1, "action": 1, "do_blacklist": 1, @@ -2801,7 +2801,7 @@ "objects": [ { "object_name": "198_url_object", - "object_id": "00000000-0000-0000-0000-000000000187", + "uuid": "00000000-0000-0000-0000-000000000187", "items": [ { "table_name": "HTTP_URL", @@ -2818,7 +2818,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000199", + "uuid": "00000000-0000-0000-0000-000000000199", "service": 1, "action": 1, "do_blacklist": 1, @@ -2829,14 +2829,14 @@ { "attribute": "HTTP_URL", "object_name": "ExcludeLogicObject199", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000503" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000200", + "uuid": "00000000-0000-0000-0000-000000000200", "service": 1, "action": 1, "do_blacklist": 1, @@ -2846,14 +2846,14 @@ "conditions": [ { "attribute": "HTTP_URL", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000504" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000202", + "uuid": "00000000-0000-0000-0000-000000000202", "service": 1, "action": 1, "do_blacklist": 1, @@ -2864,7 +2864,7 @@ { "attribute": "ATTRIBUTE_IP_PLUS_TABLE", "object_name": "ExcludeLogicObject202", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000505" ], "condition_index": 0 @@ -2872,7 +2872,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000203", + "uuid": "00000000-0000-0000-0000-000000000203", "service": 1, "action": 1, "do_blacklist": 1, @@ -2886,7 +2886,7 @@ "objects": [ { "object_name": "ExcludeLogicObject203_1", - "object_id": "00000000-0000-0000-0000-000000000198", + "uuid": "00000000-0000-0000-0000-000000000198", "items": [ { "table_name": "IP_PLUS_CONFIG", @@ -2905,7 +2905,7 @@ "objects": [ { "object_name": "ExcludeLogicObject203_2", - "object_id": "00000000-0000-0000-0000-000000000199", + "uuid": "00000000-0000-0000-0000-000000000199", "items": [ { "table_name": "IP_PLUS_CONFIG", @@ -2921,7 +2921,7 @@ { "attribute": "HTTP_RESPONSE_KEYWORDS", "object_name": "ExcludeLogicObject203_3", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000506" ], "condition_index": 2 @@ -2929,7 +2929,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000204", + "uuid": "00000000-0000-0000-0000-000000000204", "service": 1, "action": 1, "do_blacklist": 1, @@ -2943,7 +2943,7 @@ "objects": [ { "object_name": "ExcludeLogicObject204_1", - "object_id": "00000000-0000-0000-0000-000000000203", + "uuid": "00000000-0000-0000-0000-000000000203", "items": [ { "table_name": "IP_PLUS_CONFIG", @@ -2962,7 +2962,7 @@ "objects": [ { "object_name": "ExcludeLogicObject204_2", - "object_id": "00000000-0000-0000-0000-000000000204", + "uuid": "00000000-0000-0000-0000-000000000204", "items": [ { "table_name": "IP_PLUS_CONFIG", @@ -2977,7 +2977,7 @@ }, { "attribute": "HTTP_RESPONSE_KEYWORDS", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000508" ], "condition_index": 2 @@ -2985,7 +2985,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000205", + "uuid": "00000000-0000-0000-0000-000000000205", "service": 0, "action": 0, "do_blacklist": 0, @@ -2998,7 +2998,7 @@ "objects": [ { "object_name": "205_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000210", + "uuid": "00000000-0000-0000-0000-000000000210", "items": [ { "table_type": "expr", @@ -3015,7 +3015,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000206", + "uuid": "00000000-0000-0000-0000-000000000206", "service": 0, "action": 0, "do_blacklist": 0, @@ -3028,7 +3028,7 @@ "objects": [ { "object_name": "206_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000211", + "uuid": "00000000-0000-0000-0000-000000000211", "items": [ { "table_type": "expr", @@ -3045,7 +3045,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000207", + "uuid": "00000000-0000-0000-0000-000000000207", "service": 0, "action": 0, "do_blacklist": 0, @@ -3058,7 +3058,7 @@ "objects": [ { "object_name": "207_flag_object", - "object_id": "00000000-0000-0000-0000-000000000212", + "uuid": "00000000-0000-0000-0000-000000000212", "items": [ { "table_type": "flag", @@ -3075,7 +3075,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000208", + "uuid": "00000000-0000-0000-0000-000000000208", "service": 0, "action": 0, "do_blacklist": 0, @@ -3089,7 +3089,7 @@ "objects": [ { "object_name": "208_IP_object", - "object_id": "00000000-0000-0000-0000-000000000213", + "uuid": "00000000-0000-0000-0000-000000000213", "items": [ { "table_type": "ip", @@ -3105,7 +3105,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000210", + "uuid": "00000000-0000-0000-0000-000000000210", "service": 0, "action": 0, "do_blacklist": 0, @@ -3118,7 +3118,7 @@ "objects": [ { "object_name": "210_IP_object", - "object_id": "00000000-0000-0000-0000-000000000215", + "uuid": "00000000-0000-0000-0000-000000000215", "items": [ { "table_type": "ip", @@ -3134,7 +3134,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000211", + "uuid": "00000000-0000-0000-0000-000000000211", "service": 0, "action": 0, "do_blacklist": 0, @@ -3148,7 +3148,7 @@ "objects": [ { "object_name": "211_IP_object", - "object_id": "00000000-0000-0000-0000-000000000216", + "uuid": "00000000-0000-0000-0000-000000000216", "items": [ { "table_type": "ip", @@ -3164,7 +3164,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000212", + "uuid": "00000000-0000-0000-0000-000000000212", "service": 1, "action": 1, "do_blacklist": 1, @@ -3177,7 +3177,7 @@ "objects": [ { "object_name": "212_interval_object", - "object_id": "00000000-0000-0000-0000-000000000217", + "uuid": "00000000-0000-0000-0000-000000000217", "items": [ { "table_name": "INTEGER_PERF_CONFIG", @@ -3193,7 +3193,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000213", + "uuid": "00000000-0000-0000-0000-000000000213", "service": 1, "action": 1, "do_blacklist": 1, @@ -3206,7 +3206,7 @@ "objects": [ { "object_name": "213_expr_object", - "object_id": "00000000-0000-0000-0000-000000000218", + "uuid": "00000000-0000-0000-0000-000000000218", "items": [ { "table_name": "EXPR_LITERAL_PERF_CONFIG", @@ -3223,7 +3223,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000214", + "uuid": "00000000-0000-0000-0000-000000000214", "service": 0, "action": 0, "do_blacklist": 0, @@ -3236,7 +3236,7 @@ "objects": [ { "object_name": "214_flag_object", - "object_id": "00000000-0000-0000-0000-000000000219", + "uuid": "00000000-0000-0000-0000-000000000219", "items": [ { "table_type": "flag", @@ -3253,7 +3253,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000215", + "uuid": "00000000-0000-0000-0000-000000000215", "service": 1, "action": 1, "do_blacklist": 1, @@ -3266,7 +3266,7 @@ "objects": [ { "object_name": "215_expr_object", - "object_id": "00000000-0000-0000-0000-000000000220", + "uuid": "00000000-0000-0000-0000-000000000220", "items": [ { "table_name": "EXPR_REGEX_PERF_CONFIG", @@ -3283,7 +3283,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000216", + "uuid": "00000000-0000-0000-0000-000000000216", "service": 0, "action": 0, "do_blacklist": 0, @@ -3294,7 +3294,7 @@ { "attribute": "HTTP_URL_FILTER", "negate_option": 0, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000504" ], "condition_index": 0 @@ -3306,7 +3306,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject216", - "object_id": "00000000-0000-0000-0000-000000000221", + "uuid": "00000000-0000-0000-0000-000000000221", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3323,7 +3323,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000217", + "uuid": "00000000-0000-0000-0000-000000000217", "service": 0, "action": 0, "do_blacklist": 0, @@ -3334,7 +3334,7 @@ { "attribute": "HTTP_URL_FILTER", "negate_option": 1, - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000509" ], "condition_index": 0 @@ -3346,7 +3346,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject217_2", - "object_id": "00000000-0000-0000-0000-000000000225", + "uuid": "00000000-0000-0000-0000-000000000225", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3363,7 +3363,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000218", + "uuid": "00000000-0000-0000-0000-000000000218", "service": 1, "action": 1, "do_blacklist": 1, @@ -3376,7 +3376,7 @@ "objects": [ { "object_name": "218_interval_object", - "object_id": "00000000-0000-0000-0000-000000000226", + "uuid": "00000000-0000-0000-0000-000000000226", "items": [ { "table_name": "CONTENT_SIZE", @@ -3392,7 +3392,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000219", + "uuid": "00000000-0000-0000-0000-000000000219", "service": 1, "action": 1, "do_blacklist": 1, @@ -3407,7 +3407,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject219_1", - "object_id": "00000000-0000-0000-0000-000000000227", + "uuid": "00000000-0000-0000-0000-000000000227", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3428,7 +3428,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject219_2", - "object_id": "00000000-0000-0000-0000-000000000228", + "uuid": "00000000-0000-0000-0000-000000000228", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3449,7 +3449,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject219_3", - "object_id": "00000000-0000-0000-0000-000000000229", + "uuid": "00000000-0000-0000-0000-000000000229", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3470,7 +3470,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject219_4", - "object_id": "00000000-0000-0000-0000-000000000230", + "uuid": "00000000-0000-0000-0000-000000000230", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3491,7 +3491,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject219_5", - "object_id": "00000000-0000-0000-0000-000000000231", + "uuid": "00000000-0000-0000-0000-000000000231", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3512,7 +3512,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject219_6", - "object_id": "00000000-0000-0000-0000-000000000232", + "uuid": "00000000-0000-0000-0000-000000000232", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3533,7 +3533,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject219_7", - "object_id": "00000000-0000-0000-0000-000000000233", + "uuid": "00000000-0000-0000-0000-000000000233", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3554,7 +3554,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject219_8", - "object_id": "00000000-0000-0000-0000-000000000234", + "uuid": "00000000-0000-0000-0000-000000000234", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3571,7 +3571,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000220", + "uuid": "00000000-0000-0000-0000-000000000220", "service": 1, "action": 1, "do_blacklist": 1, @@ -3586,7 +3586,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject220_1", - "object_id": "00000000-0000-0000-0000-000000000235", + "uuid": "00000000-0000-0000-0000-000000000235", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3607,7 +3607,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject220_2", - "object_id": "00000000-0000-0000-0000-000000000236", + "uuid": "00000000-0000-0000-0000-000000000236", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3628,7 +3628,7 @@ "objects": [ { "object_name": "NOTConditionAndExcludeObject220_3", - "object_id": "00000000-0000-0000-0000-000000000237", + "uuid": "00000000-0000-0000-0000-000000000237", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3645,7 +3645,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000222", + "uuid": "00000000-0000-0000-0000-000000000222", "service": 0, "action": 0, "do_blacklist": 0, @@ -3660,7 +3660,7 @@ "objects": [ { "object_name": "NOTLogicObject_222", - "object_id": "00000000-0000-0000-0000-000000000240", + "uuid": "00000000-0000-0000-0000-000000000240", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3677,7 +3677,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000223", + "uuid": "00000000-0000-0000-0000-000000000223", "service": 0, "action": 0, "do_blacklist": 0, @@ -3692,7 +3692,7 @@ "objects": [ { "object_name": "NOTLogicObject_223_1", - "object_id": "00000000-0000-0000-0000-000000000241", + "uuid": "00000000-0000-0000-0000-000000000241", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3713,7 +3713,7 @@ "objects": [ { "object_name": "NOTLogicObject_223_2", - "object_id": "00000000-0000-0000-0000-000000000242", + "uuid": "00000000-0000-0000-0000-000000000242", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3734,7 +3734,7 @@ "objects": [ { "object_name": "NOTLogicObject_223_1", - "object_id": "00000000-0000-0000-0000-000000000243", + "uuid": "00000000-0000-0000-0000-000000000243", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3751,7 +3751,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000224", + "uuid": "00000000-0000-0000-0000-000000000224", "service": 0, "action": 0, "do_blacklist": 0, @@ -3766,7 +3766,7 @@ "objects": [ { "object_name": "NOTLogicObject_224_1", - "object_id": "00000000-0000-0000-0000-000000000244", + "uuid": "00000000-0000-0000-0000-000000000244", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3787,7 +3787,7 @@ "objects": [ { "object_name": "NOTLogicObject_224_2", - "object_id": "00000000-0000-0000-0000-000000000245", + "uuid": "00000000-0000-0000-0000-000000000245", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3804,7 +3804,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000225", + "uuid": "00000000-0000-0000-0000-000000000225", "service": 0, "action": 0, "do_blacklist": 0, @@ -3819,7 +3819,7 @@ "objects": [ { "object_name": "EscapeObject_225_1", - "object_id": "00000000-0000-0000-0000-000000000246", + "uuid": "00000000-0000-0000-0000-000000000246", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -3836,7 +3836,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000226", + "uuid": "00000000-0000-0000-0000-000000000226", "service": 1, "action": 1, "do_blacklist": 1, @@ -3847,14 +3847,14 @@ { "attribute": "KEYWORDS_TABLE", "object_name": "226_url_object", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000247" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000227", + "uuid": "00000000-0000-0000-0000-000000000227", "service": 1, "action": 1, "do_blacklist": 1, @@ -3866,14 +3866,14 @@ { "attribute": "KEYWORDS_TABLE", "object_name": "227_url_object", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000248" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000228", + "uuid": "00000000-0000-0000-0000-000000000228", "service": 1, "action": 1, "do_blacklist": 1, @@ -3888,7 +3888,7 @@ "objects": [ { "object_name": "228_url_object", - "object_id": "00000000-0000-0000-0000-000000000249", + "uuid": "00000000-0000-0000-0000-000000000249", "items": [ { "table_name": "HTTP_URL", @@ -3909,7 +3909,7 @@ "objects": [ { "object_name": "228_IP_object", - "object_id": "00000000-0000-0000-0000-000000000250", + "uuid": "00000000-0000-0000-0000-000000000250", "items": [ { "table_name": "IP_CONFIG", @@ -3925,7 +3925,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000229", + "uuid": "00000000-0000-0000-0000-000000000229", "service": 1, "action": 1, "do_blacklist": 1, @@ -3938,7 +3938,7 @@ "objects": [ { "object_name": "229_url_object", - "object_id": "00000000-0000-0000-0000-000000000251", + "uuid": "00000000-0000-0000-0000-000000000251", "items": [ { "table_name": "HTTP_URL", @@ -3955,7 +3955,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000230", + "uuid": "00000000-0000-0000-0000-000000000230", "service": 0, "action": 0, "do_blacklist": 0, @@ -3968,7 +3968,7 @@ "objects": [ { "object_name": "230_IP_object", - "object_id": "00000000-0000-0000-0000-000000000256", + "uuid": "00000000-0000-0000-0000-000000000256", "items": [ { "table_type": "ip", @@ -3985,7 +3985,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000231", + "uuid": "00000000-0000-0000-0000-000000000231", "service": 0, "action": 0, "do_blacklist": 0, @@ -3998,7 +3998,7 @@ "objects": [ { "object_name": "231_IP_object", - "object_id": "00000000-0000-0000-0000-000000000257", + "uuid": "00000000-0000-0000-0000-000000000257", "items": [ { "table_type": "ip", @@ -4015,7 +4015,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000232", + "uuid": "00000000-0000-0000-0000-000000000232", "service": 0, "action": 0, "do_blacklist": 0, @@ -4028,7 +4028,7 @@ "objects": [ { "object_name": "232_IP_object", - "object_id": "00000000-0000-0000-0000-000000000258", + "uuid": "00000000-0000-0000-0000-000000000258", "items": [ { "table_type": "ip", @@ -4045,7 +4045,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000233", + "uuid": "00000000-0000-0000-0000-000000000233", "service": 1, "action": 1, "do_blacklist": 1, @@ -4056,14 +4056,14 @@ { "attribute": "HTTP_RESPONSE_KEYWORDS", "object_name": "233_url_object", - "object_ids": [ + "object_uuids": [ "00000000-0000-0000-0000-000000000259" ] } ] }, { - "rule_id": "00000000-0000-0000-0000-000000000234", + "uuid": "00000000-0000-0000-0000-000000000234", "service": 0, "action": 0, "do_blacklist": 0, @@ -4078,7 +4078,7 @@ "objects": [ { "object_name": "EscapeObject_234_1", - "object_id": "00000000-0000-0000-0000-000000000260", + "uuid": "00000000-0000-0000-0000-000000000260", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -4095,7 +4095,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000235", + "uuid": "00000000-0000-0000-0000-000000000235", "service": 0, "action": 0, "do_blacklist": 0, @@ -4110,7 +4110,7 @@ "objects": [ { "object_name": "EscapeObject_235_1", - "object_id": "00000000-0000-0000-0000-000000000261", + "uuid": "00000000-0000-0000-0000-000000000261", "items": [ { "table_name": "KEYWORDS_TABLE", @@ -4127,7 +4127,7 @@ ] }, { - "rule_id": "00000000-0000-0000-0000-000000000236", + "uuid": "00000000-0000-0000-0000-000000000236", "service": 0, "action": 0, "do_blacklist": 0, @@ -4140,7 +4140,7 @@ "objects": [ { "object_name": "236_keywords_object", - "object_id": "00000000-0000-0000-0000-000000000262", + "uuid": "00000000-0000-0000-0000-000000000262", "items": [ { "table_type": "expr", diff --git a/test/table_info.json b/test/table_info.json index 8180af4..efd2307 100644 --- a/test/table_info.json +++ b/test/table_info.json @@ -44,7 +44,7 @@ "gc_timeout_s":3, "key_type":"integer", "key_len":8, - "key_name": "rule_id" + "key_name": "uuid" } }, { diff --git a/test/test_utils.cpp b/test/test_utils.cpp index 56f46fc..dbe563d 100644 --- a/test/test_utils.cpp +++ b/test/test_utils.cpp @@ -120,17 +120,44 @@ int rule_table_set_line(struct maat *maat_inst, const char *table_name, const char *user_region, struct maat_cmd_condition conditions[], int condition_num, int expire_after) { - char table_line[1024 * 16] = {0}; - sprintf(table_line, "%lld\t0\t0\t0\t0\t0\t%s\t%d\t%d\t0.0", - rule_id, user_region, condition_num, op); + cJSON *json_root = cJSON_CreateObject(); + char uuid_str[UUID_STR_LEN] = {0}; + + uuid_unparse(rule_uuid, uuid_str); + cJSON_AddStringToObject(json_root, "uuid", uuid_str); + cJSON *conditions_array = cJSON_CreateArray(); + + for (int i = 0; i < condition_num; i++) { + cJSON *condition = cJSON_CreateObject(); + cJSON_AddStringToObject(condition, "attribute_name", conditions[i].attribute_name); + if (conditions[i].negate_option) { + cJSON_AddStringToObject(condition, "negate_option", "true"); + } else { + cJSON_AddStringToObject(condition, "negate_option", "false"); + } + + cJSON *object_uuids_array = cJSON_CreateArray(); + for (int j = 0; j < conditions[i].object_num; j++) { + cJSON_AddItemToArray(object_uuids_array, cJSON_CreateString(conditions[i].object_uuids_str[j])); + } + cJSON_AddItemToObject(condition, "object_uuids", object_uuids_array); + cJSON_AddItemToArray(conditions_array, condition); + } + + cJSON_AddItemToObject(json_root, "conditions", conditions_array); + + char *json_str = cJSON_PrintUnformatted(json_root); struct maat_cmd_line line_rule; - line_rule.rule_id = rule_id; - line_rule.table_line = table_line; + line_rule.rule_uuid_str = uuid_str; + line_rule.table_line = json_str; line_rule.table_name = table_name; line_rule.expire_after = expire_after; - return maat_cmd_set_line(maat_inst, &line_rule, op); + int ret = maat_cmd_set_line(maat_inst, &line_rule, op); + free(json_str); + + return ret; } #if 0 //TODO |
