aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-10-24 16:52:19 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-10-24 16:52:19 +0300
commit8bc658b66cee9ba7184d23b195ce2f40e297034c (patch)
treecb42eab97f3486bacb05d79ae11c764b7d808d0d
parent9e6a83cbdbe9727dbb7aa508ac4d05ea2e3bd030 (diff)
downloadrspamd-8bc658b66cee9ba7184d23b195ce2f40e297034c.tar.gz
rspamd-8bc658b66cee9ba7184d23b195ce2f40e297034c.zip
Fix bug in compare_content_param function.
-rw-r--r--src/expressions.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/expressions.c b/src/expressions.c
index acf1b31a2..3012d2d5d 100644
--- a/src/expressions.c
+++ b/src/expressions.c
@@ -1193,31 +1193,33 @@ rspamd_content_type_compare_param (struct worker_task * task, GList * args, void
if ((param_data = g_mime_content_type_get_parameter ((GMimeContentType *)ct, param_name)) == NULL) {
result = FALSE;
}
- 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;
+ 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_cache_add (param_pattern, re, task->cfg->cfg_pool);
- }
- if ((r = task_cache_check (task, re)) == -1) {
- if (g_regex_match (re->regexp, param_data, 0, NULL) == TRUE) {
- task_cache_add (task, re, 1);
- return TRUE;
+ if ((r = task_cache_check (task, re)) == -1) {
+ if (g_regex_match (re->regexp, param_data, 0, NULL) == TRUE) {
+ task_cache_add (task, re, 1);
+ return TRUE;
+ }
+ task_cache_add (task, re, 0);
}
- task_cache_add (task, re, 0);
- }
- else {
+ else {
+ }
}
- }
- else {
- /* Just do strcasecmp */
- if (g_ascii_strcasecmp (param_data, param_pattern) == 0) {
- return TRUE;
+ else {
+ /* Just do strcasecmp */
+ if (g_ascii_strcasecmp (param_data, param_pattern) == 0) {
+ return TRUE;
+ }
}
}
/* Get next part */