case REGEXP_MESSAGE:
debug_task ("checking message regexp: %s", re->regexp_text);
raw = TRUE;
+ regexp = re->regexp;
ct = (guint8 *)task->msg.start;
clen = task->msg.len;
if (*re_text == '/') {
/* This is a regexp */
- if ((re = re_cache_check (re_text, task->cfg->cfg_pool)) == NULL) {
- re = parse_regexp (task->cfg->cfg_pool,
- (gchar *)re_text,
- task->cfg->raw_mode);
- if (re == NULL) {
- msg_warn ("cannot compile regexp for function");
- return FALSE;
- }
- re_cache_add ((gchar *)re_text, re, task->cfg->cfg_pool);
+ re = parse_regexp (task->cfg->cfg_pool,
+ (gchar *)re_text,
+ task->cfg->raw_mode);
+ if (re == NULL) {
+ msg_warn ("cannot compile regexp for function");
+ return FALSE;
}
+
if ((r = task_cache_check (task, re)) == -1) {
- if (g_regex_match (re->regexp, what, 0, NULL) == TRUE) {
+ if (rspamd_regexp_search (re->regexp, what, 0, NULL, NULL, FALSE)) {
task_cache_add (task, re, 1);
return TRUE;
}
/* This is a regexp */
if (task != NULL) {
- if ((re = re_cache_check (re_text, task->cfg->cfg_pool)) == NULL) {
- re = parse_regexp (task->cfg->cfg_pool,
- (gchar *)re_text,
- task->cfg->raw_mode);
- if (re == NULL) {
- msg_warn ("cannot compile regexp for function");
- return FALSE;
- }
- re_cache_add ((gchar *)re_text, re, task->cfg->cfg_pool);
+ re = parse_regexp (task->cfg->cfg_pool,
+ (gchar *)re_text,
+ task->cfg->raw_mode);
+ if (re == NULL) {
+ msg_warn ("cannot compile regexp for function");
+ return FALSE;
}
r = process_regexp (re, task, NULL, 0, NULL);
}
}
else {
if (*param_pattern == '/') {
- /* This is regexp, so compile and create g_regexp object */
- if ((re =
- re_cache_check (param_pattern,
- task->cfg->cfg_pool)) == NULL) {
- re = parse_regexp (task->cfg->cfg_pool,
- param_pattern,
- task->cfg->raw_mode);
- if (re == NULL) {
- msg_warn ("cannot compile regexp for function");
- return FALSE;
- }
- re_cache_add (param_pattern, re, task->cfg->cfg_pool);
+ re = parse_regexp (task->cfg->cfg_pool,
+ param_pattern,
+ task->cfg->raw_mode);
+ if (re == NULL) {
+ msg_warn ("cannot compile regexp for function");
+ return FALSE;
}
if ((r = task_cache_check (task, re)) == -1) {
- if (g_regex_match (re->regexp, param_data, 0,
- NULL) == TRUE) {
+ if (rspamd_regexp_search (re->regexp, param_data, 0,
+ NULL, NULL, FALSE) == TRUE) {
task_cache_add (task, re, 1);
return TRUE;
}
#endif
for (;; ) {
if (*param_pattern == '/') {
- /* This is regexp, so compile and create g_regexp object */
- if ((re =
- re_cache_check (param_pattern,
- task->cfg->cfg_pool)) == NULL) {
- re = parse_regexp (task->cfg->cfg_pool,
- param_pattern,
- task->cfg->raw_mode);
- if (re == NULL) {
- msg_warn ("cannot compile regexp for function");
- return FALSE;
- }
- re_cache_add (param_pattern, re, task->cfg->cfg_pool);
+ re = parse_regexp (task->cfg->cfg_pool,
+ param_pattern,
+ task->cfg->raw_mode);
+ if (re == NULL) {
+ msg_warn ("cannot compile regexp for function");
+ return FALSE;
}
if ((r = task_cache_check (task, re)) == -1) {
- if (g_regex_match (re->regexp, ct->subtype, 0,
- NULL) == TRUE) {
+ if (rspamd_regexp_search (re->regexp, ct->subtype, 0,
+ NULL, NULL, FALSE)) {
task_cache_add (task, re, 1);
return TRUE;
}
#endif
for (;; ) {
if (*param_pattern == '/') {
- /* This is regexp, so compile and create g_regexp object */
- if ((re =
- re_cache_check (param_pattern,
- task->cfg->cfg_pool)) == NULL) {
- re = parse_regexp (task->cfg->cfg_pool,
- param_pattern,
- task->cfg->raw_mode);
- if (re == NULL) {
- msg_warn ("cannot compile regexp for function");
- return FALSE;
- }
- re_cache_add (param_pattern, re, task->cfg->cfg_pool);
+ re = parse_regexp (task->cfg->cfg_pool,
+ param_pattern,
+ task->cfg->raw_mode);
+ if (re == NULL) {
+ msg_warn ("cannot compile regexp for function");
+ return FALSE;
}
if ((r = task_cache_check (task, re)) == -1) {
- if (g_regex_match (re->regexp, ct->type, 0, NULL) == TRUE) {
+ if (rspamd_regexp_search (re->regexp, ct->type, 0,
+ NULL, NULL, FALSE) == TRUE) {
task_cache_add (task, re, 1);
return TRUE;
}
return FALSE;
}
if (*subtype == '/') {
- /* This is regexp, so compile and create g_regexp object */
- if ((re = re_cache_check (subtype, task->cfg->cfg_pool)) == NULL) {
- re =
- parse_regexp (task->cfg->cfg_pool, subtype,
- task->cfg->raw_mode);
- if (re == NULL) {
- msg_warn ("cannot compile regexp for function");
- return FALSE;
- }
- re_cache_add (subtype, re, task->cfg->cfg_pool);
+ re = parse_regexp (task->cfg->cfg_pool, subtype,
+ task->cfg->raw_mode);
+ if (re == NULL) {
+ msg_warn ("cannot compile regexp for function");
+ return FALSE;
}
if ((r = task_cache_check (task, re)) == -1) {
- if (g_regex_match (re->regexp, subtype, 0, NULL) == TRUE) {
+ if (rspamd_regexp_search (re->regexp, subtype, 0,
+ NULL, NULL, FALSE) == TRUE) {
task_cache_add (task, re, 1);
return TRUE;
}
}
if (*param_type == '/') {
- /* This is regexp, so compile and create g_regexp object */
- if ((re =
- re_cache_check (param_type, task->cfg->cfg_pool)) == NULL) {
- re = parse_regexp (task->cfg->cfg_pool,
- param_type,
- task->cfg->raw_mode);
- if (re == NULL) {
- msg_warn ("cannot compile regexp for function");
- cur = g_list_next (cur);
- continue;
- }
- re_cache_add (param_type, re, task->cfg->cfg_pool);
+ re = parse_regexp (task->cfg->cfg_pool,
+ param_type,
+ task->cfg->raw_mode);
+ if (re == NULL) {
+ msg_warn ("cannot compile regexp for function");
+ cur = g_list_next (cur);
+ continue;
}
if ((r = task_cache_check (task, re)) == -1) {
if (ct->type &&
- g_regex_match (re->regexp, ct->type, 0, NULL) == TRUE) {
+ rspamd_regexp_search (re->regexp, ct->type, 0,
+ NULL, NULL, TRUE)) {
if (param_subtype) {
if (compare_subtype (task, ct, param_subtype)) {
if (compare_len (part, min_len, max_len)) {