diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-16 09:13:54 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-16 09:13:54 +0000 |
commit | 092f591facd4aa19bcc4b9ee942d49692b040d0d (patch) | |
tree | b7926f6c50fa57dfa7d4bcfb3b4389148c5660de /src/libserver/task.c | |
parent | 8084064f98bc6abdb706409780f0672e8b2e30d1 (diff) | |
download | rspamd-092f591facd4aa19bcc4b9ee942d49692b040d0d.tar.gz rspamd-092f591facd4aa19bcc4b9ee942d49692b040d0d.zip |
Fix printing of multiple mail addresses in the log
Diffstat (limited to 'src/libserver/task.c')
-rw-r--r-- | src/libserver/task.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/libserver/task.c b/src/libserver/task.c index 11d8693a9..f89ca4097 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -851,7 +851,7 @@ rspamd_task_write_ialist (struct rspamd_task *task, struct rspamd_log_format *lf, rspamd_fstring_t *logbuf) { - rspamd_fstring_t *res = logbuf; + rspamd_fstring_t *res = logbuf, *varbuf; rspamd_ftok_t var = {.begin = NULL, .len = 0}; InternetAddressMailbox *iamb; InternetAddress *ia = NULL; @@ -861,26 +861,33 @@ rspamd_task_write_ialist (struct rspamd_task *task, lim = internet_address_list_length (ialist); } + varbuf = rspamd_fstring_new (); + for (i = 0; i < lim; i++) { ia = internet_address_list_get_address (ialist, i); - var.len = 0; if (ia && INTERNET_ADDRESS_IS_MAILBOX (ia)) { iamb = INTERNET_ADDRESS_MAILBOX (ia); - var.begin = iamb->addr; - var.len = strlen (var.begin); + varbuf = rspamd_fstring_append (varbuf, iamb->addr, + strlen (iamb->addr)); } - if (var.len > 0) { - res = rspamd_task_log_write_var (task, logbuf, - &var, (const rspamd_ftok_t *) lf->data); - + if (varbuf->len > 0) { if (i != lim - 1) { - res = rspamd_fstring_append (res, ",", 1); + varbuf = rspamd_fstring_append (varbuf, ",", 1); } } } + if (varbuf->len > 0) { + var.begin = varbuf->str; + var.len = varbuf->len; + res = rspamd_task_log_write_var (task, logbuf, + &var, (const rspamd_ftok_t *) lf->data); + } + + rspamd_fstring_free (varbuf); + return res; } |