]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix printing from field in log_urls
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 5 Aug 2016 11:56:15 +0000 (12:56 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 5 Aug 2016 12:05:45 +0000 (13:05 +0100)
src/libserver/protocol.c

index f508a2f3ae0cac5ea55960a560fc8c1319d5f364..e10231b792d45a8f63950d99993e795372e1034f 100644 (file)
@@ -675,6 +675,7 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud)
        struct rspamd_task *task = cb->task;
        const gchar *user_field = "unknown";
        gboolean has_user = FALSE;
+       guint len = 0;
 
        if (!(task->flags & RSPAMD_TASK_FLAG_EXT_URLS)) {
                obj = ucl_object_fromlstring (url->string, url->urllen);
@@ -688,16 +689,18 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud)
        if (cb->task->cfg->log_urls) {
                if (task->user) {
                        user_field = task->user;
+                       len = strlen (task->user);
                        has_user = TRUE;
                }
                else if (task->from_envelope) {
                        user_field = task->from_envelope->addr;
+                       len = task->from_envelope->addr_len;
                }
 
-               msg_info_task ("<%s> %s: %s; ip: %s; URL: %*s",
+               msg_info_task ("<%s> %s: %*s; ip: %s; URL: %*s",
                        task->message_id,
                        has_user ? "user" : "from",
-                       user_field,
+                       len, user_field,
                        rspamd_inet_address_to_string (task->from_addr),
                        url->urllen, url->string);
        }