diff options
author | Andrejs Kozlovs <andrejs.kozlovs@zabbix.com> | 2021-09-03 07:34:02 +0300 |
---|---|---|
committer | Andrejs Kozlovs <andrejs.kozlovs@zabbix.com> | 2021-09-03 07:34:02 +0300 |
commit | 4ccef4d58697f89b3efa63650dec2ee520433741 (patch) | |
tree | c3992b2bcd04e111c40911c684d246f0adc84aa4 /src/libs/zbxaudit/audit_item.c | |
parent | 27c73b7294100dca3a9bbfa5b0a78c479a8a9b8e (diff) | |
parent | 938e33874fd0c3ea4d496306561d77f7f2ddbef1 (diff) |
........S. [ZBXNEXT-6830] Update from branch 'feature/ZBXNEXT-6817-5.5' of https://git.zabbix.com/scm/zbx/zabbix into feature/ZBXNEXT-6830-5.5-test
Diffstat (limited to 'src/libs/zbxaudit/audit_item.c')
-rw-r--r-- | src/libs/zbxaudit/audit_item.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/libs/zbxaudit/audit_item.c b/src/libs/zbxaudit/audit_item.c index a0134fa0d85..910e02f670d 100644 --- a/src/libs/zbxaudit/audit_item.c +++ b/src/libs/zbxaudit/audit_item.c @@ -44,35 +44,35 @@ static int item_flag_to_resource_type(int flag) } } -#define PREPARE_AUDIT_ITEM_CREATE(resource, audit_resource_flag) \ -void zbx_audit_##resource##_create_entry(int audit_action, zbx_uint64_t itemid, const char *name) \ -{ \ - zbx_audit_entry_t local_audit_item_entry, **found_audit_item_entry; \ - zbx_audit_entry_t *local_audit_item_entry_x = &local_audit_item_entry; \ - \ - RETURN_IF_AUDIT_OFF(); \ - \ - local_audit_item_entry.id = itemid; \ - \ - found_audit_item_entry = (zbx_audit_entry_t**)zbx_hashset_search(zbx_get_audit_hashset(), \ - &(local_audit_item_entry_x)); \ - if (NULL == found_audit_item_entry) \ - { \ - zbx_audit_entry_t *local_audit_item_entry_insert; \ - \ - local_audit_item_entry_insert = (zbx_audit_entry_t*)zbx_malloc(NULL, sizeof(zbx_audit_entry_t));\ - local_audit_item_entry_insert->id = itemid; \ - local_audit_item_entry_insert->name = zbx_strdup(NULL, name); \ - local_audit_item_entry_insert->audit_action = audit_action; \ - local_audit_item_entry_insert->resource_type = audit_resource_flag; \ - zbx_json_init(&(local_audit_item_entry_insert->details_json), ZBX_JSON_STAT_BUF_LEN); \ - zbx_hashset_insert(zbx_get_audit_hashset(), &local_audit_item_entry_insert, \ - sizeof(local_audit_item_entry_insert)); \ - } \ -} \ +void zbx_audit_item_create_entry(int audit_action, zbx_uint64_t itemid, const char *name, int flags) +{ + int resource_type; + + zbx_audit_entry_t local_audit_item_entry, **found_audit_item_entry; + zbx_audit_entry_t *local_audit_item_entry_x = &local_audit_item_entry; + + RETURN_IF_AUDIT_OFF(); + + resource_type = item_flag_to_resource_type(flags); -PREPARE_AUDIT_ITEM_CREATE(item, AUDIT_RESOURCE_ITEM) -#undef PREPARE_AUDIT_ITEM_CREATE + local_audit_item_entry.id = itemid; + + found_audit_item_entry = (zbx_audit_entry_t**)zbx_hashset_search(zbx_get_audit_hashset(), + &(local_audit_item_entry_x)); + if (NULL == found_audit_item_entry) + { + zbx_audit_entry_t *local_audit_item_entry_insert; + + local_audit_item_entry_insert = (zbx_audit_entry_t*)zbx_malloc(NULL, sizeof(zbx_audit_entry_t)); + local_audit_item_entry_insert->id = itemid; + local_audit_item_entry_insert->name = zbx_strdup(NULL, name); + local_audit_item_entry_insert->audit_action = audit_action; + local_audit_item_entry_insert->resource_type = resource_type; + zbx_json_init(&(local_audit_item_entry_insert->details_json), ZBX_JSON_STAT_BUF_LEN); + zbx_hashset_insert(zbx_get_audit_hashset(), &local_audit_item_entry_insert, + sizeof(local_audit_item_entry_insert)); + } +} #define ONLY_ITEM (AUDIT_RESOURCE_ITEM == resource_type) #define ONLY_ITEM_PROTOTYPE (AUDIT_RESOURCE_ITEM_PROTOTYPE == resource_type) @@ -137,7 +137,7 @@ void zbx_audit_item_update_json_add_data(zbx_uint64_t itemid, const zbx_template if ONLY_LLD_RULE { - zbx_audit_update_json_append_string(itemid, AUDIT_DETAILS_ACTION_ADD, "discoveryryle.lifetime", + zbx_audit_update_json_append_string(itemid, AUDIT_DETAILS_ACTION_ADD, "discoveryrule.lifetime", item->lifetime); } |