diff options
author | Andrejs Kozlovs <andrejs.kozlovs@zabbix.com> | 2021-10-08 15:21:40 +0300 |
---|---|---|
committer | Andrejs Kozlovs <andrejs.kozlovs@zabbix.com> | 2021-10-08 15:21:40 +0300 |
commit | 2bff1fbb66b2fa026d159990c1a47d9837689988 (patch) | |
tree | 6c6d7e6241b0a6dee2019ff40c135c6c75dbc976 /src/libs/zbxaudit | |
parent | d72c46ef24e02af81ae8c312decd3b4b0810e11a (diff) |
........S. [ZBX-20006] revert fixed merge issue, float and password processing
This reverts commit d72c46ef24e02af81ae8c312decd3b4b0810e11a.
Diffstat (limited to 'src/libs/zbxaudit')
-rw-r--r-- | src/libs/zbxaudit/audit.c | 31 | ||||
-rw-r--r-- | src/libs/zbxaudit/audit.h | 2 | ||||
-rw-r--r-- | src/libs/zbxaudit/audit_host.c | 4 | ||||
-rw-r--r-- | src/libs/zbxaudit/audit_httptest.c | 13 | ||||
-rw-r--r-- | src/libs/zbxaudit/audit_httptest.h | 5 | ||||
-rw-r--r-- | src/libs/zbxaudit/audit_item.c | 14 |
6 files changed, 19 insertions, 50 deletions
diff --git a/src/libs/zbxaudit/audit.c b/src/libs/zbxaudit/audit.c index 920574e5263..2c8a2a6353c 100644 --- a/src/libs/zbxaudit/audit.c +++ b/src/libs/zbxaudit/audit.c @@ -311,16 +311,11 @@ static int audit_field_default(const char *table_name, const char *field_name, c if (NULL != table_name && NULL != (table = DBget_table(table_name)) && NULL != (field = DBget_field(table, field_name))) { - if (NULL != value && NULL != field->default_value && (0 == strcmp(value, field->default_value) || - (ZBX_TYPE_FLOAT == field->type && SUCCEED == zbx_double_compare(atof(value), - atof(field->default_value))))) - { + + if (NULL != value && NULL != field->default_value && 0 == strcmp(value, field->default_value)) ret = SUCCEED; - } else if ((NULL == value || (ZBX_TYPE_ID == field->type && 0 == id)) && NULL == field->default_value) - { ret = SUCCEED; - } } return ret; @@ -348,28 +343,6 @@ void zbx_audit_update_json_append_string(const zbx_uint64_t id, const char *audi append_str_json(&((*found_audit_entry)->details_json), audit_op, key, value); } -void zbx_audit_update_json_append_string_secret(const zbx_uint64_t id, const char *audit_op, const char *key, - const char *value, const char *table, const char *field) -{ - zbx_audit_entry_t local_audit_entry, **found_audit_entry; - zbx_audit_entry_t *local_audit_entry_x = &local_audit_entry; - - if (SUCCEED == audit_field_default(table, field, value, 0)) - return; - - local_audit_entry.id = id; - - found_audit_entry = (zbx_audit_entry_t**)zbx_hashset_search(&zbx_audit, &(local_audit_entry_x)); - - if (NULL == found_audit_entry) - { - THIS_SHOULD_NEVER_HAPPEN; - exit(EXIT_FAILURE); - } - - append_str_json(&((*found_audit_entry)->details_json), audit_op, key, ZBX_MACRO_SECRET_MASK); -} - void zbx_audit_update_json_append_uint64(const zbx_uint64_t id, const char *audit_op, const char *key, uint64_t value, const char *table, const char *field) { diff --git a/src/libs/zbxaudit/audit.h b/src/libs/zbxaudit/audit.h index 93b128f6643..099e6e361b6 100644 --- a/src/libs/zbxaudit/audit.h +++ b/src/libs/zbxaudit/audit.h @@ -77,8 +77,6 @@ void zbx_audit_init(int audit_mode_set); void zbx_audit_flush(void); void zbx_audit_update_json_append_string(const zbx_uint64_t id, const char *audit_op, const char *key, const char *value, const char *table, const char *field); -void zbx_audit_update_json_append_string_secret(const zbx_uint64_t id, const char *audit_op, const char *key, - const char *value, const char *table, const char *field); void zbx_audit_update_json_append_uint64(const zbx_uint64_t id, const char *audit_op, const char *key, uint64_t value, const char *table, const char *field); void zbx_audit_update_json_append_no_value(const zbx_uint64_t id, const char *audit_op, const char *key); diff --git a/src/libs/zbxaudit/audit_host.c b/src/libs/zbxaudit/audit_host.c index c498f369b4d..1fd331969f1 100644 --- a/src/libs/zbxaudit/audit_host.c +++ b/src/libs/zbxaudit/audit_host.c @@ -139,9 +139,9 @@ void zbx_audit_host_update_json_add_tls_and_psk(zbx_uint64_t hostid, int tls_con AUDIT_TABLE_NAME, "tls_connect"); zbx_audit_update_json_append_int(hostid, AUDIT_DETAILS_ACTION_ADD, "host.tls_accept", tls_accept, AUDIT_TABLE_NAME, "tls_accept"); - zbx_audit_update_json_append_string(hostid, AUDIT_DETAILS_ACTION_ADD, "host.tls_psk_identity", tls_psk_identity, + zbx_audit_update_json_append_string(hostid, AUDIT_DETAILS_ACTION_ADD, "host.psk_identity", tls_psk_identity, AUDIT_TABLE_NAME, "tls_psk_identity"); - zbx_audit_update_json_append_string(hostid, AUDIT_DETAILS_ACTION_ADD, "host.tls_psk", tls_psk, AUDIT_TABLE_NAME, + zbx_audit_update_json_append_string(hostid, AUDIT_DETAILS_ACTION_ADD, "host.psk", tls_psk, AUDIT_TABLE_NAME, "tls_psk"); #undef AUDIT_TABLE_NAME } diff --git a/src/libs/zbxaudit/audit_httptest.c b/src/libs/zbxaudit/audit_httptest.c index 82c109775d6..f1fa18c0f61 100644 --- a/src/libs/zbxaudit/audit_httptest.c +++ b/src/libs/zbxaudit/audit_httptest.c @@ -54,9 +54,8 @@ void zbx_audit_httptest_create_entry(int audit_action, zbx_uint64_t httptestid, void zbx_audit_httptest_update_json_add_data(zbx_uint64_t httptestid, zbx_uint64_t templateid, const char *name, const char *delay, unsigned char status, const char *agent, unsigned char authentication, - const char *httpuser, const char *httppassword, const char *http_proxy, int retries, - const char *ssl_cert_file, const char *ssl_key_file, const char *ssl_key_password, int verify_peer, - int verify_host, zbx_uint64_t hostid) + const char *httpuser, const char *http_proxy, int retries, const char *ssl_cert_file, + const char *ssl_key_file, int verify_peer, int verify_host, zbx_uint64_t hostid) { char audit_key_templateid[AUDIT_DETAILS_KEY_LEN], audit_key_name[AUDIT_DETAILS_KEY_LEN], audit_key_delay[AUDIT_DETAILS_KEY_LEN], audit_key_status[AUDIT_DETAILS_KEY_LEN], @@ -99,14 +98,14 @@ void zbx_audit_httptest_update_json_add_data(zbx_uint64_t httptestid, zbx_uint64 ADD_STR(agent, AUDIT_TABLE_NAME, "agent") ADD_INT(authentication, AUDIT_TABLE_NAME, "authentication") ADD_STR(httpuser, AUDIT_TABLE_NAME, "http_user") - zbx_audit_update_json_append_string_secret(httptestid, AUDIT_DETAILS_ACTION_ADD, "httptest.httppassword", - httppassword, AUDIT_TABLE_NAME, "http_password"); + zbx_audit_update_json_append_string(httptestid, AUDIT_DETAILS_ACTION_ADD, "httptest.httppassword", + ZBX_MACRO_SECRET_MASK, AUDIT_TABLE_NAME, "http_password"); ADD_STR(http_proxy, AUDIT_TABLE_NAME, "http_proxy") ADD_INT(retries, AUDIT_TABLE_NAME, "retries") ADD_STR(ssl_cert_file, AUDIT_TABLE_NAME, "ssl_cert_file") ADD_STR(ssl_key_file, AUDIT_TABLE_NAME, "ssl_key_file") - zbx_audit_update_json_append_string_secret(httptestid, AUDIT_DETAILS_ACTION_ADD, "httptest.ssl_key_password", - ssl_key_password, AUDIT_TABLE_NAME, "ssl_key_password"); + zbx_audit_update_json_append_string(httptestid, AUDIT_DETAILS_ACTION_ADD, "httptest.ssl_key_password", + ZBX_MACRO_SECRET_MASK, AUDIT_TABLE_NAME, "ssl_key_password"); ADD_INT(verify_peer, AUDIT_TABLE_NAME, "verify_peer") ADD_INT(verify_host, AUDIT_TABLE_NAME, "verify_host") ADD_UINT64(hostid, AUDIT_TABLE_NAME, "hostid") diff --git a/src/libs/zbxaudit/audit_httptest.h b/src/libs/zbxaudit/audit_httptest.h index 2850da900cd..79de31a6073 100644 --- a/src/libs/zbxaudit/audit_httptest.h +++ b/src/libs/zbxaudit/audit_httptest.h @@ -29,9 +29,8 @@ void zbx_audit_httptest_create_entry(int audit_action, zbx_uint64_t httptestid, void zbx_audit_httptest_update_json_add_data(zbx_uint64_t httptestid, zbx_uint64_t templateid, const char *name, const char *delay, unsigned char status, const char *agent, unsigned char authentication, - const char *httpuser, const char *httppassword, const char *http_proxy, int retries, - const char *ssl_cert_file, const char *ssl_key_file, const char *ssl_key_password, int verify_peer, - int verify_host, zbx_uint64_t hostid); + const char *httpuser, const char *http_proxy, int retries, const char *ssl_cert_file, + const char *ssl_key_file, int verify_peer, int verify_host, zbx_uint64_t hostid); #define PREPARE_AUDIT_HTTPTEST_UPDATE_H(resource, type1) \ void zbx_audit_httptest_update_json_update_##resource(zbx_uint64_t httptestid, type1 resource##_old, \ diff --git a/src/libs/zbxaudit/audit_item.c b/src/libs/zbxaudit/audit_item.c index 72e1f51652f..11e55740a02 100644 --- a/src/libs/zbxaudit/audit_item.c +++ b/src/libs/zbxaudit/audit_item.c @@ -153,8 +153,8 @@ void zbx_audit_item_update_json_add_data(zbx_uint64_t itemid, const zbx_template ADD_JSON_UI(output_format, AUDIT_TABLE_NAME, "output_format"); ADD_JSON_S(params, AUDIT_TABLE_NAME, "params"); - zbx_audit_update_json_append_string_secret(itemid, AUDIT_DETAILS_ACTION_ADD, IT_OR_ITP_OR_DR(password), - item->password, AUDIT_TABLE_NAME, "password"); + zbx_audit_update_json_append_string(itemid, AUDIT_DETAILS_ACTION_ADD, IT_OR_ITP_OR_DR(password), + ZBX_MACRO_SECRET_MASK, AUDIT_TABLE_NAME, "password"); ADD_JSON_UI(post_type, AUDIT_TABLE_NAME, "post_type"); ADD_JSON_S(posts, AUDIT_TABLE_NAME, "posts"); @@ -167,8 +167,8 @@ void zbx_audit_item_update_json_add_data(zbx_uint64_t itemid, const zbx_template ADD_JSON_S(ssl_cert_file, AUDIT_TABLE_NAME, "ssl_cert_file"); ADD_JSON_S(ssl_key_file, AUDIT_TABLE_NAME, "ssl_key_file"); - zbx_audit_update_json_append_string_secret(itemid, AUDIT_DETAILS_ACTION_ADD, IT_OR_ITP_OR_DR(ssl_key_password), - item->ssl_key_password, AUDIT_TABLE_NAME, "ssl_key_password"); + zbx_audit_update_json_append_string(itemid, AUDIT_DETAILS_ACTION_ADD, IT_OR_ITP_OR_DR(ssl_key_password), + ZBX_MACRO_SECRET_MASK, AUDIT_TABLE_NAME, "ssl_key_password"); ADD_JSON_UI(status, AUDIT_TABLE_NAME, "status"); ADD_JSON_S(status_codes, AUDIT_TABLE_NAME, "status_codes"); @@ -248,7 +248,7 @@ void zbx_audit_item_update_json_add_lld_data(zbx_uint64_t itemid, const zbx_lld_ ADD_JSON_S(snmp_oid, AUDIT_TABLE_NAME, "snmp_oid"); ADD_JSON_P_UI(authtype, AUDIT_TABLE_NAME, "authtype"); ADD_JSON_S(username, AUDIT_TABLE_NAME, "username"); - zbx_audit_update_json_append_string_secret(itemid, AUDIT_DETAILS_ACTION_ADD, IT(password), item->password, AUDIT_TABLE_NAME, "password"); + zbx_audit_update_json_append_string(itemid, AUDIT_DETAILS_ACTION_ADD, IT(password), ZBX_MACRO_SECRET_MASK, AUDIT_TABLE_NAME, "password"); ADD_JSON_P_S(publickey, AUDIT_TABLE_NAME, "publickey"); ADD_JSON_P_S(privatekey, AUDIT_TABLE_NAME, "privatekey"); ADD_JSON_S(description, AUDIT_TABLE_NAME, "description"); @@ -270,8 +270,8 @@ void zbx_audit_item_update_json_add_lld_data(zbx_uint64_t itemid, const zbx_lld_ ADD_JSON_P_UI(output_format, AUDIT_TABLE_NAME, "output_format"); ADD_JSON_S(ssl_cert_file, AUDIT_TABLE_NAME, "ssl_cert_file"); ADD_JSON_S(ssl_key_file, AUDIT_TABLE_NAME, "ssl_key_file"); - zbx_audit_update_json_append_string_secret(itemid, AUDIT_DETAILS_ACTION_ADD, IT(ssl_key_password), - item->ssl_key_password, AUDIT_TABLE_NAME, "ssl_key_password"); + zbx_audit_update_json_append_string(itemid, AUDIT_DETAILS_ACTION_ADD, IT(ssl_key_password), + ZBX_MACRO_SECRET_MASK, AUDIT_TABLE_NAME, "ssl_key_password"); ADD_JSON_P_UI(verify_peer, AUDIT_TABLE_NAME, "verify_peer"); ADD_JSON_P_UI(verify_host, AUDIT_TABLE_NAME, "verify_host"); ADD_JSON_P_UI(allow_traps, AUDIT_TABLE_NAME, "allow_traps"); |