]> source.dussan.org Git - rspamd.git/commitdiff
Fix log_urls setting.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 28 Nov 2011 14:52:16 +0000 (17:52 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 28 Nov 2011 14:52:16 +0000 (17:52 +0300)
src/kvstorage_server.c
src/protocol.c

index 0eba6fcffe13007adf21820a9602557a34b8e52c..683c5a2e404e15ad56345279ec8ca68c717cd619 100644 (file)
@@ -966,7 +966,7 @@ thr_accept_socket (gint fd, short what, void *arg)
                return;
        }
 
-       session = g_slice_alloc (sizeof (struct kvstorage_session));
+       session = g_slice_alloc0 (sizeof (struct kvstorage_session));
        session->pool = memory_pool_new (memory_pool_get_size ());
        session->state = KVSTORAGE_STATE_READ_CMD;
        session->thr = thr;
index 73f8b9de617083f7cf6211db7321bf6ada60cb62..70ba1bd8318faffc3a382604314141f25c3e5c6c 100644 (file)
@@ -651,6 +651,7 @@ struct tree_cb_data {
        gchar                          *buf;
        gsize                           len;
        gsize                           off;
+       struct worker_task             *task;
 };
 
 /*
@@ -672,6 +673,12 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud)
                cb->off += rspamd_snprintf (cb->buf + cb->off, cb->len - cb->off, " %*s,",
                                                                url->hostlen, url->host);
        }
+
+       if (cb->task->cfg->log_urls) {
+               msg_info ("<%s> URL: %s - %s: %s", cb->task->message_id, cb->task->user ?
+                               cb->task->user : "unknown", inet_ntoa (cb->task->client_addr), struri (url));
+       }
+
        return FALSE;
 }
 
@@ -687,6 +694,7 @@ show_url_header (struct worker_task *task)
        cb.buf = outbuf;
        cb.len = sizeof (outbuf);
        cb.off = r;
+       cb.task = task;
 
        g_tree_foreach (task->urls, urls_protocol_cb, &cb);
        /* Strip last ',' */
@@ -736,6 +744,7 @@ show_email_header (struct worker_task *task)
        cb.buf = outbuf;
        cb.len = sizeof (outbuf);
        cb.off = r;
+       cb.task = task;
 
        g_tree_foreach (task->emails, emails_protocol_cb, &cb);
        /* Strip last ',' */