aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libmime/message.c14
-rw-r--r--src/libserver/cfg_utils.c2
-rw-r--r--src/libserver/task.c23
-rw-r--r--src/libserver/url.c2
4 files changed, 23 insertions, 18 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index 9c27bf5f5..6c4004f61 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -770,7 +770,7 @@ convert_text_to_utf (struct rspamd_task *task,
gchar *res_str, *ocharset;
GByteArray *result_array;
- if (task->cfg->raw_mode) {
+ if (task->cfg && task->cfg->raw_mode) {
SET_PART_RAW (text_part);
return part_content;
}
@@ -1177,7 +1177,7 @@ process_text_part (struct rspamd_task *task,
cd = g_mime_part_get_content_disposition (GMIME_PART (mime_part->mime));
if (cd &&
g_ascii_strcasecmp (cd,
- "attachment") == 0 && !task->cfg->check_text_attachements) {
+ "attachment") == 0 && (task->cfg && !task->cfg->check_text_attachements)) {
debug_task ("skip attachments for checking as text parts");
return;
}
@@ -1186,7 +1186,7 @@ process_text_part (struct rspamd_task *task,
if (cd &&
g_ascii_strcasecmp (cd,
GMIME_DISPOSITION_ATTACHMENT) == 0 &&
- !task->cfg->check_text_attachements) {
+ (task->cfg && !task->cfg->check_text_attachements)) {
debug_task ("skip attachments for checking as text parts");
return;
}
@@ -1552,7 +1552,7 @@ rspamd_message_from_data (struct rspamd_task *task, GByteArray *data,
ct = g_mime_content_type_new_from_string (ct_cpy);
g_free (ct_cpy);
}
- else if (task->cfg->libs_ctx) {
+ else if (task->cfg && task->cfg->libs_ctx) {
/* Try to predict it by content (slow) */
mb = magic_buffer (task->cfg->libs_ctx->libmagic,
data->data,
@@ -1662,7 +1662,7 @@ rspamd_message_parse (struct rspamd_task *task)
message = g_mime_parser_construct_message (parser);
if (message == NULL) {
- if (!task->cfg->allow_raw_input) {
+ if (task->cfg && (!task->cfg->allow_raw_input)) {
msg_err_task ("cannot construct mime from stream");
g_set_error (&task->err,
rspamd_message_quark (),
@@ -1757,7 +1757,7 @@ rspamd_message_parse (struct rspamd_task *task)
if (i == 0) {
gboolean need_recv_correction = FALSE;
- if (recv->real_ip == NULL || task->cfg->ignore_received) {
+ if (recv->real_ip == NULL || (task->cfg && task->cfg->ignore_received)) {
need_recv_correction = TRUE;
}
else if (!(task->flags & RSPAMD_TASK_FLAG_NO_IP) && task->from_addr) {
@@ -1799,7 +1799,7 @@ rspamd_message_parse (struct rspamd_task *task)
/* Extract data from received header if we were not given IP */
if (task->received->len > 0 && (task->flags & RSPAMD_TASK_FLAG_NO_IP) &&
- !task->cfg->ignore_received) {
+ (task->cfg && !task->cfg->ignore_received)) {
recv = g_ptr_array_index (task->received, 0);
if (recv->real_ip) {
if (!rspamd_parse_inet_address (&task->from_addr,
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index fb3783866..8cc54c792 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -658,7 +658,7 @@ rspamd_config_post_load (struct rspamd_config *cfg, gboolean validate_cache)
G_DIR_SEPARATOR, "effective_tld_names.dat");
if (access (fpath->str, R_OK)) {
- msg_warn_config ("url_tld option is not specified but %s is available,"
+ msg_info_config ("url_tld option is not specified but %s is available,"
" therefore this file is assumed as TLD file for URL"
" extraction", fpath->str);
cfg->tld_file = rspamd_mempool_strdup (cfg->cfg_pool, fpath->str);
diff --git a/src/libserver/task.c b/src/libserver/task.c
index c76209cae..3d6387b52 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -40,15 +40,18 @@ rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg)
{
struct rspamd_task *new_task;
- g_assert (cfg != NULL);
-
new_task = g_slice_alloc0 (sizeof (struct rspamd_task));
new_task->worker = worker;
- new_task->cfg = cfg;
- REF_RETAIN (cfg);
- if (cfg->check_all_filters) {
- new_task->flags |= RSPAMD_TASK_FLAG_PASS_ALL;
+ if (cfg) {
+ new_task->cfg = cfg;
+ REF_RETAIN (cfg);
+
+ if (cfg->check_all_filters) {
+ new_task->flags |= RSPAMD_TASK_FLAG_PASS_ALL;
+ }
+
+ new_task->re_rt = rspamd_re_cache_runtime_new (cfg->re_cache);
}
gettimeofday (&new_task->tv, NULL);
@@ -61,7 +64,7 @@ rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg)
rspamd_mempool_add_destructor (new_task->task_pool,
(rspamd_mempool_destruct_t) g_hash_table_unref,
new_task->results);
- new_task->re_rt = rspamd_re_cache_runtime_new (cfg->re_cache);
+
new_task->raw_headers = g_hash_table_new (rspamd_strcase_hash,
rspamd_strcase_equal);
new_task->request_headers = g_hash_table_new_full (rspamd_ftok_icase_hash,
@@ -246,8 +249,10 @@ rspamd_task_free (struct rspamd_task *task)
close (task->sock);
}
- rspamd_re_cache_runtime_destroy (task->re_rt);
- REF_RELEASE (task->cfg);
+ if (task->cfg) {
+ rspamd_re_cache_runtime_destroy (task->re_rt);
+ REF_RELEASE (task->cfg);
+ }
rspamd_mempool_delete (task->task_pool);
g_slice_free1 (sizeof (struct rspamd_task), task);
diff --git a/src/libserver/url.c b/src/libserver/url.c
index fb725ed18..fe70585be 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -445,7 +445,7 @@ rspamd_url_init (const gchar *tld_file)
rspamd_url_parse_tld_file (tld_file, url_scanner);
}
else {
- msg_warn (
+ msg_info (
"tld extension file is not specified, url matching is limited");
}