X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fos_regex%2Fos_match_compile.c;fp=src%2Fos_regex%2Fos_match_compile.c;h=366e79ed69f4cfd42a68c5eaa6befeb683a48160;hp=8521b3f11bd3ab68f4868ca1b218b0de494a4af1;hb=a62b46c229549212d536867b7e5e24d7576ebe8b;hpb=d623b82886b9b5fbba3fa27c3bfac51f3f8af108 diff --git a/src/os_regex/os_match_compile.c b/src/os_regex/os_match_compile.c index 8521b3f..366e79e 100755 --- a/src/os_regex/os_match_compile.c +++ b/src/os_regex/os_match_compile.c @@ -5,7 +5,7 @@ * * This program is a free software; you can redistribute it * and/or modify it under the terms of the GNU General Public - * License (version 3) as published by the FSF - Free Software + * License (version 2) as published by the FSF - Free Software * Foundation */ @@ -24,6 +24,7 @@ int _os_strncmp(char *pattern, char *str, int str_len, int size); int _os_strcmp_last(char *pattern, char *str, int str_len, int size); int _os_strcmp(char *pattern, char *str, int str_len, int size); int _os_strmatch(char *pattern, char *str, int str_len, int size); +int _os_strstr(char *pattern, char *str, int str_len, int size); /** int OSMatch_Compile(char *pattern, OSMatch *reg, int flags) v0.1 @@ -35,6 +36,7 @@ int _os_strmatch(char *pattern, char *str, int str_len, int size); */ int OSMatch_Compile(char *pattern, OSMatch *reg, int flags) { + int usstrstr = 0; int i = 0; int count = 0; int end_of_string = 0; @@ -83,6 +85,7 @@ int OSMatch_Compile(char *pattern, OSMatch *reg, int flags) new_str_free = new_str; pt = new_str; + /* Getting the number of sub patterns */ while(*pt != '\0') @@ -100,6 +103,10 @@ int OSMatch_Compile(char *pattern, OSMatch *reg, int flags) { count++; } + else if(*pt == -29) + { + usstrstr = 1; + } pt++; } @@ -179,13 +186,20 @@ int OSMatch_Compile(char *pattern, OSMatch *reg, int flags) reg->size[i] = strlen(reg->patterns[i]) -1; reg->patterns[i][reg->size[i]] = '\0'; } - + /* If string starts with ^, use strncmp */ else if(*new_str == BEGINREGEX) { reg->match_fp[i] = _os_strncmp; reg->size[i] = strlen(reg->patterns[i]); } + + else if(usstrstr == 1) + { + reg->match_fp[i] = _os_strstr; + reg->size[i] = strlen(reg->patterns[i]); + } + else { reg->match_fp[i] = _OS_Match;