summaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-10 15:38:34 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-10 15:38:34 +0000
commit576108c64c01901848010673efc53b46a24dbc92 (patch)
tree5df2355d81d48ed1534c62817398cea0e186c1a2 /src/libutil
parent1aed295e93e1153bff796f9c2472f7e318ae1e28 (diff)
downloadrspamd-576108c64c01901848010673efc53b46a24dbc92.tar.gz
rspamd-576108c64c01901848010673efc53b46a24dbc92.zip
Add special flag to disable hyperscan for particular expressions
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/regexp.c16
-rw-r--r--src/libutil/regexp.h9
2 files changed, 21 insertions, 4 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 39ff5ebf2..5b3fca551 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -33,10 +33,6 @@
typedef guchar regexp_id_t[rspamd_cryptobox_HASHBYTES];
-#define RSPAMD_REGEXP_FLAG_RAW (1 << 1)
-#define RSPAMD_REGEXP_FLAG_NOOPT (1 << 2)
-#define RSPAMD_REGEXP_FLAG_FULL_MATCH (1 << 3)
-
struct rspamd_regexp_s {
gdouble exec_time;
gchar *pattern;
@@ -494,6 +490,18 @@ rspamd_regexp_get_pattern (rspamd_regexp_t *re)
}
guint
+rspamd_regexp_set_flags (rspamd_regexp_t *re, guint new_flags)
+{
+ guint old_flags;
+
+ g_assert (re != NULL);
+ old_flags = re->flags;
+ re->flags = new_flags;
+
+ return old_flags;
+}
+
+guint
rspamd_regexp_get_flags (rspamd_regexp_t *re)
{
g_assert (re != NULL);
diff --git a/src/libutil/regexp.h b/src/libutil/regexp.h
index 0b585ceec..bf88035e2 100644
--- a/src/libutil/regexp.h
+++ b/src/libutil/regexp.h
@@ -28,6 +28,10 @@
#include "config.h"
#define RSPAMD_INVALID_ID ((guint64)-1LL)
+#define RSPAMD_REGEXP_FLAG_RAW (1 << 1)
+#define RSPAMD_REGEXP_FLAG_NOOPT (1 << 2)
+#define RSPAMD_REGEXP_FLAG_FULL_MATCH (1 << 3)
+#define RSPAMD_REGEXP_FLAG_PCRE_ONLY (1 << 4)
typedef struct rspamd_regexp_s rspamd_regexp_t;
struct rspamd_regexp_cache;
@@ -122,6 +126,11 @@ guint rspamd_regexp_get_pcre_flags (rspamd_regexp_t *re);
guint rspamd_regexp_get_flags (rspamd_regexp_t *re);
/**
+ * Set rspamd flags for the regexp
+ */
+guint rspamd_regexp_set_flags (rspamd_regexp_t *re, guint new_flags);
+
+/**
* Set regexp maximum hits
*/
guint rspamd_regexp_get_maxhits (rspamd_regexp_t *re);