diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2021-03-12 13:02:40 +0300 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2021-03-12 13:02:40 +0300 |
commit | 65a6c53b003bef831288145a59dd75c07dbf0dbd (patch) | |
tree | 97e2375ec574c25d2070dac74b3a22f15a56254e /include | |
parent | 5ef309d8a24243f6f03fc64f63d61aa5ef6e4661 (diff) | |
parent | 671768fb49c5198a6cf174c41f0243d4574610fc (diff) |
.......... [ZBXNEXT-6451] merged branch 'master' of ssh://git.zabbix.lan:7999/zbx/zabbix into feature/ZBXNEXT-6451-5.3
Diffstat (limited to 'include')
-rw-r--r-- | include/common.h | 27 | ||||
-rw-r--r-- | include/db.h | 7 | ||||
-rw-r--r-- | include/dbcache.h | 3 | ||||
-rw-r--r-- | include/export.h | 9 | ||||
-rw-r--r-- | include/module.h | 2 | ||||
-rw-r--r-- | include/proxy.h | 4 | ||||
-rw-r--r-- | include/sha256crypt.h | 27 | ||||
-rw-r--r-- | include/sha512crypt.h | 25 | ||||
-rw-r--r-- | include/sysinfo.h | 1 | ||||
-rw-r--r-- | include/version.h | 4 | ||||
-rw-r--r-- | include/zbxalgo.h | 43 | ||||
-rw-r--r-- | include/zbxdb.h | 2 | ||||
-rw-r--r-- | include/zbxembed.h | 6 | ||||
-rw-r--r-- | include/zbxjson.h | 4 | ||||
-rw-r--r-- | include/zbxserver.h | 1 |
15 files changed, 152 insertions, 13 deletions
diff --git a/include/common.h b/include/common.h index f62e2b47002..89b92cd6331 100644 --- a/include/common.h +++ b/include/common.h @@ -324,11 +324,19 @@ const char *zbx_dservice_type_string(zbx_dservice_type_t service); /* item snmpv3 authentication protocol */ #define ITEM_SNMPV3_AUTHPROTOCOL_MD5 0 -#define ITEM_SNMPV3_AUTHPROTOCOL_SHA 1 +#define ITEM_SNMPV3_AUTHPROTOCOL_SHA1 1 +#define ITEM_SNMPV3_AUTHPROTOCOL_SHA224 2 +#define ITEM_SNMPV3_AUTHPROTOCOL_SHA256 3 +#define ITEM_SNMPV3_AUTHPROTOCOL_SHA384 4 +#define ITEM_SNMPV3_AUTHPROTOCOL_SHA512 5 /* item snmpv3 privacy protocol */ #define ITEM_SNMPV3_PRIVPROTOCOL_DES 0 -#define ITEM_SNMPV3_PRIVPROTOCOL_AES 1 +#define ITEM_SNMPV3_PRIVPROTOCOL_AES128 1 +#define ITEM_SNMPV3_PRIVPROTOCOL_AES192 2 +#define ITEM_SNMPV3_PRIVPROTOCOL_AES256 3 +#define ITEM_SNMPV3_PRIVPROTOCOL_AES192C 4 +#define ITEM_SNMPV3_PRIVPROTOCOL_AES256C 5 /* condition evaluation types */ #define CONDITION_EVAL_TYPE_AND_OR 0 @@ -839,6 +847,7 @@ typedef struct char *command_orig; zbx_uint64_t scriptid; unsigned char host_access; + int timeout; } zbx_script_t; @@ -847,6 +856,7 @@ zbx_script_t; #define ZBX_SCRIPT_TYPE_SSH 2 #define ZBX_SCRIPT_TYPE_TELNET 3 #define ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT 4 +#define ZBX_SCRIPT_TYPE_WEBHOOK 5 #define ZBX_SCRIPT_EXECUTE_ON_AGENT 0 #define ZBX_SCRIPT_EXECUTE_ON_SERVER 1 @@ -909,7 +919,8 @@ while (0) \ do \ { \ - zbx_error("ERROR [file:%s,line:%d] Something impossible has just happened.", __FILE__, __LINE__); \ + zbx_error("ERROR [file and function: <%s,%s>, revision:%s] Something impossible has just happened.", \ + __FILE__, __func__, ZABBIX_REVISION); \ zbx_backtrace(); \ } \ while (0) @@ -1378,8 +1389,14 @@ int zbx_user_macro_parse_dyn(const char *macro, char **name, char **context, int char *zbx_user_macro_unquote_context_dyn(const char *context, int len); char *zbx_user_macro_quote_context_dyn(const char *context, int force_quote); -#define ZBX_SESSION_ACTIVE 0 -#define ZBX_SESSION_PASSIVE 1 +#define ZBX_SESSION_ACTIVE 0 +#define ZBX_SESSION_PASSIVE 1 +#define ZBX_AUTH_TOKEN_ENABLED 0 +#define ZBX_AUTH_TOKEN_DISABLED 1 +#define ZBX_AUTH_TOKEN_NEVER_EXPIRES 0 + +#define ZBX_SID_SESSION_LENGTH 32 +#define ZBX_SID_AUTH_TOKEN_LENGTH 64 char *zbx_dyn_escape_shell_single_quote(const char *arg); diff --git a/include/db.h b/include/db.h index f9d469b3826..c23bcd50588 100644 --- a/include/db.h +++ b/include/db.h @@ -514,6 +514,10 @@ zbx_uint64_t DBget_maxid_num(const char *tablename, int num); void DBcheck_capabilities(void); +#ifdef HAVE_POSTGRESQL +char *zbx_db_get_schema_esc(void); +#endif + /****************************************************************************** * * * Type: ZBX_GRAPH_ITEMS * @@ -610,7 +614,7 @@ int zbx_check_user_permissions(const zbx_uint64_t *userid, const zbx_uint64_t *r const char *zbx_host_string(zbx_uint64_t hostid); const char *zbx_host_key_string(zbx_uint64_t itemid); const char *zbx_user_string(zbx_uint64_t userid); -int DBget_user_names(zbx_uint64_t userid, char **alias, char **name, char **surname); +int DBget_user_names(zbx_uint64_t userid, char **username, char **name, char **surname); void DBregister_host(zbx_uint64_t proxy_hostid, const char *host, const char *ip, const char *dns, unsigned short port, unsigned int connection_type, const char *host_metadata, unsigned short flag, @@ -749,6 +753,7 @@ ZBX_PTR_VECTOR_DECL(availability_ptr, zbx_interface_availability_t *); void zbx_db_update_interface_availabilities(const zbx_vector_availability_ptr_t *interface_availabilities); int DBget_user_by_active_session(const char *sessionid, zbx_user_t *user); +int DBget_user_by_auth_token(const char *formatted_auth_token_hash, zbx_user_t *user); typedef struct { diff --git a/include/dbcache.h b/include/dbcache.h index b67930b2487..41bba8facc9 100644 --- a/include/dbcache.h +++ b/include/dbcache.h @@ -351,7 +351,6 @@ typedef struct { char *extension; unsigned char history_compression_status; - unsigned char history_compression_availability; int history_compress_older; } zbx_config_db_t; @@ -1008,6 +1007,8 @@ void zbx_db_trigger_queue_unlock(void); void zbx_get_host_interfaces_availability(zbx_uint64_t hostid, zbx_agent_availability_t *agents); +int zbx_hc_check_proxy(zbx_uint64_t proxyid); + void zbx_dc_eval_expand_user_macros(zbx_eval_context_t *ctx); #endif diff --git a/include/export.h b/include/export.h index 94c7d66f1e5..06783d8dd64 100644 --- a/include/export.h +++ b/include/export.h @@ -20,7 +20,12 @@ #ifndef ZABBIX_EXPORT_H #define ZABBIX_EXPORT_H -int zbx_is_export_enabled(void); +#define ZBX_FLAG_EXPTYPE_EVENTS 1 +#define ZBX_FLAG_EXPTYPE_HISTORY 2 +#define ZBX_FLAG_EXPTYPE_TRENDS 4 + +int zbx_validate_export_type(char *export_type, uint32_t *export_mask); +int zbx_is_export_enabled(uint32_t flags); int zbx_export_init(char **error); void zbx_problems_export_init(const char *process_name, int process_num); @@ -30,6 +35,8 @@ void zbx_problems_export_flush(void); void zbx_history_export_init(const char *process_name, int process_num); void zbx_history_export_write(const char *buf, size_t count); void zbx_history_export_flush(void); + +void zbx_trends_export_init(const char *process_name, int process_num); void zbx_trends_export_write(const char *buf, size_t count); void zbx_trends_export_flush(void); diff --git a/include/module.h b/include/module.h index 816e04a7971..b504f20593b 100644 --- a/include/module.h +++ b/include/module.h @@ -96,7 +96,7 @@ typedef struct char *text; char *msg; /* possible error message */ zbx_log_t *log; - int type; /* flags: see AR_* above */ + int type; /* flags: see AR_* above */ int mtime; /* meta information */ } AGENT_RESULT; diff --git a/include/proxy.h b/include/proxy.h index 2d045c2aa75..246e47c6f0c 100644 --- a/include/proxy.h +++ b/include/proxy.h @@ -33,6 +33,10 @@ #define ZBX_PROXY_DATA_DONE 0 #define ZBX_PROXY_DATA_MORE 1 +#define ZBX_PROXY_UPLOAD_UNDEFINED 0 +#define ZBX_PROXY_UPLOAD_DISABLED 1 +#define ZBX_PROXY_UPLOAD_ENABLED 2 + int get_active_proxy_from_request(struct zbx_json_parse *jp, DC_PROXY *proxy, char **error); int zbx_proxy_check_permissions(const DC_PROXY *proxy, const zbx_socket_t *sock, char **error); int check_access_passive_proxy(zbx_socket_t *sock, int send_response, const char *req); diff --git a/include/sha256crypt.h b/include/sha256crypt.h new file mode 100644 index 00000000000..7a1842912e2 --- /dev/null +++ b/include/sha256crypt.h @@ -0,0 +1,27 @@ +/* +** Zabbix +** Copyright (C) 2001-2021 Zabbix SIA +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +**/ + +#ifndef ZABBIX_SHA256CRYPT_H +#define ZABBIX_SHA256CRYPT_H + +#define ZBX_SHA256_DIGEST_SIZE 32 + +void zbx_sha256_hash(const char *in, char *out); + +#endif /* ZABBIX_SHA256CRYPT_H */ diff --git a/include/sha512crypt.h b/include/sha512crypt.h new file mode 100644 index 00000000000..3a72f80f633 --- /dev/null +++ b/include/sha512crypt.h @@ -0,0 +1,25 @@ +/* +** Zabbix +** Copyright (C) 2001-2020 Zabbix SIA +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +**/ + +#ifndef ZABBIX_SHA512CRYPT_H +#define ZABBIX_SHA512CRYPT_H + +void zbx_sha512_hash(const char *in, char *out); + +#endif diff --git a/include/sysinfo.h b/include/sysinfo.h index d3a872a057b..00e100bcf3c 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -104,6 +104,7 @@ do \ } \ while (0) +/* AR_META is always excluded */ #define UNSET_RESULT_EXCLUDING(res, exc_type) \ \ do \ diff --git a/include/version.h b/include/version.h index 377cbaa4eff..c15eaf7e34a 100644 --- a/include/version.h +++ b/include/version.h @@ -24,7 +24,7 @@ #define ZBX_STR(str) ZBX_STR2(str) #define APPLICATION_NAME "Zabbix Agent" -#define ZABBIX_REVDATE "26 October 2020" +#define ZABBIX_REVDATE "1 March 2021" #define ZABBIX_VERSION_MAJOR 5 #define ZABBIX_VERSION_MINOR 4 #define ZABBIX_VERSION_PATCH 0 @@ -36,7 +36,7 @@ # define ZABBIX_VERSION_RC_NUM {ZABBIX_RC_NUM} # endif #endif -#define ZABBIX_VERSION_RC "alpha1" +#define ZABBIX_VERSION_RC "beta2" #define ZABBIX_VERSION ZBX_STR(ZABBIX_VERSION_MAJOR) "." ZBX_STR(ZABBIX_VERSION_MINOR) "." \ ZBX_STR(ZABBIX_VERSION_PATCH) ZABBIX_VERSION_RC #define ZABBIX_REVISION ZBX_STR(ZABBIX_VERSION_REVISION) diff --git a/include/zbxalgo.h b/include/zbxalgo.h index 30d28d18e9f..3068a8b8003 100644 --- a/include/zbxalgo.h +++ b/include/zbxalgo.h @@ -414,6 +414,49 @@ void zbx_queue_ptr_push(zbx_queue_ptr_t *queue, void *value); void *zbx_queue_ptr_pop(zbx_queue_ptr_t *queue); void zbx_queue_ptr_remove_value(zbx_queue_ptr_t *queue, const void *value); +/* list item data */ +typedef struct list_item +{ + struct list_item *next; + void *data; +} +zbx_list_item_t; + +/* list data */ +typedef struct +{ + zbx_list_item_t *head; + zbx_list_item_t *tail; + zbx_mem_malloc_func_t mem_malloc_func; + zbx_mem_realloc_func_t mem_realloc_func; + zbx_mem_free_func_t mem_free_func; +} +zbx_list_t; + +/* queue item data */ +typedef struct +{ + zbx_list_t *list; + zbx_list_item_t *current; + zbx_list_item_t *next; +} +zbx_list_iterator_t; + +void zbx_list_create(zbx_list_t *queue); +void zbx_list_create_ext(zbx_list_t *queue, zbx_mem_malloc_func_t mem_malloc_func, zbx_mem_free_func_t mem_free_func); +void zbx_list_destroy(zbx_list_t *list); +void zbx_list_append(zbx_list_t *list, void *value, zbx_list_item_t **inserted); +void zbx_list_insert_after(zbx_list_t *list, zbx_list_item_t *after, void *value, zbx_list_item_t **inserted); +void zbx_list_prepend(zbx_list_t *list, void *value, zbx_list_item_t **inserted); +int zbx_list_pop(zbx_list_t *list, void **value); +int zbx_list_peek(const zbx_list_t *list, void **value); +void zbx_list_iterator_init(zbx_list_t *list, zbx_list_iterator_t *iterator); +int zbx_list_iterator_next(zbx_list_iterator_t *iterator); +int zbx_list_iterator_peek(const zbx_list_iterator_t *iterator, void **value); +void zbx_list_iterator_clear(zbx_list_iterator_t *iterator); +int zbx_list_iterator_equal(const zbx_list_iterator_t *iterator1, const zbx_list_iterator_t *iterator2); +int zbx_list_iterator_isset(const zbx_list_iterator_t *iterator); +void zbx_list_iterator_update(zbx_list_iterator_t *iterator); #endif diff --git a/include/zbxdb.h b/include/zbxdb.h index 29cfb570cd4..1631ee022d7 100644 --- a/include/zbxdb.h +++ b/include/zbxdb.h @@ -98,6 +98,8 @@ const char *zbx_db_last_strerr(void); #ifdef HAVE_POSTGRESQL int zbx_dbms_get_version(void); +int zbx_tsdb_get_version(void); +#define ZBX_DB_TSDB_V1 (20000 > zbx_tsdb_get_version()) #endif #ifdef HAVE_ORACLE diff --git a/include/zbxembed.h b/include/zbxembed.h index b9889a7e4ff..c4964cae36a 100644 --- a/include/zbxembed.h +++ b/include/zbxembed.h @@ -37,11 +37,13 @@ int zbx_es_destroy_env(zbx_es_t *es, char **error); int zbx_es_is_env_initialized(zbx_es_t *es); int zbx_es_fatal_error(zbx_es_t *es); int zbx_es_compile(zbx_es_t *es, const char *script, char **code, int *size, char **error); -int zbx_es_execute(zbx_es_t *es, const char *script, const char *code, int size, const char *param, char **output, - char **error); +int zbx_es_execute(zbx_es_t *es, const char *script, const char *code, int size, const char *param, + char **script_ret, char **error); void zbx_es_set_timeout(zbx_es_t *es, int timeout); void zbx_es_debug_enable(zbx_es_t *es); void zbx_es_debug_disable(zbx_es_t *es); const char *zbx_es_debug_info(const zbx_es_t *es); +int zbx_es_execute_command(const char *command, const char *param, int timeout, char **result, + char *error, size_t max_error_len, char **debug); #endif /* ZABBIX_ZBXEMBED_H */ diff --git a/include/zbxjson.h b/include/zbxjson.h index 9e4284390cb..cb570c47eed 100644 --- a/include/zbxjson.h +++ b/include/zbxjson.h @@ -166,6 +166,7 @@ #define ZBX_PROTO_TAG_EXPRESSIONS "expressions" #define ZBX_PROTO_TAG_EXPRESSION "expression" #define ZBX_PROTO_TAG_CLIENTIP "clientip" +#define ZBX_PROTO_TAG_PROXY_UPLOAD "upload" #define ZBX_PROTO_VALUE_FAILED "failed" #define ZBX_PROTO_VALUE_SUCCESS "success" @@ -198,6 +199,9 @@ #define ZBX_PROTO_VALUE_PREPROCESSING_TEST "preprocessing.test" #define ZBX_PROTO_VALUE_EXPRESSIONS_EVALUATE "expressions.evaluate" +#define ZBX_PROTO_VALUE_PROXY_UPLOAD_ENABLED "enabled" +#define ZBX_PROTO_VALUE_PROXY_UPLOAD_DISABLED "disabled" + typedef enum { ZBX_JSON_TYPE_UNKNOWN = 0, diff --git a/include/zbxserver.h b/include/zbxserver.h index 62d42f01346..01106df4d78 100644 --- a/include/zbxserver.h +++ b/include/zbxserver.h @@ -51,6 +51,7 @@ #define MACRO_TYPE_ITEM_TAG 0x01000000 #define MACRO_TYPE_EVENT_NAME 0x02000000 /* event name in trigger configuration */ #define MACRO_TYPE_EXPRESSION 0x04000000 /* macros in expression macro */ +#define MACRO_TYPE_SCRIPT_PARAMS_FIELD 0x08000000 #define MACRO_EXPAND_NO 0 #define MACRO_EXPAND_YES 1 |