diff options
| author | root <[email protected]> | 2024-08-13 07:29:41 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2024-08-13 07:29:41 +0000 |
| commit | 7dd54ad0eca50b3d1d6df17867a58a40a19462c6 (patch) | |
| tree | 77a35c9c1c6f73a3f98c3665e7a48690abf08476 /src | |
| parent | 71871622dd8e38edf157e27b493ee6b347f69d9e (diff) | |
modify fqdn_plugin table
Diffstat (limited to 'src')
| -rw-r--r-- | src/maat_fqdn_plugin.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/src/maat_fqdn_plugin.c b/src/maat_fqdn_plugin.c index 84a58ab..d4e00a6 100644 --- a/src/maat_fqdn_plugin.c +++ b/src/maat_fqdn_plugin.c @@ -21,7 +21,6 @@ struct fqdn_plugin_schema { int item_id_column; - int suffix_match_method_column; int fqdn_column; int rule_tag_column; int gc_timeout_s; @@ -78,17 +77,6 @@ void *fqdn_plugin_schema_new(cJSON *json, struct table_manager *tbl_mgr, goto error; } - custom_item = cJSON_GetObjectItem(item, "suffix_match_method"); - if (custom_item != NULL && custom_item->type == cJSON_Number) { - schema->suffix_match_method_column = custom_item->valueint; - } else { - log_fatal(logger, MODULE_FQDN_PLUGIN, - "[%s:%d] fqdn_plugin table:<%s> schema has no " - "suffix_match_method column", __FUNCTION__, - __LINE__, table_name); - goto error; - } - // rule_tag is optional custom_item = cJSON_GetObjectItem(item, "fqdn"); if (custom_item != NULL && custom_item->type == cJSON_Number) { @@ -304,25 +292,6 @@ fqdn_plugin_rule_new(const char *line, struct fqdn_plugin_schema *schema, } fqdn_plugin_rule->id = atoi(line + column_offset); - ret = get_column_pos(line, schema->suffix_match_method_column, - &column_offset, &column_len); - if (ret < 0) { - log_fatal(logger, MODULE_FQDN_PLUGIN, - "[%s:%d] fqdn_plugin table:<%s> has no suffix_match_method" - " in line:%s", __FUNCTION__, __LINE__, table_name, line); - goto error; - } - - fqdn_plugin_rule->is_suffix_match = atoi(line + column_offset); - if (fqdn_plugin_rule->is_suffix_match != 0 && - fqdn_plugin_rule->is_suffix_match != 1) { - log_fatal(logger, MODULE_FQDN_PLUGIN, - "[%s:%d] fqdn_plugin table:<%s> suffix_match_method:%d " - "is illegal in line:%s", __FUNCTION__, __LINE__, table_name, - fqdn_plugin_rule->is_suffix_match, line); - goto error; - } - ret = get_column_pos(line, schema->fqdn_column, &column_offset, &column_len); if (ret < 0) { @@ -335,6 +304,12 @@ fqdn_plugin_rule_new(const char *line, struct fqdn_plugin_schema *schema, fqdn = line + column_offset; fqdn_len = column_len; + if (fqdn[0] == '*') { + fqdn_plugin_rule->is_suffix_match = 1; + fqdn++; + fqdn_len--; + } + if (fqdn[0] == '.') { fqdn++; fqdn_len--; |
