}
*/
- masked = rspamd_inet_address_copy (session->addr);
+ masked = rspamd_inet_address_copy(session->addr, NULL);
if (rspamd_inet_address_get_af (masked) == AF_INET) {
rspamd_inet_address_apply_mask (masked,
session->addr, -1);
if (ip_stat == NULL) {
- naddr = rspamd_inet_address_copy (session->addr);
+ naddr = rspamd_inet_address_copy(session->addr, NULL);
ip_stat = g_malloc0 (sizeof (*ip_stat));
REF_INIT_RETAIN (ip_stat, fuzzy_key_stat_dtor);
rspamd_lru_hash_insert (session->key_stat->last_ips,
nerrors = g_malloc (sizeof (*nerrors));
*nerrors = 1;
rspamd_lru_hash_insert (session->ctx->errors_ips,
- rspamd_inet_address_copy (session->addr),
+ rspamd_inet_address_copy(session->addr, NULL),
nerrors, -1, -1);
}
else {
if (mta_name) {
trecv.by_hostname.assign_copy(std::string_view(mta_name));
}
- trecv.addr = rspamd_inet_address_copy(task->from_addr);
+ trecv.addr = rspamd_inet_address_copy(task->from_addr, NULL);
if (task->hostname) {
trecv.real_hostname.assign_copy(std::string_view(task->hostname));
phk->conns = empty_init;
phk->host = g_strdup (host);
phk->is_ssl = is_ssl;
- phk->addr = rspamd_inet_address_copy (addr);
+ phk->addr = rspamd_inet_address_copy(addr, NULL);
phk->port = hk.port;
}
rspamd_inet_addr_t *
-rspamd_inet_address_copy (const rspamd_inet_addr_t *addr)
+rspamd_inet_address_copy(const rspamd_inet_addr_t *addr, rspamd_mempool_t *pool)
{
rspamd_inet_addr_t *n;
return NULL;
}
- n = rspamd_inet_addr_create (addr->af, NULL);
+ n = rspamd_inet_addr_create (addr->af, pool);
if (n->af == AF_UNIX) {
memcpy (n->u.un, addr->u.un, sizeof (*addr->u.un));
* @param addr
* @return
*/
-rspamd_inet_addr_t *rspamd_inet_address_copy (const rspamd_inet_addr_t *addr);
+rspamd_inet_addr_t *rspamd_inet_address_copy(const rspamd_inet_addr_t *addr, rspamd_mempool_t *pool);
/**
* Returns hash for inet address (ignoring port)
}
for (i = 0; i < addrs->len; i ++) {
addr = g_ptr_array_index (addrs, i);
- rspamd_upstream_add_addr (upstream, rspamd_inet_address_copy (addr));
+ rspamd_upstream_add_addr (upstream, rspamd_inet_address_copy(addr, NULL));
}
}
msg->flags & RSPAMD_HTTP_FLAG_WANT_SSL);
if (ka_addr) {
- cbd->addr = rspamd_inet_address_copy(ka_addr);
+ cbd->addr = rspamd_inet_address_copy(ka_addr, NULL);
numeric_ip = true;
}
}
ip = g_malloc0 (sizeof (*ip));
if (old != NULL && old->addr != NULL) {
- ip->addr = rspamd_inet_address_copy (old->addr);
+ ip->addr = rspamd_inet_address_copy(old->addr, NULL);
}
pip = lua_newuserdata (L, sizeof (struct rspamd_lua_ip *));
struct rspamd_lua_ip *ip, **pip;
ip = g_malloc0 (sizeof (struct rspamd_lua_ip));
- ip->addr = rspamd_inet_address_copy (addr);
+ ip->addr = rspamd_inet_address_copy(addr, NULL);
pip = lua_newuserdata (L, sizeof (struct rspamd_lua_ip *));
rspamd_lua_setclass (L, "rspamd{ip}", -1);
*pip = ip;
rspamd_inet_address_free (task->from_addr);
}
- task->from_addr = rspamd_inet_address_copy (ip->addr);
+ task->from_addr = rspamd_inet_address_copy(ip->addr, NULL);
}
else {
return luaL_error (L, "invalid IP object");
return luaL_error (L, "invalid host class");
}
- addr = rspamd_inet_address_copy (lip->addr);
+ addr = rspamd_inet_address_copy(lip->addr, NULL);
if (port != 0) {
rspamd_inet_address_set_port (addr, port);
listen_opts, -1);
if (fd != -1) {
ls = g_malloc0 (sizeof (*ls));
- ls->addr = rspamd_inet_address_copy (g_ptr_array_index (addrs, i));
+ ls->addr = rspamd_inet_address_copy(g_ptr_array_index (addrs, i), NULL);
ls->fd = fd;
ls->type = RSPAMD_WORKER_SOCKET_TCP;
result = g_list_prepend (result, ls);
listen_opts | RSPAMD_INET_ADDRESS_LISTEN_REUSEPORT, -1);
if (fd != -1) {
ls = g_malloc0 (sizeof (*ls));
- ls->addr = rspamd_inet_address_copy (g_ptr_array_index (addrs, i));
+ ls->addr = rspamd_inet_address_copy(g_ptr_array_index (addrs, i), NULL);
ls->fd = fd;
ls->type = RSPAMD_WORKER_SOCKET_UDP;
result = g_list_prepend (result, ls);
task->sock = -1;
if (session->client_milter_conn) {
- task->client_addr = rspamd_inet_address_copy (
- session->client_milter_conn->addr);
+ task->client_addr = rspamd_inet_address_copy(
+ session->client_milter_conn->addr, NULL);
}
else {
- task->client_addr = rspamd_inet_address_copy (session->client_addr);
+ task->client_addr = rspamd_inet_address_copy(session->client_addr, NULL);
}
task->fin_arg = session;