/* Copyright (c) 2011-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#include "base64.h"
#include "ioloop.h"
#include "hash.h"
#include "llist.h"
#include "str-table.h"
#include "global-memory.h"
#include "stats-settings.h"
#include "mail-stats.h"
#include "mail-user.h"
#include "mail-ip.h"
#include "mail-session.h"
#include "mail-domain.h"
/* If session doesn't receive any updates for this long, assume that the
process associated with it has crashed, and forcibly disconnect the
session. Must be larger than SESSION_STATS_FORCE_REFRESH_SECS in
stats plugin */
updates to it, but this process doesn't know their session IDs. If these
missing IDs are found within this many seconds of starting the stats process,
don't log a warning about them. (On a larger installation this avoids
flooding the error log with hundreds of warnings.) */
/* sessions are sorted by their last_update timestamp, oldest first */
{
}
{
}
{
/* user="" service="" pid=0 is used for incoming sessions that were
no point in logging anything about them, since they contain no
useful information. */
i_warning("Session %s (user %s, service %s) "
"appears to have crashed, disconnecting it",
}
}
{
const char *session_id;
unsigned int i;
/* <session id> <username> <service> <pid> [key=value ..] */
*error_r = "CONNECT: Too few parameters";
return -1;
}
session_id = args[0];
return -1;
}
"CONNECT: Duplicate session ID %s for user %s service %s (old PID %ld, new PID %ld)",
return -1;
}
}
}
return 0;
}
{
}
{
}
{
if (!session->disconnected)
}
}
{
if (ioloop_time < session_id_warn_hide_until) {
return;
"hiding missing session ID warnings for %d seconds",
(int)(session_id_warn_hide_until - ioloop_time));
return;
}
}
const char **error_r)
{
*error_r = "Too few parameters";
return -1;
}
return 0;
}
return 1;
}
const char **error_r)
{
int ret;
return ret;
/* Create a new dummy session to avoid repeated warnings */
i_unreached();
i_unreached();
return 0;
}
{
int ret;
/* <session id> */
return ret;
if (!session->disconnected)
return 0;
}
const struct stats *diff_stats)
{
if (diff_stats != NULL)
}
{
const char *error;
/* <session id> <stats> */
return -1;
return -1;
}
return -1;
}
return -1;
}
return 0;
}
void mail_sessions_free_memory(void)
{
unsigned int diff;
while (mail_sessions_head != NULL &&
mail_sessions_head->refcount == 0) {
break;
break;
}
}
void mail_sessions_init(void)
{
services = str_table_init();
}
void mail_sessions_deinit(void)
{
while (mail_sessions_head != NULL) {
if (!session->disconnected)
}
}