diff options
author | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-03-07 16:49:22 +0300 |
---|---|---|
committer | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-03-07 17:31:47 +0300 |
commit | 8b559861f407979fd54808ec7845b64fe5fe7b8b (patch) | |
tree | 0d72033bc3e74b17ee6890eda67383dc679f9ca3 | |
parent | 8d0745d66d3a6b1501dc13443b93b5e96687ad93 (diff) |
.......... [DEV-2113] refactored md5 logic out of libzbxcommon
-rw-r--r-- | include/common.h | 5 | ||||
-rw-r--r-- | include/md5.h | 93 | ||||
-rw-r--r-- | include/zbxalgo.h | 2 | ||||
-rw-r--r-- | include/zbxcrypto.h | 105 | ||||
-rw-r--r-- | src/libs/zbxalgo/algodefs.c | 40 | ||||
-rw-r--r-- | src/libs/zbxcommon/misc.c | 116 | ||||
-rw-r--r-- | src/libs/zbxcrypto/Makefile.am | 1 | ||||
-rw-r--r-- | src/libs/zbxcrypto/crypto.c | 178 | ||||
-rw-r--r-- | src/libs/zbxcrypto/md5.c | 2 | ||||
-rw-r--r-- | src/libs/zbxdbcache/dbconfig.c | 1 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/db.c | 1 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/proxy.c | 1 | ||||
-rw-r--r-- | src/libs/zbxdbupgrade/dbupgrade.h | 1 | ||||
-rw-r--r-- | src/libs/zbxembed/global.c | 1 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/common/file.c | 2 | ||||
-rw-r--r-- | src/zabbix_agent/Makefile.am | 2 | ||||
-rw-r--r-- | src/zabbix_agent/logfiles/persistent_state.h | 2 | ||||
-rw-r--r-- | src/zabbix_server/alerter/alerter.c | 1 | ||||
-rw-r--r-- | src/zabbix_server/reporter/report_manager.c | 1 | ||||
-rw-r--r-- | tests/libs/zbxhistory/Makefile.am | 2 |
20 files changed, 295 insertions, 262 deletions
diff --git a/include/common.h b/include/common.h index 2444ba1fc61..d48b73b0d7e 100644 --- a/include/common.h +++ b/include/common.h @@ -23,7 +23,6 @@ #include "sysinc.h" #include "module.h" #include "version.h" -#include "md5.h" #if defined(__MINGW32__) # define __try @@ -1694,7 +1693,6 @@ void zbx_update_env(double time_now); int zbx_get_agent_item_nextcheck(zbx_uint64_t itemid, const char *delay, int now, int *nextcheck, int *scheduling, char **error); #define ZBX_DATA_SESSION_TOKEN_SIZE (MD5_DIGEST_SIZE * 2) -char *zbx_create_token(zbx_uint64_t seed); #define ZBX_MAINTENANCE_IDLE 0 #define ZBX_MAINTENANCE_RUNNING 1 @@ -1802,7 +1800,4 @@ typedef enum ERR_Z3008 } zbx_err_codes_t; - -void zbx_md5buf2str(const md5_byte_t *md5, char *str); -int zbx_hex2bin(const unsigned char *p_hex, unsigned char *buf, int buf_len); #endif diff --git a/include/md5.h b/include/md5.h deleted file mode 100644 index 43fc329a189..00000000000 --- a/include/md5.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* $Id$ */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321, whose - text is available at - http://www.ietf.org/rfc/rfc1321.txt - The code is derived from the text of the RFC, including the test suite - (section A.5) but excluding the rest of Appendix A. It does not include - any code or documentation that is identified in the RFC as being - copyrighted. - - The original and principal author of md5.h is L. Peter Deutsch - <ghost@aladdin.com>. Other authors are noted in the change history - that follows (in reverse chronological order): - - 2002-04-13 lpd Removed support for non-ANSI compilers; removed - references to Ghostscript; clarified derivation from RFC 1321; - now handles byte order either statically or dynamically. - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); - added conditionalization for C++ compilation from Martin - Purschke <purschke@bnl.gov>. - 1999-05-03 lpd Original version. - */ - -#ifndef md5_INCLUDED -# define md5_INCLUDED - -/* - * This package supports both compile-time and run-time determination of CPU - * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be - * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is - * defined as non-zero, the code will be compiled to run only on big-endian - * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to - * run on either big- or little-endian CPUs, but will run slightly less - * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. - */ - -#define MD5_DIGEST_SIZE 16 - -typedef unsigned char md5_byte_t; /* 8-bit byte */ -typedef unsigned int md5_word_t; /* 32-bit word */ - -/* Define the state of the MD5 Algorithm. */ -typedef struct md5_state_s { - md5_word_t count[2]; /* message length in bits, lsw first */ - md5_word_t abcd[4]; /* digest buffer */ - md5_byte_t buf[64]; /* accumulate block */ -} md5_state_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Initialize the algorithm. */ -void zbx_md5_init(md5_state_t *pms); - -/* Append a string to the message. */ -void zbx_md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); - -/* Finish the message and return the digest. */ -void zbx_md5_finish(md5_state_t *pms, md5_byte_t digest[16]); - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* md5_INCLUDED */ diff --git a/include/zbxalgo.h b/include/zbxalgo.h index 1779138d8c3..bbdae93ca52 100644 --- a/include/zbxalgo.h +++ b/include/zbxalgo.h @@ -360,8 +360,6 @@ void umul64_64(zbx_uint128_t *result, zbx_uint64_t value, zbx_uint64_t factor); unsigned int zbx_isqrt32(unsigned int value); -char *zbx_gen_uuid4(const char *seed); - /* expression evaluation */ #define ZBX_INFINITY (1.0 / 0.0) /* "Positive infinity" value used as a fatal error code */ diff --git a/include/zbxcrypto.h b/include/zbxcrypto.h index d46def2a30d..34e0e5a75bd 100644 --- a/include/zbxcrypto.h +++ b/include/zbxcrypto.h @@ -20,6 +20,8 @@ #ifndef ZABBIX_ZBXCRYPTO_H #define ZABBIX_ZBXCRYPTO_H +#include "zbxtypes.h" + #if defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL) #if defined(_WINDOWS) @@ -41,4 +43,105 @@ void zbx_tls_version(void); #endif /* #if defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL) */ -#endif /* ZABBIX_DISK_H */ +#ifndef md5_INCLUDED +#define md5_INCLUDED +/* +** Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. +** +** This software is provided 'as-is', without any express or implied +** warranty. In no event will the authors be held liable for any damages +** arising from the use of this software. +** +** Permission is granted to anyone to use this software for any purpose, +** including commercial applications, and to alter it and redistribute it +** freely, subject to the following restrictions: +** +** 1. The origin of this software must not be misrepresented; you must not +** claim that you wrote the original software. If you use this software +** in a product, an acknowledgment in the product documentation would be +** appreciated but is not required. +** 2. Altered source versions must be plainly marked as such, and must not be +** misrepresented as being the original software. +** 3. This notice may not be removed or altered from any source distribution. +** +** L. Peter Deutsch +** ghost@aladdin.com +** + */ +/* $Id$ */ +/* +** Independent implementation of MD5 (RFC 1321). +** +** This code implements the MD5 Algorithm defined in RFC 1321, whose +** text is available at +** http://www.ietf.org/rfc/rfc1321.txt +** The code is derived from the text of the RFC, including the test suite +** (section A.5) but excluding the rest of Appendix A. It does not include +** any code or documentation that is identified in the RFC as being +** copyrighted. +** +** The original and principal author of md5.h is L. Peter Deutsch +** <ghost@aladdin.com>. Other authors are noted in the change history +** that follows (in reverse chronological order): +** +** 2002-04-13 lpd Removed support for non-ANSI compilers; removed +** references to Ghostscript; clarified derivation from RFC 1321; +** now handles byte order either statically or dynamically. +** 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. +** 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); +** added conditionalization for C++ compilation from Martin +** Purschke <purschke@bnl.gov>. +** 1999-05-03 lpd Original version. +*/ + +/* +** This package supports both compile-time and run-time determination of CPU +** byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be +** compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is +** defined as non-zero, the code will be compiled to run only on big-endian +** CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to +** run on either big- or little-endian CPUs, but will run slightly less +** efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. +*/ + +#define MD5_DIGEST_SIZE 16 + +typedef unsigned char md5_byte_t; /* 8-bit byte */ +typedef unsigned int md5_word_t; /* 32-bit word */ + +/* Define the state of the MD5 Algorithm. */ +typedef struct md5_state_s +{ + md5_word_t count[2]; /* message length in bits, lsw first */ + md5_word_t abcd[4]; /* digest buffer */ + md5_byte_t buf[64]; /* accumulate block */ +} md5_state_t; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Initialize the algorithm. */ +void zbx_md5_init(md5_state_t *pms); + +/* Append a string to the message. */ +void zbx_md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); + +/* Finish the message and return the digest. */ +void zbx_md5_finish(md5_state_t *pms, md5_byte_t digest[16]); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* md5_INCLUDED */ + +char *zbx_create_token(zbx_uint64_t seed); + +void zbx_md5buf2str(const md5_byte_t *md5, char *str); +int zbx_hex2bin(const unsigned char *p_hex, unsigned char *buf, int buf_len); + +char *zbx_gen_uuid4(const char *seed); + +#endif /* ZABBIX_CRYPTO_H */ diff --git a/src/libs/zbxalgo/algodefs.c b/src/libs/zbxalgo/algodefs.c index d3a3a71ac53..b6f2afd4e17 100644 --- a/src/libs/zbxalgo/algodefs.c +++ b/src/libs/zbxalgo/algodefs.c @@ -422,43 +422,3 @@ unsigned int zbx_isqrt32(unsigned int value) return result; } - -/****************************************************************************** - * * - * Purpose: calculate UUID version 4 as string of 32 symbols * - * * - * Parameters: seed - [IN] string for seed calculation * - * * - * Return value: uuid string * - * * - ******************************************************************************/ -char *zbx_gen_uuid4(const char *seed) -{ - size_t i; - const char *hex = "0123456789abcdef"; - char *ptr, *uuid; - md5_state_t state; - md5_byte_t hash[MD5_DIGEST_SIZE]; - -#define ZBX_UUID_VERSION 4 -#define ZBX_UUID_VARIANT 2 - - ptr = uuid = (char *)zbx_malloc(NULL, 2 * MD5_DIGEST_SIZE + 1); - - zbx_md5_init(&state); - zbx_md5_append(&state, (const md5_byte_t *)seed, (int)strlen(seed)); - zbx_md5_finish(&state, hash); - - hash[6] = (md5_byte_t)((hash[6] & 0xf) | (ZBX_UUID_VERSION << 4)); - hash[8] = (md5_byte_t)((hash[8] & 0x3f) | (ZBX_UUID_VARIANT << 6)); - - for (i = 0; i < MD5_DIGEST_SIZE; i++) - { - *ptr++ = hex[(hash[i] >> 4) & 0xf]; - *ptr++ = hex[hash[i] & 0xf]; - } - - *ptr = '\0'; - - return uuid; -} diff --git a/src/libs/zbxcommon/misc.c b/src/libs/zbxcommon/misc.c index bd58492543b..f1aba3df742 100644 --- a/src/libs/zbxcommon/misc.c +++ b/src/libs/zbxcommon/misc.c @@ -3530,47 +3530,6 @@ int zbx_alarm_timed_out(void) return (0 == zbx_timed_out ? FAIL : SUCCEED); } -/****************************************************************************** - * * - * Purpose: creates semi-unique token based on the seed and current timestamp * - * * - * Parameters: seed - [IN] the seed * - * * - * Return value: Hexadecimal token string, must be freed by caller * - * * - * Comments: if you change token creation algorithm do not forget to adjust * - * ZBX_DATA_SESSION_TOKEN_SIZE definition * - * * - ******************************************************************************/ -char *zbx_create_token(zbx_uint64_t seed) -{ - const char *hex = "0123456789abcdef"; - zbx_timespec_t ts; - md5_state_t state; - md5_byte_t hash[MD5_DIGEST_SIZE]; - int i; - char *token, *ptr; - - ptr = token = (char *)zbx_malloc(NULL, ZBX_DATA_SESSION_TOKEN_SIZE + 1); - - zbx_timespec(&ts); - - zbx_md5_init(&state); - zbx_md5_append(&state, (const md5_byte_t *)&seed, (int)sizeof(seed)); - zbx_md5_append(&state, (const md5_byte_t *)&ts, (int)sizeof(ts)); - zbx_md5_finish(&state, hash); - - for (i = 0; i < MD5_DIGEST_SIZE; i++) - { - *ptr++ = hex[hash[i] >> 4]; - *ptr++ = hex[hash[i] & 15]; - } - - *ptr = '\0'; - - return token; -} - #if !defined(_WINDOWS) && defined(HAVE_RESOLV_H) /****************************************************************************** * * @@ -3729,78 +3688,3 @@ void zbx_free_tag(zbx_tag_t *tag) zbx_free(tag->value); zbx_free(tag); } - -/****************************************************************************** - * * - * Purpose: get a textual representation of md5 sum * - * * - * Parameters: * - * md5 - [IN] buffer with md5 sum * - * str - [OUT] preallocated string with a text representation of MD5 * - * sum. String size must be at least * - * ZBX_MD5_PRINT_BUF_LEN bytes. * - * * - ******************************************************************************/ -void zbx_md5buf2str(const md5_byte_t *md5, char *str) -{ - const char *hex = "0123456789abcdef"; - char *p = str; - int i; - - for (i = 0; i < MD5_DIGEST_SIZE; i++) - { - *p++ = hex[md5[i] >> 4]; - *p++ = hex[md5[i] & 15]; - } - - *p = '\0'; -} - -/****************************************************************************** - * * - * Purpose: * - * convert ASCII hex digit string to a binary representation (byte * - * string) * - * * - * Parameters: * - * p_hex - [IN] null-terminated input string * - * buf - [OUT] output buffer * - * buf_len - [IN] output buffer size * - * * - * Return value: * - * Number of bytes written into 'buf' on successful conversion. * - * -1 - an error occurred. * - * * - * Comments: * - * In case of error incomplete useless data may be written into 'buf'. * - * * - ******************************************************************************/ -int zbx_hex2bin(const unsigned char *p_hex, unsigned char *buf, int buf_len) -{ - unsigned char *q = buf; - int len = 0; - - while ('\0' != *p_hex) - { - if (0 != isxdigit(*p_hex) && 0 != isxdigit(*(p_hex + 1)) && buf_len > len) - { - unsigned char hi = *p_hex & 0x0f; - unsigned char lo; - - if ('9' < *p_hex++) - hi = (unsigned char)(hi + 9u); - - lo = *p_hex & 0x0f; - - if ('9' < *p_hex++) - lo = (unsigned char)(lo + 9u); - - *q++ = (unsigned char)(hi << 4 | lo); - len++; - } - else - return -1; - } - - return len; -} diff --git a/src/libs/zbxcrypto/Makefile.am b/src/libs/zbxcrypto/Makefile.am index 64dc7ebb133..9133520f962 100644 --- a/src/libs/zbxcrypto/Makefile.am +++ b/src/libs/zbxcrypto/Makefile.am @@ -3,6 +3,7 @@ noinst_LIBRARIES = libzbxcrypto.a libzbxcrypto_a_SOURCES = \ + crypto.c \ base64.c \ md5.c \ sha256crypt.c \ diff --git a/src/libs/zbxcrypto/crypto.c b/src/libs/zbxcrypto/crypto.c new file mode 100644 index 00000000000..c5039ec5268 --- /dev/null +++ b/src/libs/zbxcrypto/crypto.c @@ -0,0 +1,178 @@ +/* +** Zabbix +** Copyright (C) 2001-2022 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. +**/ + +#include "zbxcrypto.h" + +#include "common.h" + +/****************************************************************************** + * * + * Purpose: creates semi-unique token based on the seed and current timestamp * + * * + * Parameters: seed - [IN] the seed * + * * + * Return value: Hexadecimal token string, must be freed by caller * + * * + * Comments: if you change token creation algorithm do not forget to adjust * + * ZBX_DATA_SESSION_TOKEN_SIZE definition * + * * + ******************************************************************************/ +char *zbx_create_token(zbx_uint64_t seed) +{ + const char *hex = "0123456789abcdef"; + zbx_timespec_t ts; + md5_state_t state; + md5_byte_t hash[MD5_DIGEST_SIZE]; + int i; + char *token, *ptr; + + ptr = token = (char *)zbx_malloc(NULL, ZBX_DATA_SESSION_TOKEN_SIZE + 1); + + zbx_timespec(&ts); + + zbx_md5_init(&state); + zbx_md5_append(&state, (const md5_byte_t *)&seed, (int)sizeof(seed)); + zbx_md5_append(&state, (const md5_byte_t *)&ts, (int)sizeof(ts)); + zbx_md5_finish(&state, hash); + + for (i = 0; i < MD5_DIGEST_SIZE; i++) + { + *ptr++ = hex[hash[i] >> 4]; + *ptr++ = hex[hash[i] & 15]; + } + + *ptr = '\0'; + + return token; +} + +/****************************************************************************** + * * + * Purpose: get a textual representation of md5 sum * + * * + * Parameters: * + * md5 - [IN] buffer with md5 sum * + * str - [OUT] preallocated string with a text representation of MD5 * + * sum. String size must be at least * + * ZBX_MD5_PRINT_BUF_LEN bytes. * + * * + ******************************************************************************/ +void zbx_md5buf2str(const md5_byte_t *md5, char *str) +{ + const char *hex = "0123456789abcdef"; + char *p = str; + int i; + + for (i = 0; i < MD5_DIGEST_SIZE; i++) + { + *p++ = hex[md5[i] >> 4]; + *p++ = hex[md5[i] & 15]; + } + + *p = '\0'; +} + +/****************************************************************************** + * * + * Purpose: * + * convert ASCII hex digit string to a binary representation (byte * + * string) * + * * + * Parameters: * + * p_hex - [IN] null-terminated input string * + * buf - [OUT] output buffer * + * buf_len - [IN] output buffer size * + * * + * Return value: * + * Number of bytes written into 'buf' on successful conversion. * + * -1 - an error occurred. * + * * + * Comments: * + * In case of error incomplete useless data may be written into 'buf'. * + * * + ******************************************************************************/ +int zbx_hex2bin(const unsigned char *p_hex, unsigned char *buf, int buf_len) +{ + unsigned char *q = buf; + int len = 0; + + while ('\0' != *p_hex) + { + if (0 != isxdigit(*p_hex) && 0 != isxdigit(*(p_hex + 1)) && buf_len > len) + { + unsigned char hi = *p_hex & 0x0f; + unsigned char lo; + + if ('9' < *p_hex++) + hi = (unsigned char)(hi + 9u); + + lo = *p_hex & 0x0f; + + if ('9' < *p_hex++) + lo = (unsigned char)(lo + 9u); + + *q++ = (unsigned char)(hi << 4 | lo); + len++; + } + else + return -1; + } + + return len; +} + +/****************************************************************************** + * * + * Purpose: calculate UUID version 4 as string of 32 symbols * + * * + * Parameters: seed - [IN] string for seed calculation * + * * + * Return value: uuid string * + * * + ******************************************************************************/ +char *zbx_gen_uuid4(const char *seed) +{ + size_t i; + const char *hex = "0123456789abcdef"; + char *ptr, *uuid; + md5_state_t state; + md5_byte_t hash[MD5_DIGEST_SIZE]; + +#define ZBX_UUID_VERSION 4 +#define ZBX_UUID_VARIANT 2 + + ptr = uuid = (char *)zbx_malloc(NULL, 2 * MD5_DIGEST_SIZE + 1); + + zbx_md5_init(&state); + zbx_md5_append(&state, (const md5_byte_t *)seed, (int)strlen(seed)); + zbx_md5_finish(&state, hash); + + hash[6] = (md5_byte_t)((hash[6] & 0xf) | (ZBX_UUID_VERSION << 4)); + hash[8] = (md5_byte_t)((hash[8] & 0x3f) | (ZBX_UUID_VARIANT << 6)); + + for (i = 0; i < MD5_DIGEST_SIZE; i++) + { + *ptr++ = hex[(hash[i] >> 4) & 0xf]; + *ptr++ = hex[hash[i] & 0xf]; + } + + *ptr = '\0'; + + return uuid; +} diff --git a/src/libs/zbxcrypto/md5.c b/src/libs/zbxcrypto/md5.c index 3153586e317..53483946669 100644 --- a/src/libs/zbxcrypto/md5.c +++ b/src/libs/zbxcrypto/md5.c @@ -51,7 +51,7 @@ 1999-05-03 lpd Original version. */ -#include "md5.h" +#include "zbxcrypto.h" #include "string.h" diff --git a/src/libs/zbxdbcache/dbconfig.c b/src/libs/zbxdbcache/dbconfig.c index 608c6e2fac3..3e7c5ff186c 100644 --- a/src/libs/zbxdbcache/dbconfig.c +++ b/src/libs/zbxdbcache/dbconfig.c @@ -24,6 +24,7 @@ #include "zbxserver.h" #include "zbxregexp.h" #include "cfg.h" +#include "zbxcrypto.h" #include "../zbxcrypto/tls_tcp_active.h" #include "../zbxalgo/vectorimpl.h" #include "base64.h" diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c index 4208935e96f..1a837b31fe9 100644 --- a/src/libs/zbxdbhigh/db.c +++ b/src/libs/zbxdbhigh/db.c @@ -24,6 +24,7 @@ #include "threads.h" #include "dbcache.h" #include "cfg.h" +#include "zbxcrypto.h" #if defined(HAVE_POSTGRESQL) # define ZBX_SUPPORTED_DB_CHARACTER_SET "utf8" diff --git a/src/libs/zbxdbhigh/proxy.c b/src/libs/zbxdbhigh/proxy.c index dc498156cd7..2ac3da22373 100644 --- a/src/libs/zbxdbhigh/proxy.c +++ b/src/libs/zbxdbhigh/proxy.c @@ -28,6 +28,7 @@ #include "discovery.h" #include "zbxalgo.h" #include "preproc.h" +#include "zbxcrypto.h" #include "../zbxcrypto/tls_tcp_active.h" #include "zbxlld.h" #include "events.h" diff --git a/src/libs/zbxdbupgrade/dbupgrade.h b/src/libs/zbxdbupgrade/dbupgrade.h index d8d51e7db91..54456dfe620 100644 --- a/src/libs/zbxdbupgrade/dbupgrade.h +++ b/src/libs/zbxdbupgrade/dbupgrade.h @@ -21,6 +21,7 @@ #define ZABBIX_DBUPGRADE_H #include "common.h" +#include "zbxcrypto.h" #include "dbschema.h" typedef struct diff --git a/src/libs/zbxembed/global.c b/src/libs/zbxembed/global.c index d8af3902419..0ee66bae18e 100644 --- a/src/libs/zbxembed/global.c +++ b/src/libs/zbxembed/global.c @@ -24,6 +24,7 @@ #include "duktape.h" #include "base64.h" #include "sha256crypt.h" +#include "zbxcrypto.h" /****************************************************************************** * * diff --git a/src/libs/zbxsysinfo/common/file.c b/src/libs/zbxsysinfo/common/file.c index f53cb253246..50c8f8143e0 100644 --- a/src/libs/zbxsysinfo/common/file.c +++ b/src/libs/zbxsysinfo/common/file.c @@ -21,7 +21,7 @@ #include "common.h" #include "sysinfo.h" -#include "md5.h" +#include "zbxcrypto.h" #include "zbxregexp.h" #include "log.h" #include "dir.h" diff --git a/src/zabbix_agent/Makefile.am b/src/zabbix_agent/Makefile.am index d2006c2399f..731722ddf7f 100644 --- a/src/zabbix_agent/Makefile.am +++ b/src/zabbix_agent/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = \ logfiles - + EXTRA_DIST = \ eventlog.c \ eventlog.h \ diff --git a/src/zabbix_agent/logfiles/persistent_state.h b/src/zabbix_agent/logfiles/persistent_state.h index 03f03b1169f..ee102572bb6 100644 --- a/src/zabbix_agent/logfiles/persistent_state.h +++ b/src/zabbix_agent/logfiles/persistent_state.h @@ -21,7 +21,7 @@ #define ZABBIX_PERSISTENT_STATE_H #include "common.h" /* for SEC_PER_DAY */ -#include "md5.h" /* for MD5_DIGEST_SIZE, md5_byte_t */ +#include "zbxcrypto.h" /* for MD5_DIGEST_SIZE, md5_byte_t */ #include "zbxtypes.h" /* for zbx_uint64_t struct st_logfile; */ #include "zbxalgo.h" diff --git a/src/zabbix_server/alerter/alerter.c b/src/zabbix_server/alerter/alerter.c index 09e6ecc3a5c..ec566fa7780 100644 --- a/src/zabbix_server/alerter/alerter.c +++ b/src/zabbix_server/alerter/alerter.c @@ -28,6 +28,7 @@ #include "dbcache.h" #include "alerter_protocol.h" #include "zbxembed.h" +#include "zbxcrypto.h" #define ALARM_ACTION_TIMEOUT 40 diff --git a/src/zabbix_server/reporter/report_manager.c b/src/zabbix_server/reporter/report_manager.c index 833ac1a6cad..63f0827d26b 100644 --- a/src/zabbix_server/reporter/report_manager.c +++ b/src/zabbix_server/reporter/report_manager.c @@ -23,6 +23,7 @@ #include "daemon.h" #include "base64.h" #include "zbxreport.h" +#include "zbxcrypto.h" #include "../../libs/zbxcrypto/hmac_sha256.h" #include "sha256crypt.h" #include "../../libs/zbxalgo/vectorimpl.h" diff --git a/tests/libs/zbxhistory/Makefile.am b/tests/libs/zbxhistory/Makefile.am index c28a45c55e9..fdc7e2323da 100644 --- a/tests/libs/zbxhistory/Makefile.am +++ b/tests/libs/zbxhistory/Makefile.am @@ -9,7 +9,6 @@ HISTORY_LIBS = \ $(top_srcdir)/src/libs/zbxcomms/libzbxcomms.a \ $(top_srcdir)/src/libs/zbxcompress/libzbxcompress.a \ $(top_srcdir)/src/libs/zbxnix/libzbxnix.a \ - $(top_srcdir)/src/libs/zbxcrypto/libzbxcrypto.a \ $(top_srcdir)/src/libs/zbxsys/libzbxsys.a \ $(top_srcdir)/src/libs/zbxlog/libzbxlog.a \ $(top_srcdir)/src/libs/zbxsys/libzbxsys.a \ @@ -24,6 +23,7 @@ HISTORY_LIBS = \ $(top_srcdir)/src/libs/zbxdb/libzbxdb.a \ $(top_srcdir)/src/libs/zbxjson/libzbxjson.a \ $(top_srcdir)/src/libs/zbxregexp/libzbxregexp.a \ + $(top_srcdir)/src/libs/zbxcrypto/libzbxcrypto.a \ $(top_srcdir)/src/libs/zbxcommon/libzbxcommon.a \ $(top_srcdir)/tests/libzbxmockdata.a |