aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-04 15:29:19 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-04 15:29:19 +0000
commit1ed6a2f0b92671f36848880d7db5dcdef82460f4 (patch)
treec9645c769e182eae219e838a0893298e9a3faa07 /src
parent5dabcdd94fdb6f56974c4bd5435b473c0fd92eed (diff)
downloadrspamd-1ed6a2f0b92671f36848880d7db5dcdef82460f4.tar.gz
rspamd-1ed6a2f0b92671f36848880d7db5dcdef82460f4.zip
Support m,, patterns in lua regexps.
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_regexp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c
index a86424c66..04f141fb3 100644
--- a/src/lua/lua_regexp.c
+++ b/src/lua/lua_regexp.c
@@ -102,7 +102,7 @@ lua_regexp_create (lua_State *L)
GRegex *re;
struct rspamd_lua_regexp *new, **pnew;
const gchar *string, *flags_str = NULL, *slash;
- gchar *pattern;
+ gchar *pattern, sep;
GError *err = NULL;
string = luaL_checkstring (L, 1);
@@ -122,6 +122,17 @@ lua_regexp_create (lua_State *L)
pattern = g_strdup (string);
}
}
+ else if (string[0] == 'm') {
+ /* Special case for perl */
+ slash = &string[1];
+ sep = *slash;
+ slash = strrchr (string, sep);
+ if (slash != NULL && slash > &string[1]) {
+ flags_str = slash + 1;
+ pattern = g_malloc (slash - string - 1);
+ rspamd_strlcpy (pattern, string + 2, slash - string - 1);
+ }
+ }
else {
pattern = g_strdup (string);
}