diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 1ea6dd78e6..31b0d87e74 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -4,18 +4,12 @@ add_subdirectory(time_op) add_subdirectory(file_op) add_subdirectory(privsep_op) add_subdirectory(pthreads_op) -add_subdirectory(os_xml) add_subdirectory(error_messages) add_subdirectory(mem_op) add_subdirectory(binaries_op) -add_subdirectory(os_net) -add_subdirectory(os_regex) add_subdirectory(regex_op) -add_subdirectory(validate_op) add_subdirectory(randombytes) add_subdirectory(bzip2_op) -add_subdirectory(string_op) -add_subdirectory(expression) add_subdirectory(debug_op) add_subdirectory(logging_helper) add_subdirectory(networkHelper) diff --git a/src/common/debug_op/CMakeLists.txt b/src/common/debug_op/CMakeLists.txt index 72131b0ed9..924e34d357 100644 --- a/src/common/debug_op/CMakeLists.txt +++ b/src/common/debug_op/CMakeLists.txt @@ -11,15 +11,10 @@ target_link_libraries(debug_op mem_op privsep_op pthreads_op - os_xml error_messages - os_regex - os_net - string_op binaries_op regex_op - validate_op - expression randombytes bzip2_op - cjson) \ No newline at end of file + cjson) + diff --git a/src/common/debug_op/src/debug_op.c b/src/common/debug_op/src/debug_op.c index efe8cc9a35..294f9f9e1c 100644 --- a/src/common/debug_op/src/debug_op.c +++ b/src/common/debug_op/src/debug_op.c @@ -278,7 +278,7 @@ void w_logging_init(){ } void os_logging_config(){ - OS_XML xml; +// OS_XML xml; const char * xmlf[] = {"ossec_config", "logging", "log_format", NULL}; char * logformat; char ** parts = NULL; @@ -286,14 +286,17 @@ void os_logging_config(){ pid = (int)getpid(); - if (OS_ReadXML(OSSECCONF, &xml) < 0){ - flags.log_plain = 1; - flags.log_json = 0; - OS_ClearXML(&xml); - mlerror_exit(LOGLEVEL_ERROR, XML_ERROR, OSSECCONF, xml.err, xml.err_line); - } - - logformat = OS_GetOneContentforElement(&xml, xmlf); +// TODO: replace function OS_ReadXML +// if (OS_ReadXML(OSSECCONF, &xml) < 0){ +// flags.log_plain = 1; +// flags.log_json = 0; +// TODO: replace function OS_ClearXML +// OS_ClearXML(&xml); +// TODO: replace XML_ERROR +// mlerror_exit(LOGLEVEL_ERROR, XML_ERROR, OSSECCONF, xml.err, xml.err_line); +// } +// TODO: replace function OS_GetOneContentforElement +// logformat = OS_GetOneContentforElement(&xml, xmlf); if (!logformat || logformat[0] == '\0'){ @@ -301,16 +304,20 @@ void os_logging_config(){ flags.log_json = 0; free(logformat); - OS_ClearXML(&xml); - mdebug1(XML_NO_ELEM, "log_format"); + // TODO: replace function OS_ClearXML + // OS_ClearXML(&xml); + // TODO: replace XML_NO_ELEM + // mdebug1(XML_NO_ELEM, "log_format"); }else{ - parts = OS_StrBreak(',', logformat, 2); + // TODO: replace function OS_StrBreak + // parts = OS_StrBreak(',', logformat, 2); char * part; if (parts){ for (i=0; parts[i]; i++){ - part = w_strtrim(parts[i]); + // TODO: replace function w_strtrim + // part = w_strtrim(parts[i]); if (!strcmp(part, "plain")){ flags.log_plain = 1; }else if(!strcmp(part, "json")){ @@ -318,7 +325,8 @@ void os_logging_config(){ }else{ flags.log_plain = 1; flags.log_json = 0; - mlerror_exit(LOGLEVEL_ERROR, XML_VALUEERR, "log_format", part); + // TODO: replace XML_VALUEERR + // mlerror_exit(LOGLEVEL_ERROR, XML_VALUEERR, "log_format", part); } } for (i=0; parts[i]; i++){ @@ -328,7 +336,8 @@ void os_logging_config(){ } free(logformat); - OS_ClearXML(&xml); + // TODO: replace function OS_ClearXML + // OS_ClearXML(&xml); } } diff --git a/src/common/expression/include/expression.h b/src/common/expression/include/expression.h index 342aeb8e5f..4ca4f19a3b 100644 --- a/src/common/expression/include/expression.h +++ b/src/common/expression/include/expression.h @@ -13,7 +13,6 @@ #define PCRE2_CODE_UNIT_WIDTH 8 #include -#include "os_regex.h" #include "os_ip.h" #define OSMATCH_STR "osmatch" diff --git a/src/common/file_op/src/file_op.c b/src/common/file_op/src/file_op.c index 4b8e9e8aab..dd609cfb53 100644 --- a/src/common/file_op/src/file_op.c +++ b/src/common/file_op/src/file_op.c @@ -2202,7 +2202,9 @@ int cldir_ex_ignore(const char * name, const char ** ignore) { while (dirent = readdir(dir), dirent) { // Skip "." and ".." - if ((dirent->d_name[0] == '.' && (dirent->d_name[1] == '\0' || (dirent->d_name[1] == '.' && dirent->d_name[2] == '\0'))) || w_str_in_array(dirent->d_name, ignore)) { + // TODO: replace function w_str_in_array + // if ((dirent->d_name[0] == '.' && (dirent->d_name[1] == '\0' || (dirent->d_name[1] == '.' && dirent->d_name[2] == '\0'))) || w_str_in_array(dirent->d_name, ignore)) { + if (dirent->d_name[0] == '.' && (dirent->d_name[1] == '\0' || (dirent->d_name[1] == '.' && dirent->d_name[2] == '\0'))) { continue; } @@ -3449,25 +3451,30 @@ char *w_homedir(char *arg) { #ifdef __MACH__ pid_t pid = getpid(); if (proc_pidpath(pid, buff, PATH_MAX) > 0) { - buff = w_strtok_r_str_delim(delim, &buff); + // TODO: replace function w_strtok_r_str_delim + //buff = w_strtok_r_str_delim(delim, &buff); } #else if (realpath("/proc/self/exe", buff) != NULL) { dirname(buff); - buff = w_strtok_r_str_delim(delim, &buff); + // TODO: replace function w_strtok_r_str_delim + //buff = w_strtok_r_str_delim(delim, &buff); } else if (realpath("/proc/curproc/file", buff) != NULL) { dirname(buff); - buff = w_strtok_r_str_delim(delim, &buff); + // TODO: replace function w_strtok_r_str_delim + //buff = w_strtok_r_str_delim(delim, &buff); } else if (realpath("/proc/self/path/a.out", buff) != NULL) { dirname(buff); - buff = w_strtok_r_str_delim(delim, &buff); + // TODO: replace function w_strtok_r_str_delim + //buff = w_strtok_r_str_delim(delim, &buff); } #endif else if (realpath(arg, buff) != NULL) { dirname(buff); - buff = w_strtok_r_str_delim(delim, &buff); + // TODO: replace function w_strtok_r_str_delim + //buff = w_strtok_r_str_delim(delim, &buff); } else { // The path was not found so read WAZUH_HOME env var char * home_env = NULL; diff --git a/src/common/os_net/src/os_net.c b/src/common/os_net/src/os_net.c index 25d26dcd20..7b15e1f0e3 100644 --- a/src/common/os_net/src/os_net.c +++ b/src/common/os_net/src/os_net.c @@ -892,9 +892,10 @@ void resolve_hostname(char **hostname, int attempts) { char *f_ip; assert(hostname != NULL); - if (OS_IsValidIP(*hostname, NULL) == 1) { - return; - } + // TODO: replace function OS_IsValidIP + // if (OS_IsValidIP(*hostname, NULL) == 1) { + // return; + // } tmp_str = strchr(*hostname, '/'); if (tmp_str) { @@ -1059,9 +1060,11 @@ int get_ipv6_string(struct in6_addr addr6, char *address, size_t address_size) { } #endif - if ((ret == OS_SUCCESS) && !OS_GetIPv4FromIPv6(address, IPSIZE)) { - OS_ExpandIPv6(address, IPSIZE); - } + // TODO: replace function OS_GetIPv4FromIPv6 + // if ((ret == OS_SUCCESS) && !OS_GetIPv4FromIPv6(address, IPSIZE)) { + // TODO: replace function OS_ExpandIPv6 + // OS_ExpandIPv6(address, IPSIZE); + // } return ret; } diff --git a/src/common/pthreads_op/src/pthreads_op.c b/src/common/pthreads_op/src/pthreads_op.c index 3d379e47a6..a83ccbbcba 100644 --- a/src/common/pthreads_op/src/pthreads_op.c +++ b/src/common/pthreads_op/src/pthreads_op.c @@ -29,7 +29,9 @@ int CreateThreadJoinable(pthread_t *lthread, void * (*function_pointer)(void *), return -1; } - read_size = 1024 * (size_t)getDefine_Int("wazuh", "thread_stack_size", 2048, 65536); + // TODO: replace function getDefine_Int + read_size = 1024 * (size_t) 65536; + // read_size = 1024 * (size_t)getDefine_Int("wazuh", "thread_stack_size", 2048, 65536); /* Set the maximum stack limit to new threads */ if (pthread_attr_setstacksize(&attr, read_size)) { diff --git a/src/common/string_op/src/string_op.c b/src/common/string_op/src/string_op.c index 6397f8d8a8..dead17e87a 100644 --- a/src/common/string_op/src/string_op.c +++ b/src/common/string_op/src/string_op.c @@ -10,7 +10,6 @@ #include "shared.h" #include "string.h" -#include "os_regex.h" #include "string_op.h" #ifdef WIN32 diff --git a/src/common/utils/include/shared.h b/src/common/utils/include/shared.h index 2ee7f2a699..d586d82ea3 100644 --- a/src/common/utils/include/shared.h +++ b/src/common/utils/include/shared.h @@ -119,17 +119,11 @@ #include "mem_op.h" #include "privsep_op.h" #include "pthreads_op.h" -#include "os_xml.h" #include "error_messages.h" -#include "os_regex.h" -#include "string_op.h" #include "binaries_op.h" #include "os_ip.h" -#include "os_net.h" -#include "expression.h" #include "randombytes.h" #include "bzip2_op.h" -#include "validate_op.h" #ifndef LARGEFILE64_SOURCE diff --git a/src/common/utils/tests/unit/wrappers/externals/pcre2/pcre2_wrappers.h b/src/common/utils/tests/unit/wrappers/externals/pcre2/pcre2_wrappers.h index 4881f0fa2c..1659cd9619 100644 --- a/src/common/utils/tests/unit/wrappers/externals/pcre2/pcre2_wrappers.h +++ b/src/common/utils/tests/unit/wrappers/externals/pcre2/pcre2_wrappers.h @@ -14,7 +14,6 @@ #define PCRE2_CODE_UNIT_WIDTH 8 #include "shared.h" -#include "expression.h" #define w_pcre2_match_data_create_from_pattern wrap_pcre2_match_data_create_from_pattern #define w_pcre2_match wrap_pcre2_match diff --git a/src/common/validate_op/src/validate_op.c b/src/common/validate_op/src/validate_op.c index 4aee999a04..415886b2ca 100644 --- a/src/common/validate_op/src/validate_op.c +++ b/src/common/validate_op/src/validate_op.c @@ -10,7 +10,6 @@ #include "shared.h" #include "validate_op.h" -#include "expression.h" #include "os_net.h" #ifdef WAZUH_UNIT_TESTING diff --git a/src/common/version_op/src/version_op.c b/src/common/version_op/src/version_op.c index 8001329ce6..ad35fa7ff2 100644 --- a/src/common/version_op/src/version_op.c +++ b/src/common/version_op/src/version_op.c @@ -716,7 +716,9 @@ os_info *get_unix_version() char *key = strtok_r(buff, ":", &save_ptr); if (key) { const char *expected_key = "System Version"; - char *trimmed_key = w_strtrim(key); + // TODO: replace function w_strtrim + // char *trimmed_key = w_strtrim(key); + char *trimmed_key = key; if (NULL != trimmed_key && strncmp(trimmed_key, expected_key, strlen(expected_key)) == 0) { char *value = strtok_r(NULL, " ", &save_ptr); if (value) { diff --git a/src/modules/fim/src/whodata/syscheck_audit.c b/src/modules/fim/src/whodata/syscheck_audit.c index 78791d6e7e..74974bd0e7 100644 --- a/src/modules/fim/src/whodata/syscheck_audit.c +++ b/src/modules/fim/src/whodata/syscheck_audit.c @@ -16,7 +16,6 @@ #include "../os_net/os_net.h" #include "syscheck_op.h" #include "audit_op.h" -#include "string_op.h" #define AUDIT_RULES_FILE "etc/audit_rules_wazuh.rules" #define AUDIT_RULES_LINK "/etc/audit/rules.d/audit_rules_wazuh.rules" diff --git a/src/modules/inventory/CMakeLists.txt b/src/modules/inventory/CMakeLists.txt index 91d7da3f14..70f67a6609 100644 --- a/src/modules/inventory/CMakeLists.txt +++ b/src/modules/inventory/CMakeLists.txt @@ -24,11 +24,9 @@ target_include_directories(inventory PUBLIC ${COMMON_FOLDER}/file_op/include ${COMMON_FOLDER}/hashHelper/include ${COMMON_FOLDER}/logging_helper/include - ${COMMON_FOLDER}/os_xml/include ${COMMON_FOLDER}/privsep_op/include ${COMMON_FOLDER}/pthreads_op/include ${COMMON_FOLDER}/stringHelper/include - ${COMMON_FOLDER}/string_op/include ${COMMON_FOLDER}/time_op/include ${COMMON_FOLDER}/timeHelper/include ${COMMON_FOLDER}/utils) @@ -48,7 +46,6 @@ target_link_libraries(inventory PUBLIC OpenSSL::SSL OpenSSL::Crypto utils - os_regex logging_helper pthreads_op MultiTypeQueue) diff --git a/src/modules/inventory/src/inventory.cpp b/src/modules/inventory/src/inventory.cpp index 01939c1ebd..4d6fc7e190 100644 --- a/src/modules/inventory/src/inventory.cpp +++ b/src/modules/inventory/src/inventory.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include diff --git a/src/modules/logcollector/include/journal_log.h b/src/modules/logcollector/include/journal_log.h index 56b3206407..6db6a2a696 100644 --- a/src/modules/logcollector/include/journal_log.h +++ b/src/modules/logcollector/include/journal_log.h @@ -5,7 +5,6 @@ #include "../config/localfile-config.h" #include "cJSON.h" -#include "expression.h" /******************************************************************************* * NOTE: This module is not thread-safe. diff --git a/src/modules/sca/src/wm_sca.c b/src/modules/sca/src/wm_sca.c index f81c5dcf18..0e1458e17e 100644 --- a/src/modules/sca/src/wm_sca.c +++ b/src/modules/sca/src/wm_sca.c @@ -13,7 +13,6 @@ #include #include #include "os_crypto/sha256/sha256_op.h" -#include "expression.h" #include "shared.h" #undef minfo