... | ... |
@@ -186,6 +186,11 @@ void cli_pcre_perf_events_destroy() |
186 | 186 |
|
187 | 187 |
|
188 | 188 |
/* PCRE MATCHER FUNCTIONS */ |
189 |
+int cli_pcre_init() |
|
190 |
+{ |
|
191 |
+ return cli_pcre_init_internal(); |
|
192 |
+} |
|
193 |
+ |
|
189 | 194 |
int cli_pcre_addpatt(struct cli_matcher *root, const char *virname, const char *trigger, const char *pattern, const char *cflags, const char *offset, const uint32_t *lsigid, unsigned int options) |
190 | 195 |
{ |
191 | 196 |
struct cli_pcre_meta **newmetatable = NULL, *pm = NULL; |
... | ... |
@@ -790,6 +795,50 @@ void cli_pcre_freetable(struct cli_matcher *root) |
790 | 790 |
|
791 | 791 |
#else |
792 | 792 |
/* NO-PCRE FUNCTIONS */ |
793 |
+void cli_pcre_perf_print() |
|
794 |
+{ |
|
795 |
+ cli_errmsg("cli_pcre_perf_print: Cannot print PCRE performance results without PCRE support\n"); |
|
796 |
+ return; |
|
797 |
+} |
|
798 |
+ |
|
799 |
+void cli_pcre_perf_events_destroy() |
|
800 |
+{ |
|
801 |
+ cli_errmsg("cli_pcre_perf_events_destroy: Cannot destroy PCRE performance results without PCRE support\n"); |
|
802 |
+ return; |
|
803 |
+} |
|
804 |
+ |
|
805 |
+int cli_pcre_init() |
|
806 |
+{ |
|
807 |
+ cli_errmsg("cli_pcre_init: Cannot initialize PCRE without PCRE support\n"); |
|
808 |
+ return CL_SUCCESS; |
|
809 |
+} |
|
810 |
+ |
|
811 |
+int cli_pcre_build(struct cli_matcher *root, long long unsigned match_limit, long long unsigned recmatch_limit, const struct cli_dconf *dconf) |
|
812 |
+{ |
|
813 |
+ UNUSEDPARAM(root); |
|
814 |
+ UNUSEDPARAM(match_limit); |
|
815 |
+ UNUSEDPARAM(recmatch_limit); |
|
816 |
+ UNUSEDPARAM(dconf); |
|
817 |
+ |
|
818 |
+ cli_errmsg("cli_pcre_build: Cannot build PCRE expression without PCRE support\n"); |
|
819 |
+ return CL_SUCCESS; |
|
820 |
+} |
|
821 |
+ |
|
822 |
+int cli_pcre_scanbuf(const unsigned char *buffer, uint32_t length, const char **virname, struct cli_ac_result **res, const struct cli_matcher *root, struct cli_ac_data *mdata, const struct cli_pcre_off *data, cli_ctx *ctx) |
|
823 |
+{ |
|
824 |
+ UNUSEDPARAM(buffer); |
|
825 |
+ UNUSEDPARAM(length); |
|
826 |
+ UNUSEDPARAM(virname); |
|
827 |
+ UNUSEDPARAM(res); |
|
828 |
+ UNUSEDPARAM(root); |
|
829 |
+ UNUSEDPARAM(mdata); |
|
830 |
+ UNUSEDPARAM(data); |
|
831 |
+ UNUSEDPARAM(ctx); |
|
832 |
+ |
|
833 |
+ cli_errmsg("cli_pcre_scanbuf: Cannot scan buffer with PCRE expression without PCRE support\n"); |
|
834 |
+ return CL_SUCCESS; |
|
835 |
+} |
|
836 |
+ |
|
793 | 837 |
int cli_pcre_recaloff(struct cli_matcher *root, struct cli_pcre_off *data, struct cli_target_info *info, cli_ctx *ctx) |
794 | 838 |
{ |
795 | 839 |
UNUSEDPARAM(root); |
... | ... |
@@ -36,7 +36,7 @@ |
36 | 36 |
#include "mpool.h" |
37 | 37 |
#include "regex_pcre.h" |
38 | 38 |
|
39 |
-#define PNRE_SCAN_NONE 0 |
|
39 |
+#define PCRE_SCAN_NONE 0 |
|
40 | 40 |
#define PCRE_SCAN_BUFF 1 |
41 | 41 |
#define PCRE_SCAN_FMAP 2 |
42 | 42 |
|
... | ... |
@@ -73,6 +73,7 @@ void cli_pcre_perf_print(); |
73 | 73 |
void cli_pcre_perf_events_destroy(); |
74 | 74 |
|
75 | 75 |
/* PCRE MATCHER DECLARATIONS */ |
76 |
+int cli_pcre_init(); |
|
76 | 77 |
int cli_pcre_addpatt(struct cli_matcher *root, const char *virname, const char *trigger, const char *pattern, const char *cflags, const char *offset, const uint32_t *lsigid, unsigned int options); |
77 | 78 |
int cli_pcre_build(struct cli_matcher *root, long long unsigned match_limit, long long unsigned recmatch_limit, const struct cli_dconf *dconf); |
78 | 79 |
int cli_pcre_recaloff(struct cli_matcher *root, struct cli_pcre_off *data, struct cli_target_info *info, cli_ctx *ctx); |
... | ... |
@@ -81,9 +82,15 @@ int cli_pcre_scanbuf(const unsigned char *buffer, uint32_t length, const char ** |
81 | 81 |
void cli_pcre_freemeta(struct cli_matcher *root, struct cli_pcre_meta *pm); |
82 | 82 |
void cli_pcre_freetable(struct cli_matcher *root); |
83 | 83 |
#else |
84 |
-/* NO-PCRE DECLARATIONS - defined because encasing everything in '#if' is a pain */ |
|
84 |
+/* NO-PCRE DECLARATIONS - defined because encasing everything in '#if' is a pain and because dynamic library mappings are weird */ |
|
85 | 85 |
#define PCRE_BYPASS "" |
86 | 86 |
|
87 |
+void cli_pcre_perf_print(); |
|
88 |
+void cli_pcre_perf_events_destroy(); |
|
89 |
+ |
|
90 |
+int cli_pcre_init(); |
|
91 |
+int cli_pcre_build(struct cli_matcher *root, long long unsigned match_limit, long long unsigned recmatch_limit, const struct cli_dconf *dconf); |
|
92 |
+int cli_pcre_scanbuf(const unsigned char *buffer, uint32_t length, const char **virname, struct cli_ac_result **res, const struct cli_matcher *root, struct cli_ac_data *mdata, const struct cli_pcre_off *data, cli_ctx *ctx); |
|
87 | 93 |
int cli_pcre_recaloff(struct cli_matcher *root, struct cli_pcre_off *data, struct cli_target_info *info, cli_ctx *ctx); |
88 | 94 |
void cli_pcre_freeoff(struct cli_pcre_off *data); |
89 | 95 |
#endif /* HAVE_PCRE */ |
... | ... |
@@ -34,8 +34,8 @@ |
34 | 34 |
#include "others.h" |
35 | 35 |
#include "regex_pcre.h" |
36 | 36 |
|
37 |
-/* TODO: cli_pcre_init: redefine pcre_malloc and pcre_free, setup callback function? */ |
|
38 |
-int cli_pcre_init() |
|
37 |
+/* TODO: cli_pcre_init_internal: redefine pcre_malloc and pcre_free, setup callback function? */ |
|
38 |
+int cli_pcre_init_internal() |
|
39 | 39 |
{ |
40 | 40 |
pcre_malloc = cli_malloc; |
41 | 41 |
pcre_free = free; |
... | ... |
@@ -48,7 +48,7 @@ struct cli_pcre_data { |
48 | 48 |
uint32_t search_offset; /* start offset to search at for pcre_exec */ |
49 | 49 |
}; |
50 | 50 |
|
51 |
-int cli_pcre_init(); |
|
51 |
+int cli_pcre_init_internal(); |
|
52 | 52 |
int cli_pcre_addoptions(struct cli_pcre_data *pd, const char **opt, int errout); |
53 | 53 |
int cli_pcre_compile(struct cli_pcre_data *pd, long long unsigned match_limit, long long unsigned match_limit_recursion, unsigned int options, int opt_override); |
54 | 54 |
int cli_pcre_match(struct cli_pcre_data *pd, const unsigned char *buffer, uint32_t buflen, int override_offset, int options, int *ovector, size_t ovlen); |
... | ... |
@@ -31,7 +31,6 @@ |
31 | 31 |
#include "../libclamav/matcher-ac.h" |
32 | 32 |
#include "../libclamav/matcher-bm.h" |
33 | 33 |
#include "../libclamav/matcher-pcre.h" |
34 |
-#include "../libclamav/regex_pcre.h" |
|
35 | 34 |
#include "../libclamav/others.h" |
36 | 35 |
#include "../libclamav/default.h" |
37 | 36 |
#include "checks.h" |