return;
interval = imap_keepalive_interval_msecs(client->user->username,
- client->user->remote_ip,
+ client->user->conn.remote_ip,
interval);
timeout_remove(&ctx->keepalive_to);
str_printfa(cmd, "\tsession_created=%s",
dec2str(user->session_create_time));
}
- if (user->local_ip != NULL)
- str_printfa(cmd, "\tlip=%s", net_ip2addr(user->local_ip));
- if (user->remote_ip != NULL)
- str_printfa(cmd, "\trip=%s", net_ip2addr(user->remote_ip));
+ if (user->conn.local_ip != NULL)
+ str_printfa(cmd, "\tlip=%s", net_ip2addr(user->conn.local_ip));
+ if (user->conn.remote_ip != NULL)
+ str_printfa(cmd, "\trip=%s", net_ip2addr(user->conn.remote_ip));
if (client->userdb_fields != NULL) {
string_t *userdb_fields = t_str_new(256);
unsigned int i;
case 1:
client = imap_clients;
str_append(title, client->user->username);
- if (client->user->remote_ip != NULL) {
+ if (client->user->conn.remote_ip != NULL) {
str_append_c(title, ' ');
- str_append(title, net_ip2addr(client->user->remote_ip));
+ str_append(title,
+ net_ip2addr(client->user->conn.remote_ip));
}
wait_output = FALSE;
for (cmd = client->command_queue; cmd != NULL; cmd = cmd->next) {
user->service = p_strdup(user->pool, service);
if (local_ip != NULL && local_ip->family != 0) {
- user->local_ip = p_new(user->pool, struct ip_addr, 1);
- *user->local_ip = *local_ip;
+ user->conn.local_ip = p_new(user->pool, struct ip_addr, 1);
+ *user->conn.local_ip = *local_ip;
}
if (remote_ip != NULL && remote_ip->family != 0) {
- user->remote_ip = p_new(user->pool, struct ip_addr, 1);
- *user->remote_ip = *remote_ip;
+ user->conn.remote_ip = p_new(user->pool, struct ip_addr, 1);
+ *user->conn.remote_ip = *remote_ip;
}
}
const char *username =
p_strdup(user->pool, t_strcut(user->username, '@'));
const char *domain = i_strchr_to_next(user->username, '@');
- const char *local_ip = user->local_ip == NULL ? NULL :
- p_strdup(user->pool, net_ip2addr(user->local_ip));
- const char *remote_ip = user->remote_ip == NULL ? NULL :
- p_strdup(user->pool, net_ip2addr(user->remote_ip));
+ const char *local_ip = user->conn.local_ip == NULL ? NULL :
+ p_strdup(user->pool, net_ip2addr(user->conn.local_ip));
+ const char *remote_ip = user->conn.remote_ip == NULL ? NULL :
+ p_strdup(user->pool, net_ip2addr(user->conn.remote_ip));
const char *auth_user, *auth_username, *auth_domain;
if (user->auth_user == NULL) {
i_zero(&info);
info.service = user->service;
- if (user->local_ip != NULL)
- info.local_ip = *user->local_ip;
- if (user->remote_ip != NULL)
- info.remote_ip = *user->remote_ip;
+ if (user->conn.local_ip != NULL)
+ info.local_ip = *user->conn.local_ip;
+ if (user->conn.remote_ip != NULL)
+ info.remote_ip = *user->conn.remote_ip;
userdb_pool = pool_alloconly_create("userdb lookup", 2048);
ret = auth_master_user_lookup(mail_user_auth_master_conn,
const char *mail_user_get_anvil_userip_ident(struct mail_user *user)
{
- if (user->remote_ip == NULL)
+ if (user->conn.remote_ip == NULL)
return NULL;
- return t_strconcat(net_ip2addr(user->remote_ip), "/",
+ return t_strconcat(net_ip2addr(user->conn.remote_ip), "/",
str_tabescape(user->username), NULL);
}
if (user->_home != NULL)
mail_user_set_home(user2, user->_home);
mail_user_set_vars(user2, user->service,
- user->local_ip, user->remote_ip);
+ user->conn.local_ip, user->conn.remote_ip);
user2->uid = user->uid;
user2->gid = user->gid;
user2->anonymous = user->anonymous;
#ifndef MAIL_USER_H
#define MAIL_USER_H
+#include "net.h"
#include "unichar.h"
#include "mail-storage-settings.h"
void (*stats_fill)(struct mail_user *user, struct stats *stats);
};
+struct mail_user_connection_data {
+ struct ip_addr *local_ip, *remote_ip;
+};
+
struct mail_user {
pool_t pool;
struct mail_user_vfuncs v, *vlast;
gid_t gid;
const char *service;
const char *session_id;
- struct ip_addr *local_ip, *remote_ip;
+ struct mail_user_connection_data conn;
const char *auth_token, *auth_user;
const char *const *userdb_fields;
/* Timestamp when this session was initially created. Most importantly
str_printfa(str, "\t%s", my_pid);
/* optional fields */
- if (user->local_ip != NULL) {
+ if (user->conn.local_ip != NULL) {
str_append(str, "\tlip=");
- str_append(str, net_ip2addr(user->local_ip));
+ str_append(str, net_ip2addr(user->conn.local_ip));
}
- if (user->remote_ip != NULL) {
+ if (user->conn.remote_ip != NULL) {
str_append(str, "\trip=");
- str_append(str, net_ip2addr(user->remote_ip));
+ str_append(str, net_ip2addr(user->conn.remote_ip));
}
str_append_c(str, '\n');
return stats_connection_send(conn, str);
case 1:
client = pop3_clients;
str_append(title, client->user->username);
- if (client->user->remote_ip != NULL) {
+ if (client->user->conn.remote_ip != NULL) {
str_append_c(title, ' ');
- str_append(title, net_ip2addr(client->user->remote_ip));
+ str_append(title,
+ net_ip2addr(client->user->conn.remote_ip));
}
if (client->destroyed)
str_append(title, " (deinit)");