Procházet zdrojové kódy

Fix roll history IP storage.

tags/0.7.3
Vsevolod Stakhov před 9 roky
rodič
revize
fcc328517c
2 změnil soubory, kde provedl 3 přidání a 28 odebrání
  1. 2
    16
      src/controller.c
  2. 1
    12
      src/libserver/roll_history.h

+ 2
- 16
src/controller.c Zobrazit soubor

@@ -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);

+ 1
- 12
src/libserver/roll_history.h Zobrazit soubor

@@ -45,18 +45,7 @@ struct roll_history_row {
gchar message_id[HISTORY_MAX_ID];
gchar symbols[HISTORY_MAX_SYMBOLS];
gchar user[HISTORY_MAX_USER];
#ifdef HAVE_INET_PTON
struct {
union {
struct in_addr in4;
struct in6_addr in6;
} d;
gboolean ipv6;
gboolean has_addr;
} from_addr;
#else
struct in_addr from_addr;
#endif
rspamd_inet_addr_t from_addr;
gsize len;
guint scan_time;
gint action;

Načítá se…
Zrušit
Uložit