]> source.dussan.org Git - rspamd.git/commitdiff
Print 'from: ' in logs if a task has no `user` specified
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 15 Sep 2015 17:29:25 +0000 (18:29 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 15 Sep 2015 17:29:25 +0000 (18:29 +0100)
src/libserver/protocol.c

index a1dabfab0c77037acaebc082ec5b862d0cf7001f..c023f768a2a8bde688770877d00674839c95840f 100644 (file)
@@ -1041,6 +1041,17 @@ rspamd_protocol_write_ucl (struct rspamd_task *task, GString *logbuf)
                if (task->user) {
                        rspamd_printf_gstring (logbuf, "user: %s, ", task->user);
                }
+               else if (task->from_envelope) {
+                       InternetAddress *ia;
+
+                       ia = internet_address_list_get_address (task->from_envelope, 0);
+
+                       if (ia && INTERNET_ADDRESS_IS_MAILBOX (ia)) {
+                               InternetAddressMailbox *iamb = INTERNET_ADDRESS_MAILBOX (ia);
+
+                               rspamd_printf_gstring (logbuf, "from: %s, ", iamb->addr);
+                       }
+               }
        }
 
        g_hash_table_iter_init (&hiter, task->results);