diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-10-31 11:46:48 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-10-31 11:46:48 +0000 |
commit | fcc328517c4440e13b086691ff57874db5816885 (patch) | |
tree | 37d8964a47e07177c3c66a06e50dff0f77f8521e /src/controller.c | |
parent | ff8a6010e8798bf1242246705b88176538e626ff (diff) | |
download | rspamd-fcc328517c4440e13b086691ff57874db5816885.tar.gz rspamd-fcc328517c4440e13b086691ff57874db5816885.zip |
Fix roll history IP storage.
Diffstat (limited to 'src/controller.c')
-rw-r--r-- | src/controller.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/controller.c b/src/controller.c index dafbe5bc1..98a9df614 100644 --- a/src/controller.c +++ b/src/controller.c @@ -647,7 +647,6 @@ rspamd_controller_handle_history (struct rspamd_http_connection_entry *conn_ent, gint i, rows_proc, row_num; struct tm *tm; gchar timebuf[32]; - gchar ip_buf[INET6_ADDRSTRLEN]; ucl_object_t *top, *obj; ctx = session->ctx; @@ -675,27 +674,14 @@ rspamd_controller_handle_history (struct rspamd_http_connection_entry *conn_ent, /* Get only completed rows */ if (row->completed) { tm = localtime (&row->tv.tv_sec); - strftime (timebuf, sizeof (timebuf), "%F %H:%M:%S", tm); -#ifdef HAVE_INET_PTON - if (row->from_addr.ipv6) { - inet_ntop (AF_INET6, &row->from_addr.d.in6, ip_buf, - sizeof (ip_buf)); - } - else { - inet_ntop (AF_INET, &row->from_addr.d.in4, ip_buf, - sizeof (ip_buf)); - } -#else - rspamd_strlcpy (ip_buf, inet_ntoa (task->from_addr), - sizeof (ip_buf)); -#endif obj = ucl_object_typed_new (UCL_OBJECT); ucl_object_insert_key (obj, ucl_object_fromstring ( timebuf), "time", 0, false); ucl_object_insert_key (obj, ucl_object_fromstring ( row->message_id), "id", 0, false); ucl_object_insert_key (obj, ucl_object_fromstring ( - ip_buf), "ip", 0, false); + rspamd_inet_address_to_string (&row->from_addr)), + "ip", 0, false); ucl_object_insert_key (obj, ucl_object_fromstring (rspamd_action_to_str ( row->action)), "action", 0, false); |