diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-11-23 11:00:16 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-11-23 11:00:16 +0000 |
commit | ab7bca40dccd74145a189ba3404dc450da121499 (patch) | |
tree | c76957abd3cdf91609d155243617c15925071470 /src/lua | |
parent | a323f7124ecc32099f6bfa6816fcee1ee3c9d2a5 (diff) | |
download | rspamd-ab7bca40dccd74145a189ba3404dc450da121499.tar.gz rspamd-ab7bca40dccd74145a189ba3404dc450da121499.zip |
[Minor] Propagate pcre_only flag
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_config.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index c59850c9d..f3dc414db 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -2990,7 +2990,6 @@ lua_config_register_regexp (lua_State *L) GError *err = NULL; enum rspamd_re_type type = RSPAMD_RE_BODY; gboolean pcre_only = FALSE; - guint old_flags; /* * - `re`* : regular expression object @@ -3027,9 +3026,8 @@ lua_config_register_regexp (lua_State *L) } else { if (pcre_only) { - old_flags = rspamd_regexp_get_flags (re->re); - old_flags |= RSPAMD_REGEXP_FLAG_PCRE_ONLY; - rspamd_regexp_set_flags (re->re, old_flags); + rspamd_regexp_set_flags (re->re, + rspamd_regexp_get_flags (re->re) | RSPAMD_REGEXP_FLAG_PCRE_ONLY); } if (header_str != NULL) { @@ -3055,6 +3053,11 @@ lua_config_register_regexp (lua_State *L) if (cache_re != re->re) { rspamd_regexp_unref (re->re); re->re = rspamd_regexp_ref (cache_re); + + if (pcre_only) { + rspamd_regexp_set_flags (re->re, + rspamd_regexp_get_flags (re->re) | RSPAMD_REGEXP_FLAG_PCRE_ONLY); + } } } } |