diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-15 18:36:56 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-15 18:36:56 +0100 |
commit | 94ff78192ff1fa92459327b778810851696918f4 (patch) | |
tree | 9d22885cc63b9f85308346e75bd0cf7a9991fddd /src | |
parent | 010142fade619ba8ace48bc2746c1926ff815cb7 (diff) | |
download | rspamd-94ff78192ff1fa92459327b778810851696918f4.tar.gz rspamd-94ff78192ff1fa92459327b778810851696918f4.zip |
Improve url log output.
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/protocol.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index c023f768a..7ee5491f8 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -685,6 +685,8 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud) struct rspamd_url *url = value; ucl_object_t *obj, *elt; struct rspamd_task *task = cb->task; + const gchar *user_field = "unknown"; + gboolean has_user = FALSE; if (!(task->flags & RSPAMD_TASK_FLAG_EXT_URLS)) { obj = ucl_object_fromlstring (url->host, url->hostlen); @@ -711,10 +713,26 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud) ucl_array_append (cb->top, obj); if (cb->task->cfg->log_urls) { - msg_info_task ("<%s> URL: %s - %s: %s", + if (task->user) { + user_field = task->user; + has_user = TRUE; + } + 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); + + user_field = iamb->addr; + } + } + + msg_info_task ("<%s> %s: %s; ip: %s; URL: %s", task->message_id, - task->user ? - task->user : "unknown", + has_user ? "user" : "from", + user_field, rspamd_inet_address_to_string (task->from_addr), struri (url)); } |