Skip to content

Commit 5982714

Browse files
committed
poc: directly removing anything related to os_regex
1 parent da7a0eb commit 5982714

File tree

17 files changed

+32
-39
lines changed

17 files changed

+32
-39
lines changed

src/common/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ add_subdirectory(error_messages)
99
add_subdirectory(mem_op)
1010
add_subdirectory(binaries_op)
1111
add_subdirectory(os_net)
12-
add_subdirectory(os_regex)
1312
add_subdirectory(regex_op)
14-
add_subdirectory(validate_op)
1513
add_subdirectory(randombytes)
1614
add_subdirectory(bzip2_op)
17-
add_subdirectory(string_op)
18-
add_subdirectory(expression)
1915
add_subdirectory(debug_op)
2016
add_subdirectory(logging_helper)
2117
add_subdirectory(networkHelper)

src/common/debug_op/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ target_link_libraries(debug_op
1313
pthreads_op
1414
os_xml
1515
error_messages
16-
os_regex
1716
os_net
18-
string_op
1917
binaries_op
2018
regex_op
21-
validate_op
22-
expression
2319
randombytes
2420
bzip2_op
2521
cjson)

src/common/debug_op/src/debug_op.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,13 @@ void os_logging_config(){
306306

307307
}else{
308308

309-
parts = OS_StrBreak(',', logformat, 2);
309+
// TODO: replace function OS_StrBreak
310+
// parts = OS_StrBreak(',', logformat, 2);
310311
char * part;
311312
if (parts){
312313
for (i=0; parts[i]; i++){
313-
part = w_strtrim(parts[i]);
314+
// TODO: replace function w_strtrim
315+
// part = w_strtrim(parts[i]);
314316
if (!strcmp(part, "plain")){
315317
flags.log_plain = 1;
316318
}else if(!strcmp(part, "json")){

src/common/expression/include/expression.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#define PCRE2_CODE_UNIT_WIDTH 8
1414

1515
#include <pcre2.h>
16-
#include "os_regex.h"
1716
#include "os_ip.h"
1817

1918
#define OSMATCH_STR "osmatch"

src/common/file_op/src/file_op.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,7 +2202,9 @@ int cldir_ex_ignore(const char * name, const char ** ignore) {
22022202

22032203
while (dirent = readdir(dir), dirent) {
22042204
// Skip "." and ".."
2205-
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)) {
2205+
// TODO: replace function w_str_in_array
2206+
// 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)) {
2207+
if (dirent->d_name[0] == '.' && (dirent->d_name[1] == '\0' || (dirent->d_name[1] == '.' && dirent->d_name[2] == '\0'))) {
22062208
continue;
22072209
}
22082210

@@ -3449,25 +3451,30 @@ char *w_homedir(char *arg) {
34493451
#ifdef __MACH__
34503452
pid_t pid = getpid();
34513453
if (proc_pidpath(pid, buff, PATH_MAX) > 0) {
3452-
buff = w_strtok_r_str_delim(delim, &buff);
3454+
// TODO: replace function w_strtok_r_str_delim
3455+
//buff = w_strtok_r_str_delim(delim, &buff);
34533456
}
34543457
#else
34553458
if (realpath("/proc/self/exe", buff) != NULL) {
34563459
dirname(buff);
3457-
buff = w_strtok_r_str_delim(delim, &buff);
3460+
// TODO: replace function w_strtok_r_str_delim
3461+
//buff = w_strtok_r_str_delim(delim, &buff);
34583462
}
34593463
else if (realpath("/proc/curproc/file", buff) != NULL) {
34603464
dirname(buff);
3461-
buff = w_strtok_r_str_delim(delim, &buff);
3465+
// TODO: replace function w_strtok_r_str_delim
3466+
//buff = w_strtok_r_str_delim(delim, &buff);
34623467
}
34633468
else if (realpath("/proc/self/path/a.out", buff) != NULL) {
34643469
dirname(buff);
3465-
buff = w_strtok_r_str_delim(delim, &buff);
3470+
// TODO: replace function w_strtok_r_str_delim
3471+
//buff = w_strtok_r_str_delim(delim, &buff);
34663472
}
34673473
#endif
34683474
else if (realpath(arg, buff) != NULL) {
34693475
dirname(buff);
3470-
buff = w_strtok_r_str_delim(delim, &buff);
3476+
// TODO: replace function w_strtok_r_str_delim
3477+
//buff = w_strtok_r_str_delim(delim, &buff);
34713478
} else {
34723479
// The path was not found so read WAZUH_HOME env var
34733480
char * home_env = NULL;

src/common/os_net/src/os_net.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -892,9 +892,10 @@ void resolve_hostname(char **hostname, int attempts) {
892892
char *f_ip;
893893

894894
assert(hostname != NULL);
895-
if (OS_IsValidIP(*hostname, NULL) == 1) {
896-
return;
897-
}
895+
// TODO: replace function OS_IsValidIP
896+
// if (OS_IsValidIP(*hostname, NULL) == 1) {
897+
// return;
898+
// }
898899

899900
tmp_str = strchr(*hostname, '/');
900901
if (tmp_str) {
@@ -1059,9 +1060,11 @@ int get_ipv6_string(struct in6_addr addr6, char *address, size_t address_size) {
10591060
}
10601061
#endif
10611062

1062-
if ((ret == OS_SUCCESS) && !OS_GetIPv4FromIPv6(address, IPSIZE)) {
1063-
OS_ExpandIPv6(address, IPSIZE);
1064-
}
1063+
// TODO: replace function OS_GetIPv4FromIPv6
1064+
// if ((ret == OS_SUCCESS) && !OS_GetIPv4FromIPv6(address, IPSIZE)) {
1065+
// TODO: replace function OS_ExpandIPv6
1066+
// OS_ExpandIPv6(address, IPSIZE);
1067+
// }
10651068

10661069
return ret;
10671070
}

src/common/pthreads_op/src/pthreads_op.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ int CreateThreadJoinable(pthread_t *lthread, void * (*function_pointer)(void *),
2929
return -1;
3030
}
3131

32-
read_size = 1024 * (size_t)getDefine_Int("wazuh", "thread_stack_size", 2048, 65536);
32+
// TODO: replace function getDefine_Int
33+
read_size = 1024 * (size_t) 65536;
34+
// read_size = 1024 * (size_t)getDefine_Int("wazuh", "thread_stack_size", 2048, 65536);
3335

3436
/* Set the maximum stack limit to new threads */
3537
if (pthread_attr_setstacksize(&attr, read_size)) {

src/common/string_op/src/string_op.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include "shared.h"
1212
#include "string.h"
13-
#include "os_regex.h"
1413
#include "string_op.h"
1514

1615
#ifdef WIN32

src/common/utils/include/shared.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,10 @@
121121
#include "pthreads_op.h"
122122
#include "os_xml.h"
123123
#include "error_messages.h"
124-
#include "os_regex.h"
125-
#include "string_op.h"
126124
#include "binaries_op.h"
127125
#include "os_ip.h"
128-
#include "os_net.h"
129-
#include "expression.h"
130126
#include "randombytes.h"
131127
#include "bzip2_op.h"
132-
#include "validate_op.h"
133128

134129

135130
#ifndef LARGEFILE64_SOURCE

src/common/utils/tests/unit/wrappers/externals/pcre2/pcre2_wrappers.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define PCRE2_CODE_UNIT_WIDTH 8
1515

1616
#include "shared.h"
17-
#include "expression.h"
1817

1918
#define w_pcre2_match_data_create_from_pattern wrap_pcre2_match_data_create_from_pattern
2019
#define w_pcre2_match wrap_pcre2_match

0 commit comments

Comments
 (0)